Plugin Directory

Changeset 3005698


Ignore:
Timestamp:
12/05/2023 01:15:32 PM (2 years ago)
Author:
globalpayments
Message:

Release v1.10.0

Location:
global-payments-woocommerce/trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • global-payments-woocommerce/trunk/assets/admin/js/globalpayments-admin.js

    r2977042 r3005698  
    3737
    3838            $( '#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 );
    3941        },
    4042
  • global-payments-woocommerce/trunk/composer.lock

    r2935282 r3005698  
    114114        {
    115115            "name": "doctrine/instantiator",
    116             "version": "2.0.0",
     116            "version": "1.5.0",
    117117            "source": {
    118118                "type": "git",
    119119                "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",
    133133                "ext-pdo": "*",
    134134                "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"
    140140            },
    141141            "type": "library",
     
    164164            "support": {
    165165                "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"
    167167            },
    168168            "funding": [
     
    180180                }
    181181            ],
    182             "time": "2022-12-30T00:23:10+00:00"
     182            "time": "2022-12-30T00:15:36+00:00"
    183183        },
    184184        {
     
    243243        {
    244244            "name": "nikic/php-parser",
    245             "version": "v4.15.5",
     245            "version": "v4.17.1",
    246246            "source": {
    247247                "type": "git",
    248248                "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",
    255255                "shasum": ""
    256256            },
     
    293293            "support": {
    294294                "issues": "https://github.com/nikic/PHP-Parser/issues",
    295                 "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5"
    296             },
    297             "time": "2023-05-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"
    298298        },
    299299        {
     
    470470        {
    471471            "name": "phpunit/php-code-coverage",
    472             "version": "9.2.26",
     472            "version": "9.2.27",
    473473            "source": {
    474474                "type": "git",
    475475                "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",
    482482                "shasum": ""
    483483            },
     
    535535            "support": {
    536536                "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"
    546547        },
    547548        {
     
    788789        {
    789790            "name": "phpunit/phpunit",
    790             "version": "9.6.9",
     791            "version": "9.6.11",
    791792            "source": {
    792793                "type": "git",
    793794                "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",
    800801                "shasum": ""
    801802            },
     
    871872                "issues": "https://github.com/sebastianbergmann/phpunit/issues",
    872873                "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"
    874875            },
    875876            "funding": [
     
    887888                }
    888889            ],
    889             "time": "2023-06-11T06:13:56+00:00"
     890            "time": "2023-08-19T07:10:56+00:00"
    890891        },
    891892        {
     
    13951396        {
    13961397            "name": "sebastian/global-state",
    1397             "version": "5.0.5",
     1398            "version": "5.0.6",
    13981399            "source": {
    13991400                "type": "git",
    14001401                "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",
    14071408                "shasum": ""
    14081409            },
     
    14471448            "support": {
    14481449                "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": "2022-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"
    14581459        },
    14591460        {
  • global-payments-woocommerce/trunk/globalpayments-gateway-provider-for-woocommerce.php

    r2993213 r3005698  
    44 * Plugin URI: https://github.com/globalpayments/globalpayments-woocommerce
    55 * 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.5
     6 * Version: 1.10.0
    77 * Requires PHP: 7.1
    8  * WC tested up to: 8.0.3
     8 * WC tested up to: 8.2.1
    99 * Author: Global Payments
    1010*/
  • global-payments-woocommerce/trunk/includes/admin/views/html-transaction-info.php

    r2912981 r3005698  
    33        <?php esc_html_e( 'View Transaction Info', 'globalpayments-gateway-provider-for-woocommerce' ); ?>
    44    </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' ) ); ?>
    66</p>
    77<script type="text/template" id="tmpl-wc-globalpayments-transaction-info-modal">
     
    1818                </header>
    1919                <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' ); ?>
    2121                    <#if( data.error_message ){#>
    2222                        <div class="wc-globalpayments-transaction-info-error">
     
    7070                                    </td>
    7171                                </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                                <#}#>
    8092                            </table>
    8193                        <#}#>
  • global-payments-woocommerce/trunk/metadata.xml

    r2993213 r3005698  
    11<xml>
    2   <releaseNumber>1.9.5</releaseNumber>
     2  <releaseNumber>1.10.0</releaseNumber>
    33</xml>
  • global-payments-woocommerce/trunk/readme.txt

    r2993217 r3005698  
    33Tags: woocommerce, woo, unified, commerce, platform, global, payments, heartland, payment, systems, tsys, genius, 3DS, gateway, token, tokenize, save cards
    44Requires at least: 5.4
    5 Tested up to: 6.3.1
    6 Stable tag: 1.9.5
     5Tested up to: 6.4.1
     6Stable tag: 1.10.0
    77License: MIT
    88License URI: https://github.com/globalpayments/globalpayments-woocommerce/blob/main/LICENSE
     
    2929- Buy Now Pay Later - Clearpay
    3030- Buy Now Pay Later - Klarna
     31- Open Banking - Faster Payments
     32- Open Banking - Sepa
    3133
    3234= Support =
     
    5153
    5254== Changelog ==
     55= 1.10.0 (12/05/23) =
     56* Open banking
     57
    5358= 1.9.5 (11/09/23) =
    5459* Unified payments - High-Performance Order Storage (HPOS) compatibility
  • global-payments-woocommerce/trunk/src/Gateways/AbstractGateway.php

    r2993213 r3005698  
    1616use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Clearpay;
    1717use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Klarna;
     18use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\FasterPayments;
     19use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\Sepa;
    1820use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin;
    1921use GlobalPayments\WooCommercePaymentGatewayProvider\Utils\Utils;
     
    4547    // dw requests
    4648    const TXN_TYPE_DW_AUTHORIZATION = 'dw_authorization';
     49
     50    const TXN_TYPE_OB_AUTHORIZATION = 'ob_authorization';
    4751
    4852    // mgmt requests
     
    10291033            case Klarna::PAYMENT_METHOD_ID:
    10301034            case Clearpay::PAYMENT_METHOD_ID:
     1035            case Sepa::PAYMENT_METHOD_ID:
     1036            case FasterPayments::PAYMENT_METHOD_ID:
    10311037                $gateway = new GpApiGateway();
    10321038                break;
     
    11031109            self::TXN_TYPE_DW_AUTHORIZATION        => Requests\DigitalWallets\AuthorizationRequest::class,
    11041110            self::TXN_TYPE_BNPL_AUTHORIZE          => Requests\BuyNowPayLater\InitiatePaymentRequest::class,
     1111            self::TXN_TYPE_OB_AUTHORIZATION        => Requests\OpenBanking\InitiatePaymentRequest::class,
    11051112        );
    11061113
  • global-payments-woocommerce/trunk/src/Gateways/GpApiGateway.php

    r2968747 r3005698  
    1515use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Clearpay;
    1616use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Klarna;
     17use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\FasterPayments;
     18use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\Sepa;
    1719use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin;
    1820
     
    497499            Clearpay::class,
    498500            Klarna::class,
     501            FasterPayments::class,
     502            Sepa::class,
    499503        );
    500504    }
  • global-payments-woocommerce/trunk/src/Gateways/Handlers/PaymentActionHandler.php

    r2912981 r3005698  
    77use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Clearpay;
    88use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\BuyNowPayLater\Klarna;
     9use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\FasterPayments;
     10use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\OpenBanking\Sepa;
    911
    1012class PaymentActionHandler extends AbstractHandler {
     
    1416        AbstractGateway::TXN_TYPE_VERIFY,
    1517        AbstractGateway::TXN_TYPE_DW_AUTHORIZATION,
     18        AbstractGateway::TXN_TYPE_OB_AUTHORIZATION,
    1619    );
    1720
     
    3639                    Affirm::PAYMENT_METHOD_ID,
    3740                    Clearpay::PAYMENT_METHOD_ID,
    38                     Klarna::PAYMENT_METHOD_ID
     41                    Klarna::PAYMENT_METHOD_ID,
     42                    FasterPayments::PAYMENT_METHOD_ID,
     43                    Sepa::PAYMENT_METHOD_ID
    3944                ) )
    4045        ) {
  • global-payments-woocommerce/trunk/src/Gateways/Traits/TransactionInfoTrait.php

    r2912981 r3005698  
    66namespace GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\Traits;
    77
     8use GlobalPayments\Api\Entities\Enums\PaymentMethodName;
    89use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin;
    910
     
    8283            $response = $this->gateway->get_transaction_details_by_txn_id( $transactionId );
    8384
    84             wp_send_json( array(
     85            $modalData = array (
    8586                'transaction_id'     => $response->transactionId,
    8687                'transaction_status' => $response->transactionStatus,
     
    8889                'amount'             => wc_format_decimal( $response->amount, 2 ),
    8990                '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 );
    92103        } catch ( \Exception $e ) {
    93104            wp_send_json( [
  • global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/AbstractBuyNowPayLater.php

    r2993213 r3005698  
    88use GlobalPayments\Api\Utils\GenerationUtils;
    99use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\AbstractGateway;
    10 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\GpApiGateway;
    11 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\Traits\TransactionInfoTrait;
    12 use GlobalPayments\WooCommercePaymentGatewayProvider\Plugin;
     10use GlobalPayments\WooCommercePaymentGatewayProvider\PaymentMethods\AbstractAsyncPaymentMethod;
    1311use GlobalPayments\WooCommercePaymentGatewayProvider\Utils\Utils;
    1412use WC_Order;
     
    1715defined( 'ABSPATH' ) || exit;
    1816
    19 abstract class AbstractBuyNowPayLater extends WC_Payment_Gateway {
    20     use TransactionInfoTrait;
    21 
     17abstract class AbstractBuyNowPayLater extends AbstractAsyncPaymentMethod {
    2218    /**
    2319     * Payment method BNPL provider. Should be overridden by individual BNPL payment methods implementations.
     
    2723    public $payment_method_BNPL_provider;
    2824
    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;
    6327    }
    6428
    6529    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();
    8931
    9032        add_action( 'woocommerce_after_checkout_validation', array(
     
    9234            'after_checkout_validation'
    9335        ), 10, 2);
    94 
    95         // Admin View Transaction Info hooks
    96         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      * @return
    106      */
    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             true
    118         );
    119     }
    120 
    121     /**
    122      * Sets the necessary WooCommerce payment method settings for exposing the
    123      * gateway in the WooCommerce Admin.
    124      *
    125      * @return
    126      */
    127     abstract public function configure_method_settings();
    128 
    129     /**
    130      * Custom admin options to configure the gateway-specific credentials, features, etc.
    131      *
    132      * @return array
    133      */
    134     abstract public function get_gateway_form_fields();
    135 
    136     /**
    137      * Currencies and countries this payment method is allowed for.
    138      *
    139      * @return array
    140      */
    141     abstract public function get_method_availability();
    142 
    143     /**
    144      * States whether the shipping country should be considered for method availability.
    145      *
    146      * @return bool
    147      */
    148     public function is_shipping_required() {
    149         return false;
    15036    }
    15137
     
    18975        if ( empty( $data['billing_phone'] ) && ( empty( $wp_error->errors['billing_phone_required'] ) || empty( $wp_error->errors['billing_phone_validation'] ) ) ) {
    19076            $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      * @inheritdoc
    196      */
    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      * @return
    236      */
    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;
    25477        }
    25578    }
     
    310133    }
    311134
    312     public function process_refund( $order_id, $amount = null, $reason = '' ) {
    313         return $this->gateway->process_refund( $order_id, $amount, $reason );
    314     }
    315135
    316136    /**
     
    333153        return $gateway_response;
    334154    }
    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->transactionStatus
    361                     );
    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_response
    469      *
    470      * @return bool|WC_Order|\WC_Order_Refund
    471      * @throws \Exception
    472      */
    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 message
    494      * 2) transaction ID is present in the message
    495      *
    496      * @param \WP_REST_Request $request
    497      *
    498      * @return bool
    499      * @throws \Exception
    500      */
    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 $text
    530      *
    531      * @return string
    532      */
    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     }
    540155}
  • global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/Affirm.php

    r2912981 r3005698  
    4040     * @var string
    4141     */
    42     public function get_gateway_form_fields() {
     42    public function get_payment_method_form_fields() {
    4343        return array();
    4444    }
  • global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/Clearpay.php

    r2912981 r3005698  
    3838     * @inheritDoc
    3939     */
    40     public function get_gateway_form_fields() {
     40    public function get_payment_method_form_fields() {
    4141        return array();
    4242    }
  • global-payments-woocommerce/trunk/src/PaymentMethods/BuyNowPayLater/Klarna.php

    r2912981 r3005698  
    3737     * @inheritDoc
    3838     */
    39     public function get_gateway_form_fields() {
     39    public function get_payment_method_form_fields() {
    4040        return array();
    4141    }
  • global-payments-woocommerce/trunk/src/PaymentMethods/DigitalWallets/ApplePay.php

    r2977042 r3005698  
    123123            ),
    124124            'cc_types'                      => array(
    125                 'title'   => __( 'Accepted Cards', 'globalpayments-gateway-provider-for-woocommerce' ),
     125                'title'   => __( 'Accepted Cards*', 'globalpayments-gateway-provider-for-woocommerce' ),
    126126                'type'    => 'multiselectcheckbox',
    127127                'class'   => 'accepted_cards required',
  • global-payments-woocommerce/trunk/vendor/autoload.php

    r2993213 r3005698  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInitf5bba668ab6afcc333c5b8a9ace45780::getLoader();
     25return ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96::getLoader();
  • global-payments-woocommerce/trunk/vendor/composer/autoload_real.php

    r2993213 r3005698  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitf5bba668ab6afcc333c5b8a9ace45780
     5class ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitf5bba668ab6afcc333c5b8a9ace45780', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitf5bba668ab6afcc333c5b8a9ace45780', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit89ae461a990b4b52003ba885d079af96', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitf5bba668ab6afcc333c5b8a9ace45780::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit89ae461a990b4b52003ba885d079af96::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • global-payments-woocommerce/trunk/vendor/composer/autoload_static.php

    r2993213 r3005698  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitf5bba668ab6afcc333c5b8a9ace45780
     7class ComposerStaticInit89ae461a990b4b52003ba885d079af96
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    4141    {
    4242        return \Closure::bind(function () use ($loader) {
    43             $loader->prefixLengthsPsr4 = ComposerStaticInitf5bba668ab6afcc333c5b8a9ace45780::$prefixLengthsPsr4;
    44             $loader->prefixDirsPsr4 = ComposerStaticInitf5bba668ab6afcc333c5b8a9ace45780::$prefixDirsPsr4;
    45             $loader->classMap = ComposerStaticInitf5bba668ab6afcc333c5b8a9ace45780::$classMap;
     43            $loader->prefixLengthsPsr4 = ComposerStaticInit89ae461a990b4b52003ba885d079af96::$prefixLengthsPsr4;
     44            $loader->prefixDirsPsr4 = ComposerStaticInit89ae461a990b4b52003ba885d079af96::$prefixDirsPsr4;
     45            $loader->classMap = ComposerStaticInit89ae461a990b4b52003ba885d079af96::$classMap;
    4646
    4747        }, null, ClassLoader::class);
  • global-payments-woocommerce/trunk/vendor/composer/installed.php

    r2993213 r3005698  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'e595c0e62f070897d77cd22887d6764b944e7e33',
     6        'reference' => '6d9f8e57555b4dff8a81e9d7f9b18f64d77242b0',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'e595c0e62f070897d77cd22887d6764b944e7e33',
     16            'reference' => '6d9f8e57555b4dff8a81e9d7f9b18f64d77242b0',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.