Skip to content

Commit 9af1d3f

Browse files
committed
Add value to payment, fix minor issues
1 parent 0f9abfe commit 9af1d3f

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

classes/GoogleAnalyticsTools.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ public function renderPurchaseEvent($orderProducts, $orderData, $callbackUrl)
4040
}
4141

4242
$callbackData = [
43-
'orderid' => $orderData['id'],
43+
'orderid' => $orderData['transaction_id'],
4444
'customer' => $orderData['customer'],
4545
];
4646

4747
$eventData = [
48-
'transaction_id' => (int) $orderData['id'],
48+
'transaction_id' => (int) $orderData['transaction_id'],
4949
'affiliation' => $orderData['affiliation'],
50-
'value' => (float) $orderData['revenue'],
50+
'value' => (float) $orderData['value'],
5151
'tax' => (float) $orderData['tax'],
5252
'shipping' => (float) $orderData['shipping'],
5353
'currency' => $orderData['currency'],

classes/Hook/HookDisplayBackOfficeHeader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public function processOrder($idOrder)
166166
'add_payment_info',
167167
[
168168
'currency' => $orderData['currency'],
169+
'value' => (float) $orderData['value'],
169170
'payment_type' => $orderData['payment_type'],
170171
'items' => $orderProducts,
171172
]

classes/Hook/HookDisplayOrderConfirmation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function run()
8787
'add_payment_info',
8888
[
8989
'currency' => $orderData['currency'],
90+
'value' => (float) $orderData['value'],
9091
'payment_type' => $orderData['payment_type'],
9192
'items' => $orderProducts,
9293
]

classes/Wrapper/OrderWrapper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public function wrapOrder($order)
4343
$currency = new Currency((int) $order->id_currency);
4444

4545
return [
46-
'id' => (int) $order->id,
46+
'transaction_id' => (int) $order->id,
4747
'affiliation' => Shop::isFeatureActive() ? $this->context->shop->name : Configuration::get('PS_SHOP_NAME'),
48-
'revenue' => (float) $order->total_paid,
48+
'value' => (float) $order->total_paid,
4949
'shipping' => (float) $order->total_shipping,
5050
'tax' => (float) $order->total_paid_tax_incl - $order->total_paid_tax_excl,
5151
'customer' => (int) $order->id_customer,
5252
'currency' => $currency->iso_code,
53-
'payment_type' => (int) $order->payment,
53+
'payment_type' => (string) $order->payment,
5454
];
5555
}
5656
}

0 commit comments

Comments
 (0)