Skip to content

Commit 54aef66

Browse files
committed
[skyverge/wc-plugins#487] Redefine do_credit_card_transaction()
This change supports the Moneris efraud validation fix from skyverge/wc-plugins#487 by adding an optional $response parameter, so that the transaction can actually be performed outside of this method (say in a child class's override) and pass in the response. Although this is technically a backwards-incompatible change, at present it's only the Moneris gateway itself that overrides the do_credit_card_transaction() method. Therefore, the only way a merchant could get into trouble would be if they had both Moneris and another frameworked payment gateway installed AND they updated the other payment gateway AND the other payment gateway had this newer version of the framework included. seems like an acceptable level of risk
1 parent e5c1793 commit 54aef66

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,15 +616,18 @@ protected function do_check_transaction( $order ) {
616616
*
617617
* @since 1.0.0
618618
* @param WC_Order $order the order object
619+
* @param SV_WC_Payment_Gateway_API_Response $response optional credit card transaction response
619620
* @return SV_WC_Payment_Gateway_API_Response the response
620621
* @throws SV_WC_Payment_Gateway_Exception network timeouts, etc
621622
*/
622-
protected function do_credit_card_transaction( $order ) {
623+
protected function do_credit_card_transaction( $order, $response = null ) {
623624

624-
if ( $this->perform_credit_card_charge() ) {
625-
$response = $this->get_api()->credit_card_charge( $order );
626-
} else {
627-
$response = $this->get_api()->credit_card_authorization( $order );
625+
if ( is_null( $response ) ) {
626+
if ( $this->perform_credit_card_charge() ) {
627+
$response = $this->get_api()->credit_card_charge( $order );
628+
} else {
629+
$response = $this->get_api()->credit_card_authorization( $order );
630+
}
628631
}
629632

630633
// success! update order record

0 commit comments

Comments
 (0)