mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Check for captured vault webhook order meta
This commit is contained in:
parent
f03f3e5fb1
commit
572c62c74c
3 changed files with 8 additions and 2 deletions
|
@ -171,6 +171,11 @@ trait ProcessPaymentTrait {
|
|||
|
||||
try {
|
||||
if ( $this->order_processor->process( $wc_order ) ) {
|
||||
|
||||
if($this->subscription_helper->has_subscription( $wc_order->get_id() )) {
|
||||
$wc_order->update_meta_data('_ppcp_captured_vault_webhook', false);
|
||||
}
|
||||
|
||||
WC()->cart->empty_cart();
|
||||
$this->session_handler->destroy_session_data();
|
||||
|
||||
|
|
|
@ -217,8 +217,9 @@ class AuthorizedPaymentsProcessor {
|
|||
|
||||
if ($this->config->has('intent') && strtoupper((string)$this->config->get('intent')) === 'CAPTURE') {
|
||||
foreach ($wc_orders as $wc_order) {
|
||||
if( $this->subscription_helper->has_subscription( $wc_order->get_id() ) ) {
|
||||
if( $this->subscription_helper->has_subscription( $wc_order->get_id() ) && $wc_order->get_meta( '_ppcp_captured_vault_webhook' ) === false ) {
|
||||
$this->capture_authorized_payment($wc_order);
|
||||
$wc_order->update_meta_data('_ppcp_captured_vault_webhook', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class VaultPaymentTokenCreated implements RequestHandler
|
|||
$response = array( 'success' => false );
|
||||
$webhook_id = (string) ( $request['id'] ?? '' );
|
||||
|
||||
$customer_id = $resource['customer_id'] ?? '';
|
||||
$customer_id = $request['customer_id'] ?? '';
|
||||
if(!$customer_id) {
|
||||
$message = sprintf( 'No customer id for webhook event %s was found.', $webhook_id );
|
||||
$this->logger->warning( $message, array( 'request' => $request ) );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue