Skip to content

Commit

Permalink
3.0.3 Released : CardToken issues fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihtoprak committed Oct 19, 2022
1 parent 07b71b6 commit b47a943
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
30 changes: 20 additions & 10 deletions core/library/Moka_Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ public function receipt_page( $orderId )
{
$userId = $this->getOrderCustomerId($orderId);
$customer = $this->optimisthubMoka->addCustomerWithCard($orderDetails);

$cardToken = data_get($customer, 'CardList.0.CardToken');
$savedCard = data_get($customer, 'CardList.0');
$orderDetails['CardToken'] = $cardToken;
Expand Down Expand Up @@ -597,6 +598,12 @@ public function receipt_page( $orderId )
'created_at' => current_datetime()->format('Y-m-d H:i:s'),
]
);

global $wpdb;
$hashTable = 'moka_transactions_hash';
$wpdb->query(
$wpdb->prepare( "UPDATE $wpdb->prefix$hashTable SET order_details = %s WHERE id_order = %d", $this->formatOrderDetailsForLog($saveSubsRecord), $orderId ),
);
}
// Subscription product completed successfully

Expand Down Expand Up @@ -1216,6 +1223,7 @@ private function setCustomerDataToOrderMeta($params)
private function formatSubsRecord($params)
{
unset($params['CvcNumber']);
$params['hideCardNumber'] = true;
return $params;
}

Expand All @@ -1235,14 +1243,18 @@ private function formatOrderDetailsForLog($param)
unset($params['ExpMonth']);
unset($params['CustomerDetails']['ExpYear']);
unset($params['CustomerDetails']['ExpMonth']);
if(data_get($param, 'CardNumber'))
{
$param['CardNumber'] = '**** **** **** '.substr($param['CardNumber'], -4);
}
if(data_get($param, 'CustomerDetails.CardNumber'))

if(data_get($param, 'hideCardNumber'))
{
$param['CustomerDetails']['CardNumber'] = '**** **** **** '.substr($param['CustomerDetails']['CardNumber'], -4);
}
if(data_get($param, 'CardNumber'))
{
$param['CardNumber'] = '**** **** **** '.substr($param['CardNumber'], -4);
}
if(data_get($param, 'CustomerDetails.CardNumber'))
{
$param['CustomerDetails']['CardNumber'] = '**** **** **** '.substr($param['CustomerDetails']['CardNumber'], -4);
}
}

return json_encode($param,true);
}
Expand Down Expand Up @@ -1307,9 +1319,7 @@ private function getSubscriptionProductPeriod($orderItems)
'current_time' => Carbon::parse($currentTime)->format('Y-m-d H:i:s'),
'next_try' => Carbon::parse($nextTry)->format('Y-m-d H:i:s'),
'period_string' => $__per.' '.$__in,
];

ray($period);
];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/library/Moka_Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exit;
}

define('OPTIMISTHUB_MOKA_PAY_VERSION', '3.0.2');
define('OPTIMISTHUB_MOKA_PAY_VERSION', '3.0.3');

global $mokaVersion;
$mokaVersion = OPTIMISTHUB_MOKA_PAY_VERSION;
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Moka Payment Gateway for WooCommerce
* Plugin URI: https://github.com/optimisthub/moka-woocommerce
* Description: Moka Payment gateway for woocommerce
* Version: 3.0.2
* Version: 3.0.3
* Author: Optimist Hub
* Author URI: https://optimisthub.com?ref=mokaPayment
* Domain Path: /languages/
Expand Down

0 comments on commit b47a943

Please sign in to comment.