Introduce payment capture pending webhook (WIP)

This commit is contained in:
dinamiko 2022-07-06 10:35:53 +02:00
parent 631529adce
commit faa406fbd8
4 changed files with 87 additions and 3 deletions

View file

@ -56,7 +56,12 @@ class OXXO {
function( string $message, WC_Order $order ) {
$payer_action = $order->get_meta( 'ppcp_oxxo_payer_action' ) ?? '';
return $message . ' ' . $payer_action;
$button = '';
if ( $payer_action ) {
$button = '<p><a class="button" href="' . $payer_action . '" target="_blank">See OXXO Voucher/Ticket</a></p>';
}
return $message . ' ' . $button;
},
10,
2

View file

@ -119,7 +119,6 @@ class OXXOGateway extends WC_Payment_Gateway {
public function process_payment( $order_id ) {
$wc_order = wc_get_order( $order_id );
$wc_order->update_status( 'on-hold', __( 'Awaiting OXXO payment.', 'woocommerce-paypal-payments' ) );
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
try {
@ -132,7 +131,6 @@ class OXXOGateway extends WC_Payment_Gateway {
),
);
$payment_method = $this->order_endpoint->confirm_payment_source( $order->id(), $payment_source );
foreach ( $payment_method->links as $link ) {
if ( $link->rel === 'payer-action' ) {
$wc_order->add_meta_data( 'ppcp_oxxo_payer_action', $link->href );