From 36887ab71de245f0932ef061a6e3bf700bb7700a Mon Sep 17 00:00:00 2001
From: Pedro Silva
Date: Mon, 15 Jan 2024 17:37:49 +0000
Subject: [PATCH] Add Venmo vaulting payment_source parameters
---
.../src/SavePaymentMethodsModule.php | 30 ++++++++++++++-----
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/modules/ppcp-save-payment-methods/src/SavePaymentMethodsModule.php b/modules/ppcp-save-payment-methods/src/SavePaymentMethodsModule.php
index 43af5a1b8..1e4f70d9e 100644
--- a/modules/ppcp-save-payment-methods/src/SavePaymentMethodsModule.php
+++ b/modules/ppcp-save-payment-methods/src/SavePaymentMethodsModule.php
@@ -106,16 +106,30 @@ class SavePaymentMethodsModule implements ModuleInterface {
}
if ( $payment_method === PayPalGateway::ID ) {
- $data['payment_source'] = array(
- 'paypal' => array(
- 'attributes' => array(
- 'vault' => array(
- 'store_in_vault' => 'ON_SUCCESS',
- 'usage_type' => 'MERCHANT',
+
+ if ( $request_data['funding_source'] === 'venmo' ) {
+ $data['payment_source'] = array(
+ 'venmo' => array(
+ 'attributes' => array(
+ 'vault' => array(
+ 'store_in_vault' => 'ON_SUCCESS',
+ 'usage_type' => 'MERCHANT',
+ ),
),
),
- ),
- );
+ );
+ } else {
+ $data['payment_source'] = array(
+ 'paypal' => array(
+ 'attributes' => array(
+ 'vault' => array(
+ 'store_in_vault' => 'ON_SUCCESS',
+ 'usage_type' => 'MERCHANT',
+ ),
+ ),
+ ),
+ );
+ }
}
return $data;