Skip to content

Commit

Permalink
Merge pull request #258 from sprankhub/add-payment-method
Browse files Browse the repository at this point in the history
Add payment method to order data
  • Loading branch information
jissereitsma authored Dec 11, 2024
2 parents 4a1f0f0 + 79f9b64 commit 8df67c4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion DataLayer/Event/Purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function get(): array
'tax' => $this->priceFormatter->format((float)$order->getTaxAmount()),
'shipping' => $this->priceFormatter->format((float)$order->getShippingAmount()),
'coupon' => $order->getCouponCode(),
'items' => $this->orderItems->setOrder($order)->get()
'payment_method' => $order->getPayment()?->getMethod() ?? '',
'items' => $this->orderItems->setOrder($order)->get(),
]
];
}
Expand Down
3 changes: 2 additions & 1 deletion DataLayer/Event/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public function get(): array
'tax' => $this->priceFormatter->format((float)$order->getTaxAmount()),
'shipping' => $this->priceFormatter->format((float)$order->getShippingAmount()),
'coupon' => $order->getCouponCode(),
'items' => $this->orderItems->setOrder($order)->get()
'payment_method' => $order->getPayment()?->getMethod() ?? '',
'items' => $this->orderItems->setOrder($order)->get(),
]
];
}
Expand Down
1 change: 1 addition & 0 deletions DataLayer/Mapper/OrderDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function mapByOrder(OrderInterface $order): array
'coupon' => $order->getCouponCode(),
'date' => date("Y-m-d", strtotime($order->getCreatedAt())),
'paymentType' => $this->getPaymentType($order),
'payment_method' => $order->getPayment()?->getMethod() ?? '',
'customer' => $this->getCustomerData($order),
];
}
Expand Down
3 changes: 2 additions & 1 deletion DataLayer/Tag/Order/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public function merge(): array
'shipping' => $this->priceFormatter->format((float)$order->getShippingAmount()),
'affiliation' => $this->config->getStoreName(),
'transaction_id' => $order->getIncrementId(),
'coupon' => $order->getCouponCode()
'coupon' => $order->getCouponCode(),
'payment_method' => $order->getPayment()?->getMethod() ?? '',
];
}

Expand Down

0 comments on commit 8df67c4

Please sign in to comment.