Skip to content

Commit

Permalink
Add cardUserKey field to craftgate request if it is not null (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
onurpolattimur authored Feb 28, 2022
1 parent 20d2c94 commit 4caa1a0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion craftgate-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,15 @@ private function build_init_checkout_form_request($order_id)
'paymentGroup' => \Craftgate\Model\PaymentGroup::LISTING_OR_SUBSCRIPTION,
'conversationId' => $order_id,
'callbackUrl' => rtrim(get_bloginfo('url'), '/') . '/' . "?wc-api=craftgate_gateway_callback&order_id=" . $order_id,
'cardUserKey' => $this->retrieve_card_user_key($customer_id, $this->api_key),
'disableStoreCard' => $customer_id == null,
'items' => $this->build_items($order),
);

$card_user_key = $this->retrieve_card_user_key($customer_id, $this->api_key);
if ($card_user_key != null) {
$init_checkout_form_request['cardUserKey'] = $card_user_key;
}

if ($order->get_billing_email() && strlen(trim($order->get_billing_email())) > 0) {
$init_checkout_form_request['additionalParams'] = array(
'buyerEmail' => $order->get_billing_email()
Expand Down

0 comments on commit 4caa1a0

Please sign in to comment.