Add multicanco process payment

This commit is contained in:
Emili Castells Guasch 2024-08-23 12:40:24 +02:00
parent ec06ea5f27
commit 68e67f87b8
2 changed files with 8 additions and 9 deletions

View file

@ -129,7 +129,7 @@ class MultibancoGateway extends WC_Payment_Gateway {
*/
public function process_payment( $order_id ) {
$wc_order = wc_get_order( $order_id );
$wc_order->update_status( 'on-hold', __( 'Awaiting Multibanco to confirm the payment.', 'woocommerce-paypal-payments' ) );
$wc_order->update_status( 'pending', __( 'Awaiting for the buyer to complete the payment.', 'woocommerce-paypal-payments' ) );
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
$amount = $purchase_unit->amount()->to_array();
@ -168,7 +168,7 @@ class MultibancoGateway extends WC_Payment_Gateway {
),
);
$response = $this->orders_endpoint->confirm_payment_source($request_body,$body->id);
$response = $this->orders_endpoint->confirm_payment_source( $request_body, $body->id );
$body = json_decode( $response['body'] );
$payer_action = '';
@ -182,8 +182,7 @@ class MultibancoGateway extends WC_Payment_Gateway {
return array(
'result' => 'success',
'redirect' => $this->get_return_url( $wc_order ),
'payer_action' => $payer_action,
'redirect' => esc_url( $payer_action ),
);
} catch ( RuntimeException $exception ) {