Prestashop JS script tracking confirmation order page - prestashop

I have a problem.
I need to deploy a tracking script for a partner to track orders. He sent me this:
<script>
var dcData = {
event: 'sel',
clear: 1,
price: '<price>',
cdata: {
orderNumber: '<ordernumber>',
email: '<email>',
},
}
digitalCircle('event', dcData);
</script>
It doesn't work after putting it in the confirm page.
Hello,
I have a problem.
I need to deploy a tracking script for a partner to track orders. He sent me this:
var dcData = {
event: 'sel',
clear: 1,
price: '',
cdata: {
orderNumber: '',
email: '',
},
}
digitalCircle('event', dcData);
It doesn't work after putting it in the confirm page.

Related

storing qr code in google pay(google wallet)

Is it possible to store information such as QR code in google pay just like apple wallet ? if not is there any alternative ,I have researched certain apps and haven't got any relevant resource yet
Yes, it is possible. Many different types of passes support a Barcode property where type is QR_CODE.
Here is an example on how to set it:
const loyaltyObject = {
id: getLoyaltyId(email),
classId: `${issuerId}.${loyaltyProgram}`,
accountId: email,
accountName: name,
state: 'active',
loyaltyPoints: {
balance: {
int: points,
},
label: 'Points',
},
barcode: {
type: 'qrCode',
value: email,
},
};

Loop over method in vue

I want to be able to loop over all the invoices for a given client-year-month
I use django_filter in DRF to do some filtering on the backend, my endpoints look like this:
all invoices: http://127.0.0.1:8000/invoices/
filters: http://127.0.0.1:8000/invoices/?client=2&year=2020&month=5
I have a method that gets the results based on the filter, and a watch property for retrieving the data at the right time, in this case when a month is chosen.
methods: {
retrieveResults() {
this.$axios.$get('/invoices/', {
params: {
client: this.client,
month: this.month,
year: this.year,
},
});
},
},
watch: {
month: {
handler: 'retrieveResults',
},
},
The response I get looks like this (simplified):
[{
"id":119,
"client":2,
"invoice_id":"2020001",
"order_date":"2020-05-07",
},
{
"id":120,
"client":2,
"invoice_id":"2020002",
"order_date":"2020-05-07",
}]
Everything is working as expected, I see the right results in my network tab depending on the choices, my question is how do I v-for loop over this? I've tried numerous things, nothing has worked so far.
I tried wrapping the retrieveResults in a vuetify v-data-table, without success.
Something like this:
// in a template:
<div v-for="invoice in invoices" :key="invoice.id">
// here is a component(s) for showing invoice content
</div>
...
// in a component:
data: {
return {
invoices: []
}
},
methods: {
async retrieveResults() {
const { data: invoices} = await this.$axios.$get('/invoices/', {
params: {
client: this.client,
month: this.month,
year: this.year,
},
});
this.invoices = invoices
}
}

How to generate Items list with vue-paypal-checkout?

I am trying to generate an items list response from paypal checkout requests. I am trying to do it dynamically, using my data objects and some computed properties in a for in loop. As far as I have understood, my items_list will always need to be a data variable, never a hard-coded array.
Here is my template element:
<div v-bind:key="plan.key" v-for="plan in plans" >
<PayPal
:amount="plan.price" // all good
currency="GBP" // all good
:client="credentials" // all good
env="sandbox" // all good
:items="[plan]" // this is NOT working
#payment-authorized="payment_authorized_cb" // all good
#payment-completed="payment_completed_cb" // all good
#payment-cancelled="payment_cancelled_cb" // all good
>
</PayPal>
</div>
Here are my data objects on my script:
plans: {
smallPlan: {
name: 'Small Venue',
price: '6',
},
mediumPlan: {
name: 'Medium Department',
price: '22',
},
}
payment_completed: {
payment_completed_cb() {
}
},
payment_authorized: {
payment_authorized_cb() {
}
},
payment_cancelled: {
payment_cancelled_cb() {
}
},
Here are my methods:
methods: {
payment_completed_cb(res, planName){
toastr.success("Thank you! We'll send you a confirmation email soon with your invoice. ");
console.log(res);
},
payment_authorized_cb(res){
console.log(res);
},
payment_cancelled_cb(res){
toastr.error("The payment process has been canceled. No money was taken from your account.");
console.log(res);
},
The documentation of Vue-paypal-checkout is available here https://www.npmjs.com/package/vue-paypal-checkout
If I don't add the items list :items everything works perfectly:
{"id":"PAY-02N9173803167370DLPMKKZY","intent":"sale","state":"approved","cart":"90B34422XX075534E","create_time":"2018-10-30T18:39:51Z","payer":{"payment_method":"paypal","status":"VERIFIED","payer_info":{"email":"joaoalvesmarrucho-buyer#gmail.com","first_name":"test","middle_name":"test","last_name":"buyer","payer_id":"JCZUFUEQV33WU","country_code":"US","shipping_address":{"recipient_name":"test buyer","line1":"1 Main St","city":"San Jose","state":"CA","postal_code":"95131","country_code":"US"}}},"transactions":[{"amount":{"total":"245.00","currency":"GBP","details":{}},"item_list":{},"related_resources":[{"sale":{"id":"2RA79134UX2301839","state":"pending","payment_mode":"INSTANT_TRANSFER","protection_eligibility":"ELIGIBLE","parent_payment":"PAY-02N9173803167370DLPMKKZY","create_time":"2018-10-30T18:39:50Z","update_time":"2018-10-30T18:39:50Z","reason_code":"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION","amount":{"total":"245.00","currency":"GBP","details":{"subtotal":"245.00"}}}}]}]}
But if I add :items="[plan]" i get this error message:
Uncaught Error: Error: Request to post https://www.sandbox.paypal.com/v1/payments/payment failed with 400 error. Correlation id: 19238526650f5, 19238526650f5
{
"name": "VALIDATION_ERROR",
"details": [
{
"field": "transactions.item_list.items.item_key",
"issue": "This field name is not defined for this resource type"
}
],
"message": "Invalid request - see details",
"information_link": "https://developer.paypal.com/docs/api/payments/#errors",
"debug_id": "19238526650f5"
Any thoughts?
Also if you happen to know, is there a way to sell/implement a subscription instead of a one-off transaction using Vue-paypal-checkout?
Many thanks

PayPal Express Checkout: Setting logo_image and name using REST API

PayPal's Express Checkout documentation says that you can customize the checkout using the Experience API. And when you go to the Experience API documentation, you see the ability to set a custom name, logo_image, and more.
In our implementation, hiding the shipping fields (no_shipping: 1) works - and that uses the Experience API - but setting the name and logo_image does not.
Code below. Does anyone know if there's a way to set name and/or logo_image?
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '9.99', currency: 'USD' }
}
]
},
experience: {
name: 'Custom Name',
presentation: {
logo_image: 'https://i.imgur.com/customimage.png'
},
input_fields: {
no_shipping: 1
}
}
});
},

Embedded belongsTo to an unsaved record creates two POST request

I got an issue when i try to add an embedded belongTo to an unsaved record. When committing the transaction, I got two POST request. I don't know if I'm doing something wrong or not...
Here's my models and mapping:
Comment = App.Comment = DS.Model.extend({
title: DS.attr('string')
});
Group = App.Address = DS.Model.extend({
name: DS.attr('string')
});
Post = App.Post = DS.Model.extend({
title: DS.attr('string'),
comments: DS.hasMany(Comment),
group: DS.belongsTo(Group)
});
DS.RESTAdapte.map(Post, {
comments: { embedded: 'always' },
group: { embedded: 'always' }
});
My transaction
var transaction = store.transaction();
var post = transaction.createRecord(Post, {
title: 'This post is unsaved'
});
post.get('comments').createRecord({
title: 'This embedded record is also unsaved'
});
post.set('group', Group.createRecord({
name: 'My Group'
}));
transaction.commit();
Then I will have two POST request, one on '/post' wich is good and another one on '/group'.
Am I doing something wrong ? Thanks you !
It seems to me that you have 2 transactions:
the one that you create manually and that contains the post and the comments
the store's default one onto which you create the Group
You probably want your code to be like that:
post.set('group', transaction.createRecord(App.Group, {
name: 'My Group'
}));
Group.createRecord will use the store's default transaction.