From d99fdb15d35f0c111e0364f61d5ea5dadfa6b5b4 Mon Sep 17 00:00:00 2001 From: dinamiko Date: Tue, 29 Mar 2022 11:15:36 +0200 Subject: [PATCH] Add phone country code field to pui gateway box --- .../src/Gateway/PayUponInvoice/PayUponInvoice.php | 10 ++++++++++ .../Gateway/PayUponInvoice/PaymentSourceFactory.php | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php index 4175cf6d5..939618881 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php @@ -111,6 +111,16 @@ class PayUponInvoice { 'clear' => true, ) ); + woocommerce_form_field( + 'phone_country_code', + array( + 'type' => 'number', + 'label' => __('Phone country code (ex. 49)', 'woocommerce-paypal-payments'), + 'class' => array('form-row-wide'), + 'required' => true, + 'clear' => true, + ) + ); echo '
'; _e( 'By clicking on the button, you agree to the terms of payment and performance of a risk check from the payment partner, Ratepay. You also agree to PayPal’s privacy statement. If your request to purchase upon invoice is accepted, the purchase price claim will be assigned to Ratepay, and you may only pay Ratepay, not the merchant.', 'woocommerce-paypal-payments' ); diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PaymentSourceFactory.php b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PaymentSourceFactory.php index 378e1e618..e1943f977 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PaymentSourceFactory.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PaymentSourceFactory.php @@ -9,6 +9,7 @@ class PaymentSourceFactory { public function from_wc_order( WC_Order $order ) { $address = $order->get_address(); $birth_date = filter_input( INPUT_POST, 'billing_birth_date', FILTER_SANITIZE_STRING ); + $phone_country_code = filter_input( INPUT_POST, 'phone_country_code', FILTER_SANITIZE_STRING ); return new PaymentSource( $address['first_name'] ?? '', @@ -16,7 +17,7 @@ class PaymentSourceFactory { $address['email'] ?? '', $birth_date ?? '', $address['phone'] ?? '', - '49', + $phone_country_code ?? '', $address['address_1'] ?? '', $address['city'] ?? '', $address['postcode'] ?? '',