Changeset 3005698
- Timestamp:
- 12/05/2023 01:15:32 PM (2 years ago)
- Location:
- global-payments-woocommerce/trunk
- Files:
-
- 19 edited
-
assets/admin/js/globalpayments-admin.js (modified) (1 diff)
-
composer.lock (modified) (12 diffs)
-
globalpayments-gateway-provider-for-woocommerce.php (modified) (1 diff)
-
includes/admin/views/html-transaction-info.php (modified) (3 diffs)
-
metadata.xml (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
src/Gateways/AbstractGateway.php (modified) (4 diffs)
-
src/Gateways/GpApiGateway.php (modified) (2 diffs)
-
src/Gateways/Handlers/PaymentActionHandler.php (modified) (3 diffs)
-
src/Gateways/Traits/TransactionInfoTrait.php (modified) (3 diffs)
-
src/PaymentMethods/BuyNowPayLater/AbstractBuyNowPayLater.php (modified) (7 diffs)
-
src/PaymentMethods/BuyNowPayLater/Affirm.php (modified) (1 diff)
-
src/PaymentMethods/BuyNowPayLater/Clearpay.php (modified) (1 diff)
-
src/PaymentMethods/BuyNowPayLater/Klarna.php (modified) (1 diff)
-
src/PaymentMethods/DigitalWallets/ApplePay.php (modified) (1 diff)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
global-payments-woocommerce/trunk/assets/admin/js/globalpayments-admin.js
r2977042 r3005698 37 37 38 38 $( '#woocommerce_globalpayments_clicktopay_payment_action' ).prop( 'disabled', true ); 39 $( '#woocommerce_globalpayments_fasterpayments_payment_action' ).prop( 'disabled', true ); 40 $( '#woocommerce_globalpayments_sepa_payment_action' ).prop( 'disabled', true ); 39 41 }, 40 42 -
global-payments-woocommerce/trunk/composer.lock
r2935282 r3005698 114 114 { 115 115 "name": "doctrine/instantiator", 116 "version": " 2.0.0",116 "version": "1.5.0", 117 117 "source": { 118 118 "type": "git", 119 119 "url": "https://github.com/doctrine/instantiator.git", 120 "reference": " c6222283fa3f4ac679f8b9ced9a4e23f163e80d0"121 }, 122 "dist": { 123 "type": "zip", 124 "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ c6222283fa3f4ac679f8b9ced9a4e23f163e80d0",125 "reference": " c6222283fa3f4ac679f8b9ced9a4e23f163e80d0",126 "shasum": "" 127 }, 128 "require": { 129 "php": "^ 8.1"130 }, 131 "require-dev": { 132 "doctrine/coding-standard": "^ 11",120 "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" 121 }, 122 "dist": { 123 "type": "zip", 124 "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", 125 "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", 126 "shasum": "" 127 }, 128 "require": { 129 "php": "^7.1 || ^8.0" 130 }, 131 "require-dev": { 132 "doctrine/coding-standard": "^9 || ^11", 133 133 "ext-pdo": "*", 134 134 "ext-phar": "*", 135 "phpbench/phpbench": "^ 1.2",136 "phpstan/phpstan": "^1. 9.4",137 "phpstan/phpstan-phpunit": "^1 .3",138 "phpunit/phpunit": "^ 9.5.27",139 "vimeo/psalm": "^ 5.4"135 "phpbench/phpbench": "^0.16 || ^1", 136 "phpstan/phpstan": "^1.4", 137 "phpstan/phpstan-phpunit": "^1", 138 "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", 139 "vimeo/psalm": "^4.30 || ^5.4" 140 140 }, 141 141 "type": "library", … … 164 164 "support": { 165 165 "issues": "https://github.com/doctrine/instantiator/issues", 166 "source": "https://github.com/doctrine/instantiator/tree/ 2.0.0"166 "source": "https://github.com/doctrine/instantiator/tree/1.5.0" 167 167 }, 168 168 "funding": [ … … 180 180 } 181 181 ], 182 "time": "2022-12-30T00: 23:10+00:00"182 "time": "2022-12-30T00:15:36+00:00" 183 183 }, 184 184 { … … 243 243 { 244 244 "name": "nikic/php-parser", 245 "version": "v4.1 5.5",245 "version": "v4.17.1", 246 246 "source": { 247 247 "type": "git", 248 248 "url": "https://github.com/nikic/PHP-Parser.git", 249 "reference": " 11e2663a5bc9db5d714eedb4277ee300403b4a9e"250 }, 251 "dist": { 252 "type": "zip", 253 "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ 11e2663a5bc9db5d714eedb4277ee300403b4a9e",254 "reference": " 11e2663a5bc9db5d714eedb4277ee300403b4a9e",249 "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" 250 }, 251 "dist": { 252 "type": "zip", 253 "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", 254 "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", 255 255 "shasum": "" 256 256 }, … … 293 293 "support": { 294 294 "issues": "https://github.com/nikic/PHP-Parser/issues", 295 "source": "https://github.com/nikic/PHP-Parser/tree/v4.1 5.5"296 }, 297 "time": "2023-0 5-19T20:20:00+00:00"295 "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" 296 }, 297 "time": "2023-08-13T19:53:39+00:00" 298 298 }, 299 299 { … … 470 470 { 471 471 "name": "phpunit/php-code-coverage", 472 "version": "9.2.2 6",472 "version": "9.2.27", 473 473 "source": { 474 474 "type": "git", 475 475 "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 476 "reference": " 443bc6912c9bd5b409254a40f4b0f4ced7c80ea1"477 }, 478 "dist": { 479 "type": "zip", 480 "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ 443bc6912c9bd5b409254a40f4b0f4ced7c80ea1",481 "reference": " 443bc6912c9bd5b409254a40f4b0f4ced7c80ea1",476 "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" 477 }, 478 "dist": { 479 "type": "zip", 480 "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", 481 "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", 482 482 "shasum": "" 483 483 }, … … 535 535 "support": { 536 536 "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", 537 "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" 538 }, 539 "funding": [ 540 { 541 "url": "https://github.com/sebastianbergmann", 542 "type": "github" 543 } 544 ], 545 "time": "2023-03-06T12:58:08+00:00" 537 "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", 538 "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" 539 }, 540 "funding": [ 541 { 542 "url": "https://github.com/sebastianbergmann", 543 "type": "github" 544 } 545 ], 546 "time": "2023-07-26T13:44:30+00:00" 546 547 }, 547 548 { … … 788 789 { 789 790 "name": "phpunit/phpunit", 790 "version": "9.6. 9",791 "version": "9.6.11", 791 792 "source": { 792 793 "type": "git", 793 794 "url": "https://github.com/sebastianbergmann/phpunit.git", 794 "reference": " a9aceaf20a682aeacf28d582654a1670d8826778"795 }, 796 "dist": { 797 "type": "zip", 798 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ a9aceaf20a682aeacf28d582654a1670d8826778",799 "reference": " a9aceaf20a682aeacf28d582654a1670d8826778",795 "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" 796 }, 797 "dist": { 798 "type": "zip", 799 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", 800 "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", 800 801 "shasum": "" 801 802 }, … … 871 872 "issues": "https://github.com/sebastianbergmann/phpunit/issues", 872 873 "security": "https://github.com/sebastianbergmann/phpunit/security/policy", 873 "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6. 9"874 "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" 874 875 }, 875 876 "funding": [ … … 887 888 } 888 889 ], 889 "time": "2023-0 6-11T06:13:56+00:00"890 "time": "2023-08-19T07:10:56+00:00" 890 891 }, 891 892 { … … 1395 1396 { 1396 1397 "name": "sebastian/global-state", 1397 "version": "5.0. 5",1398 "version": "5.0.6", 1398 1399 "source": { 1399 1400 "type": "git", 1400 1401 "url": "https://github.com/sebastianbergmann/global-state.git", 1401 "reference": " 0ca8db5a5fc9c8646244e629625ac486fa286bf2"1402 }, 1403 "dist": { 1404 "type": "zip", 1405 "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ 0ca8db5a5fc9c8646244e629625ac486fa286bf2",1406 "reference": " 0ca8db5a5fc9c8646244e629625ac486fa286bf2",1402 "reference": "bde739e7565280bda77be70044ac1047bc007e34" 1403 }, 1404 "dist": { 1405 "type": "zip", 1406 "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", 1407 "reference": "bde739e7565280bda77be70044ac1047bc007e34", 1407 1408 "shasum": "" 1408 1409 }, … … 1447 1448 "support": { 1448 1449 "issues": "https://github.com/sebastianbergmann/global-state/issues", 1449 "source": "https://github.com/sebastianbergmann/global-state/tree/5.0. 5"1450 }, 1451 "funding": [ 1452 { 1453 "url": "https://github.com/sebastianbergmann", 1454 "type": "github" 1455 } 1456 ], 1457 "time": "202 2-02-14T08:28:10+00:00"1450 "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" 1451 }, 1452 "funding": [ 1453 { 1454 "url": "https://github.com/sebastianbergmann", 1455 "type": "github" 1456 } 1457 ], 1458 "time": "2023-08-02T09:26:13+00:00" 1458 1459 }, 1459 1460 { -
global-payments-woocommerce/trunk/globalpayments-gateway-provider-for-woocommerce.php
r2993213 r3005698 4 4 * Plugin URI: https://github.com/globalpayments/globalpayments-woocommerce 5 5 * Description: This extension allows WooCommerce to use the available Global Payments payment gateways. All card data is tokenized using the respective gateway's tokenization service. 6 * Version: 1. 9.56 * Version: 1.10.0 7 7 * Requires PHP: 7.1 8 * WC tested up to: 8. 0.38 * WC tested up to: 8.2.1 9 9 * Author: Global Payments 10 10 */ -
global-payments-woocommerce/trunk/includes/admin/views/html-transaction-info.php
r2912981 r3005698 3 3 <?php esc_html_e( 'View Transaction Info', 'globalpayments-gateway-provider-for-woocommerce' ); ?> 4 4 </button> 5 <?php echo wc_help_tip( __( 'Admins can view transaction details using this functionality.', 'globalpayments-gateway-provider-for-woocommerce' ) ); ?>5 <?php echo wc_help_tip( __( 'Admins can view transaction details using this functionality.', 'globalpayments-gateway-provider-for-woocommerce' ) ); ?> 6 6 </p> 7 7 <script type="text/template" id="tmpl-wc-globalpayments-transaction-info-modal"> … … 18 18 </header> 19 19 <article> 20 <?php wp_nonce_field( 'woocommerce-globalpayments-view-transaction-info', 'woocommerce-globalpayments-view-transaction-info-nonce' ); ?>20 <?php wp_nonce_field( 'woocommerce-globalpayments-view-transaction-info', 'woocommerce-globalpayments-view-transaction-info-nonce' ); ?> 21 21 <#if( data.error_message ){#> 22 22 <div class="wc-globalpayments-transaction-info-error"> … … 70 70 </td> 71 71 </tr> 72 <tr> 73 <td> 74 <?php esc_html_e( 'BNPL Provider', 'globalpayments-gateway-provider-for-woocommerce' ); ?> 75 </td> 76 <td> 77 {{ data.transaction_info.bnpl_provider }} 78 </td> 79 </tr> 72 <#if( data.transaction_info.provider_type ){#> 73 <tr> 74 <td> 75 {{ data.transaction_info.provider }} <?php esc_html_e( 'Provider', 'globalpayments-gateway-provider-for-woocommerce' ); ?> 76 </td> 77 <td> 78 {{ data.transaction_info.provider_type }} 79 </td> 80 </tr> 81 <#}#> 82 <#if( data.transaction_info.payment_type ){#> 83 <tr> 84 <td> 85 <?php esc_html_e( 'Payment Type', 'globalpayments-gateway-provider-for-woocommerce' ); ?> 86 </td> 87 <td> 88 {{ data.transaction_info.payment_type }} 89 </td> 90 </tr> 91 <#}#> 80 92 </table> 81 93 <#}#> -
global-payments-woocommerce/trunk/metadata.xml
r2993213 r3005698 1 1 <xml> 2 <releaseNumber>1. 9.5</releaseNumber>2 <releaseNumber>1.10.0</releaseNumber> 3 3 </xml> -
global-payments-woocommerce/trunk/readme.txt
r2993217 r3005698 3 3 Tags: woocommerce, woo, unified, commerce, platform, global, payments, heartland, payment, systems, tsys, genius, 3DS, gateway, token, tokenize, save cards 4 4 Requires at least: 5.4 5 Tested up to: 6. 3.16 Stable tag: 1. 9.55 Tested up to: 6.4.1 6 Stable tag: 1.10.0 7 7 License: MIT 8 8 License URI: https://github.com/globalpayments/globalpayments-woocommerce/blob/main/LICENSE … … 29 29 - Buy Now Pay Later - Clearpay 30 30 - Buy Now Pay Later - Klarna 31 - Open Banking - Faster Payments 32 - Open Banking - Sepa 31 33 32 34 = Support = … … 51 53 52 54 == Changelog == 55 = 1.10.0 (12/05/23) = 56 * Open banking 57 53 58 = 1.9.5 (11/09/23) = 54 59 * Unified payments - High-Performance Order Storage (HPOS) compatibility -
global-payments-woocommerce/trunk/src/Gateways/AbstractGateway.php
r2993213 r3005698 16 16 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Clearpay; 17 17 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Klarna; 18 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\FasterPayments; 19 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\Sepa; 18 20 use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin; 19 21 use GlobalPayments\WooCommercePaymentGatewayProvider\Utils\Utils; … … 45 47 // dw requests 46 48 const TXN_TYPE_DW_AUTHORIZATION = 'dw_authorization'; 49 50 const TXN_TYPE_OB_AUTHORIZATION = 'ob_authorization'; 47 51 48 52 // mgmt requests … … 1029 1033 case Klarna::PAYMENT_METHOD_ID: 1030 1034 case Clearpay::PAYMENT_METHOD_ID: 1035 case Sepa::PAYMENT_METHOD_ID: 1036 case FasterPayments::PAYMENT_METHOD_ID: 1031 1037 $gateway = new GpApiGateway(); 1032 1038 break; … … 1103 1109 self::TXN_TYPE_DW_AUTHORIZATION => Requests\DigitalWallets\AuthorizationRequest::class, 1104 1110 self::TXN_TYPE_BNPL_AUTHORIZE => Requests\BuyNowPayLater\InitiatePaymentRequest::class, 1111 self::TXN_TYPE_OB_AUTHORIZATION => Requests\OpenBanking\InitiatePaymentRequest::class, 1105 1112 ); 1106 1113 -
global-payments-woocommerce/trunk/src/Gateways/GpApiGateway.php
r2968747 r3005698 15 15 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Clearpay; 16 16 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Klarna; 17 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\FasterPayments; 18 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\Sepa; 17 19 use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin; 18 20 … … 497 499 Clearpay::class, 498 500 Klarna::class, 501 FasterPayments::class, 502 Sepa::class, 499 503 ); 500 504 } -
global-payments-woocommerce/trunk/src/Gateways/Handlers/PaymentActionHandler.php
r2912981 r3005698 7 7 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Clearpay; 8 8 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Klarna; 9 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\FasterPayments; 10 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\Sepa; 9 11 10 12 class PaymentActionHandler extends AbstractHandler { … … 14 16 AbstractGateway::TXN_TYPE_VERIFY, 15 17 AbstractGateway::TXN_TYPE_DW_AUTHORIZATION, 18 AbstractGateway::TXN_TYPE_OB_AUTHORIZATION, 16 19 ); 17 20 … … 36 39 Affirm::PAYMENT_METHOD_ID, 37 40 Clearpay::PAYMENT_METHOD_ID, 38 Klarna::PAYMENT_METHOD_ID 41 Klarna::PAYMENT_METHOD_ID, 42 FasterPayments::PAYMENT_METHOD_ID, 43 Sepa::PAYMENT_METHOD_ID 39 44 ) ) 40 45 ) { -
global-payments-woocommerce/trunk/src/Gateways/Traits/TransactionInfoTrait.php
r2912981 r3005698 6 6 namespace GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\Traits; 7 7 8 use GlobalPayments\Api\Entities\Enums\PaymentMethodName; 8 9 use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin; 9 10 … … 82 83 $response = $this->gateway->get_transaction_details_by_txn_id( $transactionId ); 83 84 84 wp_send_json( array(85 $modalData = array ( 85 86 'transaction_id' => $response->transactionId, 86 87 'transaction_status' => $response->transactionStatus, … … 88 89 'amount' => wc_format_decimal( $response->amount, 2 ), 89 90 'currency' => $response->currency, 90 'bnpl_provider' => $response->bnplResponse->providerName 91 ) ); 91 'payment_type' => $response->paymentType ?? null, 92 ); 93 94 if ( ! empty( $response->bnplResponse ) ) { 95 $modalData['provider'] = PaymentMethodName::BNPL; 96 $modalData['provider_type'] = $response->bnplResponse->providerName; 97 } elseif ( ! empty( $response->bankPaymentResponse ) ) { 98 $modalData['provider'] = PaymentMethodName::BANK_PAYMENT; 99 $modalData['provider_type'] = $response->bankPaymentResponse->type; 100 } 101 102 wp_send_json( $modalData ); 92 103 } catch ( \Exception $e ) { 93 104 wp_send_json( [ -
global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/AbstractBuyNowPayLater.php
r2993213 r3005698 8 8 use GlobalPayments\Api\Utils\GenerationUtils; 9 9 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\AbstractGateway; 10 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\GpApiGateway; 11 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\Traits\TransactionInfoTrait; 12 use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin; 10 use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\AbstractAsyncPaymentMethod; 13 11 use GlobalPayments\WooCommercePaymentGatewayProvider\Utils\Utils; 14 12 use WC_Order; … … 17 15 defined( 'ABSPATH' ) || exit; 18 16 19 abstract class AbstractBuyNowPayLater extends WC_Payment_Gateway { 20 use TransactionInfoTrait; 21 17 abstract class AbstractBuyNowPayLater extends AbstractAsyncPaymentMethod { 22 18 /** 23 19 * Payment method BNPL provider. Should be overridden by individual BNPL payment methods implementations. … … 27 23 public $payment_method_BNPL_provider; 28 24 29 /** 30 * Payment method default title. 31 * 32 * @var string 33 */ 34 public $default_title; 35 36 /** 37 * Action to perform on checkout 38 * 39 * Possible actions: 40 * 41 * - `authorize` - authorize the card without auto capturing 42 * - `sale` - authorize the card with auto capturing 43 * - `verify` - verify the card without authorizing 44 * 45 * @var string 46 */ 47 public $payment_action; 48 49 public function __construct() { 50 $this->gateway = new GpApiGateway( true ); 51 $this->has_fields = true; 52 $this->supports = array( 53 'refunds', 54 ); 55 56 $this->configure_method_settings(); 57 $this->init_form_fields(); 58 $this->init_settings(); 59 $this->configure_merchant_settings(); 60 61 $this->add_hooks(); 62 $this->enqueue_scripts(); 25 public function get_request_type() { 26 return AbstractGateway::TXN_TYPE_BNPL_AUTHORIZE; 63 27 } 64 28 65 29 public function add_hooks() { 66 if ( is_admin() ) { 67 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( 68 $this, 69 'process_admin_options' 70 ) ); 71 } 72 add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'thankyou_order_received_text' ) ); 73 /** 74 * The WooCommerce API allows plugins make a callback to a special URL that will then load the specified class (if it exists) 75 * and run an action. This is also useful for gateways that are not initialized. 76 */ 77 add_action( 'woocommerce_api_' . $this->id . '_return', array( 78 $this, 79 'process_bnpl_return' 80 ) ); 81 add_action( 'woocommerce_api_' . $this->id . '_status', array( 82 $this, 83 'process_bnpl_status' 84 ) ); 85 add_action( 'woocommerce_api_' . $this->id . '_cancel', array( 86 $this, 87 'process_bnpl_cancel' 88 ) ); 30 parent::add_hooks(); 89 31 90 32 add_action( 'woocommerce_after_checkout_validation', array( … … 92 34 'after_checkout_validation' 93 35 ), 10, 2); 94 95 // Admin View Transaction Info hooks96 if ( is_admin() && current_user_can( 'edit_shop_orders' ) ) {97 add_action( 'woocommerce_admin_order_data_after_order_details', array( $this, 'transaction_info_modal' ), 99 );98 }99 add_action( 'woocommerce_api_globalpayments_get_transaction_info', array( $this, 'get_transaction_info' ) );100 }101 102 /**103 * Enqueues BNPL scripts from Global Payments.104 *105 * @return106 */107 public function enqueue_scripts() {108 if ( ! is_checkout() || wp_script_is( 'globalpayments-bnpl', 'enqueued' ) ) {109 return;110 }111 112 wp_enqueue_script(113 'globalpayments-bnpl',114 Plugin::get_url( '/assets/frontend/js/globalpayments-bnpl.js' ),115 array( 'jquery', 'jquery-blockui' ),116 Plugin::VERSION,117 true118 );119 }120 121 /**122 * Sets the necessary WooCommerce payment method settings for exposing the123 * gateway in the WooCommerce Admin.124 *125 * @return126 */127 abstract public function configure_method_settings();128 129 /**130 * Custom admin options to configure the gateway-specific credentials, features, etc.131 *132 * @return array133 */134 abstract public function get_gateway_form_fields();135 136 /**137 * Currencies and countries this payment method is allowed for.138 *139 * @return array140 */141 abstract public function get_method_availability();142 143 /**144 * States whether the shipping country should be considered for method availability.145 *146 * @return bool147 */148 public function is_shipping_required() {149 return false;150 36 } 151 37 … … 189 75 if ( empty( $data['billing_phone'] ) && ( empty( $wp_error->errors['billing_phone_required'] ) || empty( $wp_error->errors['billing_phone_validation'] ) ) ) { 190 76 $wp_error->add ( 'billing_phone', __( '<strong>Phone</strong> is a required field for this payment method.', 'globalpayments-gateway-provider-for-woocommerce' ) ); 191 }192 }193 194 /**195 * @inheritdoc196 */197 public function init_form_fields() {198 $this->form_fields = array_merge(199 array(200 'enabled' => array(201 'title' => __( 'Enable/Disable', 'globalpayments-gateway-provider-for-woocommerce' ),202 'type' => 'checkbox',203 'label' => __( 'Enable Gateway', 'globalpayments-gateway-provider-for-woocommerce' ),204 'default' => 'no',205 ),206 'title' => array(207 'title' => __( 'Title', 'globalpayments-gateway-provider-for-woocommerce' ),208 'type' => 'text',209 'description' => __( 'This controls the title which the user sees during checkout.', 'globalpayments-gateway-provider-for-woocommerce' ),210 'default' => __( $this->default_title, 'globalpayments-gateway-provider-for-woocommerce' ),211 'desc_tip' => true,212 'custom_attributes' => array( 'required' => 'required' ),213 ),214 ),215 $this->get_gateway_form_fields(),216 array(217 'payment_action' => array(218 'title' => __( 'Payment Action', 'globalpayments-gateway-provider-for-woocommerce' ),219 'type' => 'select',220 'description' => __( 'Choose whether you wish to capture funds immediately or authorize payment only for a delayed capture.', 'globalpayments-gateway-provider-for-woocommerce' ),221 'default' => AbstractGateway::TXN_TYPE_SALE,222 'desc_tip' => true,223 'options' => array(224 AbstractGateway::TXN_TYPE_SALE => __( 'Authorize + Capture', 'globalpayments-gateway-provider-for-woocommerce' ),225 AbstractGateway::TXN_TYPE_AUTHORIZE => __( 'Authorize only', 'globalpayments-gateway-provider-for-woocommerce' ),226 ),227 ),228 )229 );230 }231 232 /**233 * Sets the configurable merchant settings for use elsewhere in the class.234 *235 * @return236 */237 public function configure_merchant_settings() {238 $this->title = $this->get_option( 'title' );239 $this->enabled = $this->get_option( 'enabled' );240 $this->payment_action = $this->get_option( 'payment_action' );241 242 foreach ( $this->get_gateway_form_fields() as $key => $options ) {243 if ( ! property_exists( $this, $key ) ) {244 continue;245 }246 247 $value = $this->get_option( $key );248 249 if ( 'checkbox' === $options['type'] ) {250 $value = 'yes' === $value;251 }252 253 $this->{$key} = $value;254 77 } 255 78 } … … 310 133 } 311 134 312 public function process_refund( $order_id, $amount = null, $reason = '' ) {313 return $this->gateway->process_refund( $order_id, $amount, $reason );314 }315 135 316 136 /** … … 333 153 return $gateway_response; 334 154 } 335 336 /**337 * Handle customer redirect URL.338 */339 public function process_bnpl_return() {340 $request = Utils::get_request();341 342 try {343 $this->validate_request( $request );344 345 $gateway_response = $this->gateway->get_transaction_details_by_txn_id( $request->get_param( 'id' ) );346 $order = $this->get_order( $gateway_response );347 348 switch( $gateway_response->transactionStatus ) {349 case TransactionStatus::INITIATED:350 case TransactionStatus::PREAUTHORIZED:351 wp_safe_redirect( $order->get_checkout_order_received_url() );352 break;353 case TransactionStatus::DECLINED:354 case 'FAILED':355 wc_add_notice( Utils::map_response_code_to_friendly_message( $gateway_response->transactionStatus ), 'error' );356 wp_safe_redirect( wc_get_checkout_url() );357 break;358 default:359 throw new \Exception(360 'Order ID: ' . $gateway_response->orderId . '. Unexpected transaction status on returnUrl: ' . $gateway_response->transactionStatus361 );362 }363 } catch ( \Exception $e ) {364 $log_text = sprintf(365 'Error completing order return with ' . $this->payment_method_BNPL_provider . '. %s %s',366 $e->getMessage(),367 print_r( $request->get_params(), true )368 );369 wc_get_logger()->error( $log_text );370 371 if ( empty( $order ) ) {372 $order = new WC_Order();373 wp_safe_redirect( add_query_arg( $this->id, 'error', $order->get_checkout_order_received_url() ) );374 } else {375 wp_safe_redirect( $order->get_checkout_order_received_url() );376 }377 }378 exit();379 }380 381 /**382 * Handle status Update URL.383 */384 public function process_bnpl_status() {385 $request = Utils::get_request();386 try {387 $this->validate_request( $request );388 389 $gateway_response = $this->gateway->get_transaction_details_by_txn_id( $request->get_param( 'id' ) );390 $order = $this->get_order( $gateway_response );391 392 switch( $request->get_param( 'status' ) ) {393 case TransactionStatus::PREAUTHORIZED:394 $note_text = sprintf(395 '%1$s %2$s. Transaction ID: %3$s.',396 wc_price( $order->get_total() ),397 __( 'authorized', 'globalpayments-gateway-provider-for-woocommerce' ),398 $order->get_transaction_id()399 );400 $order->update_status( 'processing', $note_text );401 402 if ( $this->payment_action == AbstractGateway::TXN_TYPE_SALE ) {403 AbstractGateway::capture_credit_card_authorization( $order );404 }405 $order->payment_complete();406 break;407 case TransactionStatus::DECLINED:408 case 'FAILED':409 $note_text = sprintf(410 '%1$s %2$s. Transaction ID: %3$s.',411 wc_price( $order->get_total() ),412 __( 'payment failed/declined', 'globalpayments-gateway-provider-for-woocommerce' ),413 $order->get_transaction_id()414 );415 $order->update_status( 'failed', $note_text );416 break;417 default:418 throw new \Exception(419 'Order ID: ' . $gateway_response->orderId . '. Unexpected transaction status on statusUrl: ' . $request->get_param( 'status' )420 );421 }422 } catch ( \Exception $e ) {423 $log_text = sprintf(424 'Error completing order status with ' . $this->payment_method_BNPL_provider . '. %s %s',425 $e->getMessage(),426 print_r( $request->get_body(), true )427 );428 wc_get_logger()->error( $log_text );429 }430 exit();431 }432 433 /**434 * Handle customer cancel URL.435 */436 public function process_bnpl_cancel() {437 $request = Utils::get_request();438 try {439 $this->validate_request( $request );440 441 $gateway_response = $this->gateway->get_transaction_details_by_txn_id( $request->get_param( 'id' ) );442 $order = $this->get_order( $gateway_response );443 444 $note_text = sprintf(445 '%1$s %2$s. Transaction ID: %3$s.',446 wc_price( $order->get_total() ),447 __( 'payment canceled by customer', 'globalpayments-gateway-provider-for-woocommerce' ),448 $order->get_transaction_id()449 );450 $order->update_status( 'cancelled', $note_text );451 } catch ( \Exception $e ) {452 $log_text = sprintf(453 'Error completing order cancel with ' . $this->payment_method_BNPL_provider . '. %s %s',454 $e->getMessage(),455 print_r( $request->get_params(), true )456 );457 wc_get_logger()->error( $log_text );458 }459 460 wp_safe_redirect( wc_get_checkout_url() );461 462 exit();463 }464 465 /**466 * Get WooCommerce order associated with the order ID from Transaction Summary.467 *468 * @param TransactionSummary $gateway_response469 *470 * @return bool|WC_Order|\WC_Order_Refund471 * @throws \Exception472 */473 private function get_order( TransactionSummary $gateway_response ) {474 $order = wc_get_order( $gateway_response->orderId );475 if ( false === $order || ! ( $order instanceof WC_Order ) ) {476 throw new \Exception( __( 'Order ID: ' . $gateway_response->orderId . '. Order not found.', 'globalpayments-gateway-provider-for-woocommerce' ) );477 }478 479 if ( $this->id != $order->get_payment_method() ) {480 throw new \Exception( __( 'Order ID: ' . $gateway_response->orderId . '. Payment method code changed. Expected ' . $this->id . ', but found ' . $order->get_payment_method() ) );481 }482 483 if ( $gateway_response->transactionId !== $order->get_transaction_id() ) {484 throw new \Exception( __( 'Order ID: ' . $gateway_response->orderId . '. Transaction ID changed. Expected ' . $gateway_response->transactionId . ', but found ' . $order->get_transaction_id(), 'globalpayments-gateway-provider-for-woocommerce' ) );485 }486 487 return $order;488 }489 490 /**491 * Validate the BNPL request message by checking:492 *493 * 1) the signature of the notification message494 * 2) transaction ID is present in the message495 *496 * @param \WP_REST_Request $request497 *498 * @return bool499 * @throws \Exception500 */501 private function validate_request( \WP_REST_Request $request ) {502 $request_method = $request->get_method();503 switch ( $request_method ) {504 case 'GET':505 $xgp_signature = $request->get_param( 'X-GP-Signature' );506 $params = $request->get_query_params();507 unset( $params['X-GP-Signature'] );508 $to_hash = http_build_query( $params );509 break;510 case 'POST':511 $xgp_signature = $request->get_header( 'x_gp_signature' );512 $to_hash = $request->get_body();513 break;514 default:515 throw new \Exception( __( 'This request method is not supported.', 'globalpayments-gateway-provider-for-woocommerce' ) );516 }517 $gen_signature = GenerationUtils::generateXGPSignature( $to_hash, $this->gateway->get_credential_setting( 'app_key' ) );518 519 if ( $xgp_signature !== $gen_signature ) {520 throw new \Exception( __( 'Invalid request signature.', 'globalpayments-gateway-provider-for-woocommerce' ) );521 }522 523 return true;524 }525 526 /**527 * Display a message to the user if unable to match notifications requests with an order.528 *529 * @param $text530 *531 * @return string532 */533 public function thankyou_order_received_text( $text ) {534 if ( isset( $_GET[ $this->id ] ) ) {535 return __( 'Thank you. Your order has been received, but we have encountered an issue when redirecting back. Please contact us for assistance.', 'globalpayments-gateway-provider-for-woocommerce' );536 }537 538 return $text;539 }540 155 } -
global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/Affirm.php
r2912981 r3005698 40 40 * @var string 41 41 */ 42 public function get_ gateway_form_fields() {42 public function get_payment_method_form_fields() { 43 43 return array(); 44 44 } -
global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/Clearpay.php
r2912981 r3005698 38 38 * @inheritDoc 39 39 */ 40 public function get_ gateway_form_fields() {40 public function get_payment_method_form_fields() { 41 41 return array(); 42 42 } -
global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/Klarna.php
r2912981 r3005698 37 37 * @inheritDoc 38 38 */ 39 public function get_ gateway_form_fields() {39 public function get_payment_method_form_fields() { 40 40 return array(); 41 41 } -
global-payments-woocommerce/trunk/src/PaymentMethods/DigitalWallets/ApplePay.php
r2977042 r3005698 123 123 ), 124 124 'cc_types' => array( 125 'title' => __( 'Accepted Cards ', 'globalpayments-gateway-provider-for-woocommerce' ),125 'title' => __( 'Accepted Cards*', 'globalpayments-gateway-provider-for-woocommerce' ), 126 126 'type' => 'multiselectcheckbox', 127 127 'class' => 'accepted_cards required', -
global-payments-woocommerce/trunk/vendor/autoload.php
r2993213 r3005698 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit f5bba668ab6afcc333c5b8a9ace45780::getLoader();25 return ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96::getLoader(); -
global-payments-woocommerce/trunk/vendor/composer/autoload_real.php
r2993213 r3005698 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit f5bba668ab6afcc333c5b8a9ace457805 class ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit f5bba668ab6afcc333c5b8a9ace45780', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit f5bba668ab6afcc333c5b8a9ace45780', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit f5bba668ab6afcc333c5b8a9ace45780::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit89ae461a990b4b52003ba885d079af96::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
global-payments-woocommerce/trunk/vendor/composer/autoload_static.php
r2993213 r3005698 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit f5bba668ab6afcc333c5b8a9ace457807 class ComposerStaticInit89ae461a990b4b52003ba885d079af96 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 41 41 { 42 42 return \Closure::bind(function () use ($loader) { 43 $loader->prefixLengthsPsr4 = ComposerStaticInit f5bba668ab6afcc333c5b8a9ace45780::$prefixLengthsPsr4;44 $loader->prefixDirsPsr4 = ComposerStaticInit f5bba668ab6afcc333c5b8a9ace45780::$prefixDirsPsr4;45 $loader->classMap = ComposerStaticInit f5bba668ab6afcc333c5b8a9ace45780::$classMap;43 $loader->prefixLengthsPsr4 = ComposerStaticInit89ae461a990b4b52003ba885d079af96::$prefixLengthsPsr4; 44 $loader->prefixDirsPsr4 = ComposerStaticInit89ae461a990b4b52003ba885d079af96::$prefixDirsPsr4; 45 $loader->classMap = ComposerStaticInit89ae461a990b4b52003ba885d079af96::$classMap; 46 46 47 47 }, null, ClassLoader::class); -
global-payments-woocommerce/trunk/vendor/composer/installed.php
r2993213 r3005698 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' e595c0e62f070897d77cd22887d6764b944e7e33',6 'reference' => '6d9f8e57555b4dff8a81e9d7f9b18f64d77242b0', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' e595c0e62f070897d77cd22887d6764b944e7e33',16 'reference' => '6d9f8e57555b4dff8a81e9d7f9b18f64d77242b0', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.