Skip to content

Commit

Permalink
CC Processing - Payment Token Expiration Date is Incorrect, ref #620
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed Dec 28, 2016
1 parent 2bd0f39 commit 15dac7c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 32 deletions.
5 changes: 3 additions & 2 deletions angelleye-includes/angelleye-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,10 @@ public function call_do_authorization($order) {

public function ec_add_log($message) {
if ($this->ec_debug == 'yes') {
if (empty($this->log))
if (empty($this->log)) {
$this->log = new WC_Logger();
$this->log->add($this->payment_method, $message);
}
$this->log->add(str_replace("_","-", $this->payment_method) , $message);
}
}

Expand Down
36 changes: 18 additions & 18 deletions angelleye-includes/paypal-rest-api-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@

class PayPal_Rest_API_Utility {

protected $card;
protected $FundingInstrument;
protected $Payer;
protected $order_item;
protected $item;
protected $item_list;
protected $details;
protected $payment_data;
protected $amount;
protected $transaction;
protected $payment;
protected $payment_method;
protected $gateway;
protected $CreditCardToken;
public $card;
public $FundingInstrument;
public $Payer;
public $order_item;
public $item;
public $item_list;
public $details;
public $payment_data;
public $amount;
public $transaction;
public $payment;
public $payment_method;
public $gateway;
public $CreditCardToken;

public function __construct() {
$this->add_paypal_rest_api_lib();
Expand Down Expand Up @@ -99,8 +99,8 @@ public function create_payment($order, $card_data) {
$token->set_gateway_id( $this->payment_method );
$token->set_card_type( $this->card->type );
$token->set_last4( substr( $this->card->number, -4 ) );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( $this->card->valid_until ) ) );
$token->set_expiry_month( $this->card->expire_month );
$token->set_expiry_year( $this->card->expire_year );
$save_result = $token->save();
if ( $save_result ) {
$order->add_payment_token( $token );
Expand Down Expand Up @@ -563,8 +563,8 @@ public function save_credit_card($card_data) {
$token->set_gateway_id( $this->payment_method );
$token->set_card_type( $this->card->type );
$token->set_last4( substr( $this->card->number, -4 ) );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( $this->card->valid_until ) ) );
$token->set_expiry_month( $this->card->expire_month );
$token->set_expiry_year( $this->card->expire_year );
$save_result = $token->save();
if ( $save_result ) {
return array(
Expand Down
8 changes: 4 additions & 4 deletions classes/wc-gateway-braintree-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ public function angelleye_do_payment($order) {
$token->set_gateway_id( $this->id );
$token->set_card_type( $transaction->creditCard['cardType']);
$token->set_last4( $transaction->creditCard['last4'] );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( '+2 years' ) ) );
$token->set_expiry_month( $transaction->creditCard['expirationMonth'] );
$token->set_expiry_year( $transaction->creditCard['expirationYear'] );
$save_result = $token->save();
if ( $save_result ) {
$order->add_payment_token( $token );
Expand Down Expand Up @@ -1128,8 +1128,8 @@ public function braintree_save_payment_method($customer_id, $result) {
$token->set_gateway_id( $this->id );
$token->set_card_type( $braintree_method->cardType);
$token->set_last4( $braintree_method->last4 );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( '+10 years' ) ) );
$token->set_expiry_month( $braintree_method->expirationMonth );
$token->set_expiry_year( $braintree_method->expirationYear );
$save_result = $token->save();
if ( $save_result ) {
return array(
Expand Down
8 changes: 4 additions & 4 deletions classes/wc-gateway-paypal-pro-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,8 @@ function do_payment($order, $card_number, $card_type, $card_exp_month, $card_exp
$token->set_gateway_id( $this->id );
$token->set_card_type( AngellEYE_Utility::card_type_from_account_number($PayPalRequestData['CCDetails']['acct']));
$token->set_last4( substr( $PayPalRequestData['CCDetails']['acct'], -4 ) );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( '+2 years' ) ) );
$token->set_expiry_month( substr( $PayPalRequestData['CCDetails']['expdate'], 0,2 ) );
$token->set_expiry_year( substr( $PayPalRequestData['CCDetails']['expdate'], 2,5 ) );
$save_result = $token->save();
if ( $save_result ) {
$order->add_payment_token( $token );
Expand Down Expand Up @@ -1430,8 +1430,8 @@ public function add_payment_method() {
$token->set_gateway_id( $this->id );
$token->set_card_type( AngellEYE_Utility::card_type_from_account_number($PayPalRequestData['CCDetails']['acct']));
$token->set_last4( substr( $PayPalRequestData['CCDetails']['acct'], -4 ) );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( '+2 years' ) ) );
$token->set_expiry_month( substr( $PayPalRequestData['CCDetails']['expdate'], 0,2 ) );
$token->set_expiry_year( substr( $PayPalRequestData['CCDetails']['expdate'], 2,5 ) );
$save_result = $token->save();
return array(
'result' => 'success',
Expand Down
16 changes: 12 additions & 4 deletions classes/wc-gateway-paypal-pro-payflow-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,12 @@ function do_payment( $order, $card_number, $card_exp, $card_csc, $centinelPAResS
$token->set_gateway_id( $this->id );
$token->set_card_type( AngellEYE_Utility::card_type_from_account_number($PayPalRequestData['acct']));
$token->set_last4( substr( $PayPalRequestData['acct'], -4 ) );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( '+2 years' ) ) );
$token->set_expiry_month( substr( $PayPalRequestData['expdate'], 0,2 ) );
$expiry_year = substr( $PayPalRequestData['expdate'], 2,3 );
if ( strlen( $expiry_year ) == 2 ) {
$expiry_year = $expiry_year + 2000;
}
$token->set_expiry_year( $expiry_year );
$save_result = $token->save();
if ( $save_result ) {
$order->add_payment_token( $token );
Expand Down Expand Up @@ -992,8 +996,12 @@ public function add_payment_method() {
$token->set_gateway_id( $this->id );
$token->set_card_type( AngellEYE_Utility::card_type_from_account_number($PayPalRequestData['acct']));
$token->set_last4( substr( $PayPalRequestData['acct'], -4 ) );
$token->set_expiry_month( date( 'm' ) );
$token->set_expiry_year( date( 'Y', strtotime( '+2 years' ) ) );
$token->set_expiry_month( substr( $PayPalRequestData['expdate'], 0,2 ) );
$expiry_year = substr( $PayPalRequestData['expdate'], 2,3 );
if ( strlen( $expiry_year ) == 2 ) {
$expiry_year = $expiry_year + 2000;
}
$token->set_expiry_year( $expiry_year );
$save_result = $token->save();
if ( $save_result ) {
return array(
Expand Down

0 comments on commit 15dac7c

Please sign in to comment.