Add experience context fields

This commit is contained in:
dinamiko 2022-04-13 11:53:44 +02:00
parent 6b7992b411
commit ae30f4346d
2 changed files with 58 additions and 39 deletions

View file

@ -112,14 +112,28 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
'experience_context' => array(
'title' => __( 'Experience Context', 'woocommerce' ),
'type' => 'title',
'description' => __("Specify brand name, logo and customer service instructions to be presented on Ratepay's payment instruction email sent to the buyer.", 'woocommerce-paypal-payments'),
'description' => __( "Specify brand name, logo and customer service instructions to be presented on Ratepay's payment instructions.", 'woocommerce-paypal-payments' ),
),
'brand_name' => array(
'title' => __( 'Brand name', 'woocommerce-paypal-payments' ),
'type' => 'text',
'default' => get_bloginfo( 'name' ) ?? '',
'desc_tip' => true,
'description' => __( 'Merchant name displayed in Ratepay\'s payment instructions.', 'woocommerce-paypal-payments' ),
),
'logo_url' => array(
'title' => __( 'Logo URL', 'woocommerce-paypal-payments' ),
'type' => 'url',
'default' => '',
'desc_tip' => true,
'description' => __('Merchant name displayed in the email.', 'woocommerce-paypal-payments'),
'description' => __( 'Logo to be presented on Ratepay\'s payment instructions.', 'woocommerce-paypal-payments' ),
),
'customer_service_instructions' => array(
'title' => __( 'Customer service instructions', 'woocommerce-paypal-payments' ),
'type' => 'text',
'default' => '',
'desc_tip' => true,
'description' => __( 'Customer service instructions to be presented on Ratepay\'s payment instructions.', 'woocommerce-paypal-payments' ),
),
);
}

View file

@ -11,6 +11,11 @@ class PaymentSourceFactory {
$birth_date = filter_input( INPUT_POST, 'billing_birth_date', FILTER_SANITIZE_STRING );
$phone_country_code = WC()->countries->get_country_calling_code( $address['country'] ?? '' );
$gateway_settings = get_option( 'woocommerce_ppcp-pay-upon-invoice-gateway_settings' );
$merchant_name = $gateway_settings['brand_name'] ?? '';
$logo_url = $gateway_settings['logo_url'] ?? '';
$customer_service_instructions = $gateway_settings['customer_service_instructions'] ?? '';
return new PaymentSource(
$address['first_name'] ?? '',
$address['last_name'] ?? '',
@ -23,9 +28,9 @@ class PaymentSourceFactory {
$address['postcode'] ?? '',
$address['country'] ?? '',
'en-DE',
'EXAMPLE INC',
'https://example.com/logoUrl.svg',
array('Customer service phone is +49 6912345678.')
$merchant_name,
$logo_url,
array($customer_service_instructions)
);
}
}