Skip to content

Commit

Permalink
fix(gateway-payline): fix request params filter when in redirection mode
Browse files Browse the repository at this point in the history
  • Loading branch information
roux1max committed Jan 6, 2020
1 parent aa1013e commit 25b7f79
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions class-wc-gateway-payline.php
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ function generate_payline_form($order_id) {
$doWebPaymentRequest['secondContracts'] = $secondContracts;
}

$tokenOptionKey = 'plnTokenForOrder_' . $requestParams['order']['ref'];
$requestParams = apply_filters( 'payline_do_web_payment_request_params', $doWebPaymentRequest, $order );
$tokenOptionKey = 'plnTokenForOrder_' . $requestParams['order']['ref'];

do_action( 'payline_before_do_web_payment', $requestParams, $this );

Expand All @@ -677,12 +677,12 @@ function generate_payline_form($order_id) {

// Prevent to send the request again on refresh.
if ( empty( $_GET['paylinetoken'] ) ) {
$result = $this->SDK->doWebPayment($requestParams);
$result = $this->SDK->doWebPayment( $requestParams );
do_action( 'payline_after_do_web_payment', $result, $this );

if ( $result['result']['code'] === '00000' ) {
// save association between order and payment session token
update_option( 'plnTokenForOrder_' . $requestParams['order']['ref'], $result['token'] );
update_option( $tokenOptionKey, $result['token'] );
$token = $result['token'];
} else {
echo '<div class="PaylineWidget"><p class="pl-message pl-message-error">' . sprintf( __( 'An error occured while displaying the payment form (error code %s : %s). Please contact us.', 'payline' ), $result['result']['code'], $result['result']['longMessage'] ) . '</p></div>';
Expand All @@ -699,7 +699,7 @@ function generate_payline_form($order_id) {
);
} else {
// EXECUTE
$result = $this->SDK->doWebPayment( apply_filters( 'payline_do_web_payment_request_params', $requestParams ) );
$result = $this->SDK->doWebPayment( $requestParams );
do_action( 'payline_after_do_web_payment', $result, $this );

if ( $result['result']['code'] === '00000' ) {
Expand Down

0 comments on commit 25b7f79

Please sign in to comment.