Plugin Directory

Changeset 2871716


Ignore:
Timestamp:
02/27/2023 02:00:51 PM (3 years ago)
Author:
beyondpay
Message:

Make compatible with Gravity Forms 2.7

Location:
beyond-pay-for-gravity-forms/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • beyond-pay-for-gravity-forms/trunk/README.md

    r2585899 r2871716  
    136136## Changelog
    137137
     138### 1.2.1
     139* Updated to support WordPress 6.1.1 and Gravity Forms 2.7
     140
     141### 1.1.3
     142* Updated tested up to tag.
     143
     144### 1.1.2
     145* Fixed an issue with stylesheet link.
     146
    138147### 1.1.1
    139148* Initial public release.
  • beyond-pay-for-gravity-forms/trunk/README.txt

    r2726686 r2871716  
    33Tags: credit card, payment, gravity forms, payment gateway, donation
    44Requires at least: 4.7
    5 Tested up to: 6.0
    6 Stable tag: 1.1.3
     5Tested up to: 6.1.1
     6Stable tag: 1.2.1
    77Requires PHP: 7.0
    88License: MIT
     
    30301. Select the **Beyond Pay** tab on the left navigation bar.
    31311. Proceed to configure payment method options available on this page (see [screenshot](#beyond-pay-for-gravity-forms-configuration-settings)):
    32   - **Enable Test Mode** - controls whether transactions are sent to the Test/Sandbox or the Live/Production Beyond Pay Gateway environment and which type of API keys are expected; defaults to Live   
     32  - **Enable Test Mode** - controls whether transactions are sent to the Test/Sandbox or the Live/Production Beyond Pay Gateway environment and which type of API keys are expected; defaults to Live
    3333  - **PublicKey, PrivateKey, Username, Password, MerchantCode,** and **MerchantAccountCode** - these are the credentials by which the plugin authenticates to the Beyond Pay Gateway in order to process payments; for Test Mode, you can [request Beyond Pay Gateway sandbox API keys](https://forms.office.com/Pages/ResponsePage.aspx?id=Q9V6UxGq3USJSkGsz2Jk7yRG7q939HJFkFXKp4lfZo1URUJXWFhEMDlDTUs3OVlROEMxOExJQzZGNSQlQCN0PWcu) while live credentials are provided by Beyond once the merchant processing account is approved
    3434  - **Transaction Mode** - controls how authorizations and payment captures are managed
     
    8787= Is it secure and/or compliant to accept credit cards directly on my website? =
    8888
    89 Yes! Beyond Pay Gateway secures card data by hosting the actual payment fields and presenting them in an iframe so that the fields only *appear* to be part of Gravity Forms. 
     89Yes! Beyond Pay Gateway secures card data by hosting the actual payment fields and presenting them in an iframe so that the fields only *appear* to be part of Gravity Forms.
    9090
    9191Once card data is collected, then the information is further secured by *tokenization*: a process in which the sensitive card data is exchanged for a non-sensitive representation, or "token." This ensures that cardholder data is not sent from the consumer's browser to the merchant's web server, and only the surrogate token value comes into contact with the merchant's systems.
     
    113113== Changelog ==
    114114
     115= 1.2.1 =
     116* Updated to support WordPress 6.1.1 and Gravity Forms 2.7
     117
    115118= 1.1.3 =
    116119* Updated tested up to tag.
  • beyond-pay-for-gravity-forms/trunk/beyond-pay-gravity-forms.php

    r2726686 r2871716  
    66 * Author: Beyond
    77 * Author URI: https://getbeyond.com
    8  * Version: 1.1.3
     8 * Version: 1.2.1
    99 * Text Domain: beyond-pay-for-gravityforms
    10  * Tested up to: 6.0
    11  * 
     10 * Tested up to: 6.1.1
     11 *
    1212 * Copyright (c) 2020 Above and Beyond Business Tools and Services for Entrepreneurs, Inc.
    1313 *
     
    1616
    1717GFForms::include_payment_addon_framework();
    18  
     18
    1919add_action( 'gform_loaded', 'load_beyond_pay_gf', 5 );
    20  
     20
    2121function load_beyond_pay_gf() {
    22  
     22
    2323        if ( ! method_exists( 'GFForms', 'include_addon_framework' ) ) {
    2424            return;
    2525        }
    26    
     26
    2727    /** Check if the class wasn't loaded by a different plugin */
    2828    if(!class_exists('BeyondPay\\BeyondPayRequest')) {
     
    3131        require_once( dirname(__FILE__) . '/includes/gf-beyond-pay.php');
    3232        require_once( dirname(__FILE__) . '/includes/gf-field-beyond-pay.php');
    33  
     33
    3434        GFBeyondPay::register( 'GFBeyondPay' );
    3535    GF_Fields::register(new GF_Field_Beyond_Pay());
     
    4242            Beyond Pay Invoice Num:
    4343            <span id='gform_beyond_pay_invnum'><?php echo esc_html($order_id); ?></span>
    44         </div><?php 
     44        </div><?php
    4545        }
    4646        if($requires_capture && $entry['payment_status'] === 'Authorized'){
  • beyond-pay-for-gravity-forms/trunk/includes/gf-beyond-pay.php

    r2585899 r2871716  
    3131    return self::$_instance;
    3232    }
    33    
     33
    3434    public function init() {
    3535    parent::init();
     
    3737    add_filter('gform_validation_message', array($this, 'add_payment_error_description'), 10, 1 );
    3838    }
    39    
     39
    4040    public function init_admin() {
    4141    parent::init_admin();
     
    5050            if($field['name'] === 'transactionType'){
    5151            $field['choices'] = array_filter(
    52                 $field['choices'], 
     52                $field['choices'],
    5353                function ($v) {return $v['value']!=='subscription';}
    5454            );
     
    5959    return $out;
    6060    }
    61    
     61
    6262    public function get_menu_icon() {
    6363    return 'gform-icon--credit-card';
    6464    }
    65    
     65
    6666    public function plugin_settings_fields() {
    6767        return array(
     
    8282            'label' => 'Test Public Key',
    8383            'type' => 'text',
    84             'class' => 'beyond_pay_setting_test_only'
     84            'class' => 'beyond_pay_setting_test_only',
     85            'size' => '50',
    8586            ),
    8687            array(
    8788            'name' => 'test_private_key',
    8889            'label' => 'Test Private Key',
    89             'type' => 'password',
    90             'class' => 'beyond_pay_setting_test_only'
     90            'type' => 'text',
     91            'input_type' => 'password',
     92            'class' => 'beyond_pay_setting_test_only',
     93            'size' => '50',
    9194            ),
    9295            array(
     
    99102            'name'  => 'test_password',
    100103            'label' => 'Test Password',
    101             'type' => 'password',
     104            'type' => 'text',
     105            'input_type' => 'password',
    102106            'class' => 'beyond_pay_setting_test_only'
    103107            ),
     
    106110            'label' => 'Live Public Key',
    107111            'type' => 'text',
    108             'class' => 'beyond_pay_setting_live_only'
     112            'class' => 'beyond_pay_setting_live_only',
     113            'size' => '50',
    109114            ),
    110115            array(
    111116            'name'  => 'private_key',
    112117            'label' => 'Live Private Key',
    113             'type' => 'password',
    114             'class' => 'beyond_pay_setting_live_only'
     118            'type' => 'text',
     119            'input_type' => 'password',
     120            'class' => 'beyond_pay_setting_live_only',
     121            'size' => '50',
    115122            ),
    116123            array(
     
    123130            'name'  => 'password',
    124131            'label' => 'Live Password',
    125             'type' => 'password',
     132            'type' => 'text',
     133            'input_type' => 'password',
    126134            'class' => 'beyond_pay_setting_live_only'
    127135            ),
     
    187195        );
    188196    }
    189    
     197
    190198    public function scripts() {
    191199    $assets_dir = dirname($this->get_base_url()) . '/assets/js/';
     
    249257                )
    250258            )
    251  
     259
    252260        );
    253  
     261
    254262        return array_merge( parent::scripts(), $scripts );
    255263    }
    256    
     264
    257265    public function authorize( $feed, $submission_data, $form, $entry ) {
    258266    $amount = $submission_data['payment_amount'];
    259267    $token = rgpost('beyond_pay_token');
    260    
     268
    261269    $request = new \BeyondPay\BeyondPayRequest();
    262270    $request->RequestType = "004";
     
    272280    $request->requestMessage->TransIndustryType = "EC";
    273281
    274     $transaction_mode = $this->get_plugin_setting('transaction_mode') === 'sale' 
    275         ? 'sale' 
     282    $transaction_mode = $this->get_plugin_setting('transaction_mode') === 'sale'
     283        ? 'sale'
    276284        : 'sale-auth';
    277285    $request->requestMessage->TransactionType = $transaction_mode;
     
    279287    $request->requestMessage->Amount = round($amount * 100);
    280288    $request->requestMessage->HolderType = "O";
    281    
     289
    282290    $request->requestMessage->AccountHolderName = trim($submission_data['name']);
    283291    $request->requestMessage->AccountStreet = trim($submission_data['address']);
     
    315323        }
    316324        $item_count += $i['quantity'];
    317        
     325
    318326        $itemParsed = new \BeyondPay\Item();
    319327        $itemParsed->ItemCode = "1234";
     
    330338        $request->requestMessage->Item = $itemsParsed;
    331339    }
    332    
     340
    333341    $conn = new \BeyondPay\BeyondPayConnection();
    334    
     342
    335343    $api_url = $test_mode ?
    336         "https://api-test.getbeyondpay.com/paymentservice/requesthandler.svc" : 
     344        "https://api-test.getbeyondpay.com/paymentservice/requesthandler.svc" :
    337345        "https://api.getbeyondpay.com/PaymentService/RequestHandler.svc";
    338346    try{
     
    383391    return [];
    384392    }
    385    
     393
    386394    public function billing_info_fields() {
    387395
     
    395403    return $fields;
    396404    }
    397    
     405
    398406    public function get_credit_card_field( $form ) {
    399407    $fields = GFAPI::get_fields_by_type( $form, array( 'beyond_pay' ) );
    400408    return empty( $fields ) ? false : $fields[0];
    401409    }
    402    
     410
    403411    public function update_entry_payment_info($entry, $payment_result = array()){
    404412    if (
     
    413421        $form = GFAPI::get_form( $entry['form_id'] );
    414422            $ccField = $this->get_credit_card_field($form);
    415         $cc_description = 
     423        $cc_description =
    416424            $payment_result['card_type'].
    417425            ' ************'.substr($payment_result['pan_token'],-4).
     
    424432        }
    425433    }
    426    
     434
    427435    public function capture_authorised_payment(){
    428436    $form_id = rgpost('form_id');
     
    439447        $test_mode = !empty($this->get_plugin_setting('enable-test-mode'));
    440448        $api_url = $test_mode ?
    441         "https://api-test.getbeyondpay.com/paymentservice/requesthandler.svc" : 
     449        "https://api-test.getbeyondpay.com/paymentservice/requesthandler.svc" :
    442450        "https://api.getbeyondpay.com/PaymentService/RequestHandler.svc";
    443451        $login = $this->get_plugin_setting(($test_mode ? 'test_' : '').'login');
     
    494502    return $html;
    495503    }
    496    
     504
    497505    public function add_payment_error_description($message) {
    498506    if(!empty($this->response_error)){
Note: See TracChangeset for help on using the changeset viewer.