Plugin Directory

Changeset 2630470


Ignore:
Timestamp:
11/16/2021 05:40:08 AM (4 years ago)
Author:
chaifinport
Message:

adding new feature to select order status after successfull payment

Location:
chaiport-payment/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chaiport-payment/trunk/chaiportGateway.php

    r2621939 r2630470  
    44 * Plugin URI:        https://www.beta-docs.chaipay.io/plugins_and_sdks/woocommerce-plugin.html
    55 * Description:       Single Payment
    6  * Version:           1.0.1
     6 * Version:           1.0.2
    77 * Requires at least: 5.6
    88 * Author:            Chai Finance
     
    106106        $publicKey = ($options["testmode"] == "yes" ? $options["test_publishable_key"] : $options["publishable_key"]);
    107107        $privateKey = ($options["testmode"] == "yes" ? $options["test_private_key"] : $options["private_key"]);
     108        $orderStatusType = $options["payment_process_action"];
    108109        $getOrderStatusUrl = $chaiApiUrl . $chaiPortId;
    109110        $header = array(
     
    126127            if ($order->get_status() != "completed") {
    127128                if ($status == "Success") {
    128                     $order->update_status('wc-processing');
     129                    if ($orderStatusType == "Processing") {
     130                        $order->update_status('wc-processing');
     131                    } else {
     132                        $order->update_status('wc-completed');
     133                    }
    129134                    $note .= "Transaction Status: " . $status . "\n";
    130135                    $note .= "Order reference: " . $orderRef . "\n";
     
    291296    $order = wc_get_order($orderId);
    292297
    293     // fetching the plugin setting to extract keys
     298    // fetching the plugin setting to extract keys & other settings
    294299    $options = get_option('woocommerce_chaiport_settings');
    295300    $privateKey = ($options["testmode"] == "yes" ? $options["test_private_key"] : $options["private_key"]);
     301    $orderStatusType = $options["payment_process_action"];
    296302
    297303    // validating signature
     
    321327
    322328        if ($status == "Success") {
    323             $order->update_status('wc-processing');
     329            if ($orderStatusType == "Processing") {
     330                $order->update_status('wc-processing');
     331            } else {
     332                $order->update_status('wc-completed');
     333            }
    324334            $note .= "Transaction Status: " . $status . "\n";
    325335            $note .= "Order reference: " . $orderRef;
     
    373383    $order = wc_get_order($orderId);
    374384
    375     // fetching the plugin setting to extract keys
     385    // fetching the plugin setting to extract keys & other settings
    376386    $options = get_option('woocommerce_chaiport_settings');
    377387    $publicKey = ($options["testmode"] == "yes" ? $options["test_publishable_key"] : $options["publishable_key"]);
    378388    $privateKey = ($options["testmode"] == "yes" ? $options["test_private_key"] : $options["private_key"]);
     389    $orderStatusType = $options["payment_process_action"];
    379390
    380391    // validating signature
     
    388399
    389400        if ($status == "Success") {
    390             $status = $order->update_status('wc-processing');
     401            if ($orderStatusType == "Processing") {
     402                $order->update_status('wc-processing');
     403            } else {
     404                $order->update_status('wc-completed');
     405            }
    391406            $note .= "Transaction Status: " . $status . "\n";
    392407            $note .= "Order reference: " . $orderRef;
     
    468483            $this->publishable_key = $this->testmode ? $this->get_option('test_publishable_key') : $this->get_option('publishable_key');
    469484            $this->webhook_url = $webhookUrl;
     485            $this->payment_process_action = $this->get_option('payment_process_action');
    470486
    471487            // This action hook saves the settings
     
    597613                    'desc_tip' => true,
    598614                    'id' => 'default_guest_checkout'
    599                 )
     615                ),
     616                'payment_process_action' => array(
     617                    'title' => 'Payment processing action',
     618                    'type' => 'select',
     619                    'description' => 'This is the status that the order will be moved to when payment is processed successfully',
     620                    'default' => 'Processing',
     621                    'options' => array(
     622                        'Processing' => 'Processing',
     623                        'Completed'   => 'Completed'
     624                    )
     625                ),
    600626            );
    601627        }
  • chaiport-payment/trunk/readme.txt

    r2621881 r2630470  
    44Requires at least: 3.9.2
    55Tested up to: 5.8.1
    6 Stable tag: 1.0.1
     6Stable tag: 1.0.2
    77Requires PHP: 5.6
    88License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.