Skip to content

Commit f989723

Browse files
committed
PRE-2955 fix empty token field
1 parent 304c92e commit f989723

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/Gateway/PayplugGateway.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -911,14 +911,11 @@ public function process_standard_payment($order, $amount, $customer_id)
911911
*/
912912
$payment_data = apply_filters('payplug_gateway_payment_data', $payment_data, $order_id, [], $address_data);
913913
$payment = $this->api->payment_create($payment_data);
914-
915-
916-
917914
$alias = isset($payment['ALIAS']) ? $payment['ALIAS'] : null;
915+
918916
//TODO:: payment is not created we need to generate an error
919917
//HF VS NORMAL
920918
$payment_id = isset($payment['TRANSACTIONID']) ? $payment['TRANSACTIONID'] : $payment->id;
921-
922919
if (!empty($payment_id) && strpos($payment_id, 'pay_') !== 0) {
923920
$payment = $this->api->payment_retrieve( $this->hosted_fields->populateGetTransaction($payment_id),true );
924921
$payment->is_live = $this->get_current_mode() === 'live';
@@ -928,7 +925,7 @@ public function process_standard_payment($order, $amount, $customer_id)
928925
$card_last4 = isset($_POST['cardlast4']) ? filter_var($_POST['cardlast4'], FILTER_SANITIZE_STRING) :'';
929926
$expiry_date = isset($_POST['cardexpiry']) ? filter_var($_POST['cardexpiry'], FILTER_SANITIZE_STRING):'';
930927
if (preg_match('/^(\d{2})\/(\d{2})$/', $expiry_date, $matches)) {
931-
$set_expiry_year = $matches[2];
928+
$set_expiry_year = '20' . $matches[2];
932929
$set_expiry_month = $matches[1];
933930
} else {
934931
$set_expiry_year = '';

src/Gateway/PayplugResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ protected function refund_exist_for_order( $order_id, $refund_id ) {
439439
* @return bool
440440
*/
441441
protected function maybe_save_card( $resource ) {
442-
// FIXME: Check if card saving is enabled in settings?
443442
if ( ! isset( $resource->card ) || empty( $resource->card->id ) && !isset($resource->alias) || empty( $resource->alias ) ) {
444443
return false;
445444
}
@@ -485,6 +484,7 @@ protected function maybe_save_card( $resource ) {
485484
$set_expiry_year = wc_clean($resource->card->exp_year);
486485
$set_expiry_month = zeroise((int)wc_clean($resource->card->exp_month), 2);
487486
$set_card_type = \strtolower(wc_clean($resource->card->brand));
487+
488488
}
489489
if(!empty($existing_tokens)) {
490490
foreach($existing_tokens as $token_id => $existing_token) {

0 commit comments

Comments
 (0)