Add PayPal order id into WC order meta

This commit is contained in:
Emili Castells Guasch 2024-08-23 16:23:23 +02:00
parent 150d29c0b4
commit 53de52e2d3
9 changed files with 40 additions and 1 deletions

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -177,6 +178,9 @@ class BancontactGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -178,6 +179,9 @@ class BlikGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -177,6 +178,9 @@ class EPSGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -179,6 +180,9 @@ class IDealGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -180,6 +181,9 @@ class MultibancoGateway extends WC_Payment_Gateway {
WC()->cart->empty_cart();
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
return array(
'result' => 'success',
'redirect' => esc_url( $payer_action ),

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -177,6 +178,9 @@ class MyBankGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -178,6 +179,9 @@ class P24Gateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -177,6 +178,9 @@ class TrustlyGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {