Skip to content

Commit

Permalink
Send sum of items price in 'price' field instead of sending order tot…
Browse files Browse the repository at this point in the history
…al (#13)
  • Loading branch information
onurpolattimur authored Jun 23, 2022
1 parent 8dc675c commit 23788a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions craftgate-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,20 @@ private function build_init_checkout_form_request($order_id)
{
$order = $this->retrieve_order($order_id);
$customer_id = $order->get_user()->ID;
$items = $this->build_items($order);
$total_price = 0;
foreach ($items as $item) {
$total_price += $item['price'];
}
$init_checkout_form_request = array(
'price' => $this->format_price($order->get_total()),
'price' => $this->format_price($total_price),
'paidPrice' => $this->format_price($order->get_total()),
'currency' => $order->get_currency(),
'paymentGroup' => \Craftgate\Model\PaymentGroup::LISTING_OR_SUBSCRIPTION,
'conversationId' => $order_id,
'callbackUrl' => rtrim(get_bloginfo('url'), '/') . '/' . "?wc-api=craftgate_gateway_callback&order_id=" . $order_id,
'disableStoreCard' => $customer_id == null,
'items' => $this->build_items($order),
'items' => $items,
);

$card_user_key = $this->retrieve_card_user_key($customer_id, $this->api_key);
Expand Down

0 comments on commit 23788a3

Please sign in to comment.