Plugin Directory

Changeset 2688907


Ignore:
Timestamp:
03/04/2022 01:51:59 PM (4 years ago)
Author:
dizyn
Message:

tagged version 2.8

Location:
bykea-cash-online-payments
Files:
12 added
4 edited

Legend:

Unmodified
Added
Removed
  • bykea-cash-online-payments/trunk/README.md

    r2688232 r2688907  
    55Requires at least: 4.0
    66Tested up to: 5.9
    7 Stable tag: 2.7
     7Stable tag: 2.8
    88Requires PHP: 7.4
    99License: GPLv3
     
    118118== Changelog ==
    119119
    120 = 2.7 =
    121 * Added functionality to choose payment options in the API
     120= 2.8 =
     121* Added IPN functionality for Cash Pickup option
    122122
    123123== Upgrade Notice ==
  • bykea-cash-online-payments/trunk/online-payments-bykeacash.php

    r2688232 r2688907  
    55 * Plugin URI:        https://wordpress.org/plugins/bykea-cash-online-payments
    66 * Description:       This plugin helps WooCommerce (WordPress) customers pay via Debit / Credit Cards or Cash Pickups using Bykea Cash payment service.
    7  * Version:           2.7
     7 * Version:           2.8
    88 * Requires at least: 5.2
    99 * Requires PHP:      7.4
     
    265265    die();
    266266}
     267
     268// IPN functionality for Cash Pickup
     269function opbc_manage_IPN_Data( $request ) {
     270    $ipnData = $request->get_json_params();
     271    if($ipnData['payment_method'] == 'cash_pickup'){
     272        if ( ! class_exists( 'WC_Payment_Gateway' ) ) return;
     273        include_once( 'woocommerce-bykeacash.php' );
     274        $bcashApi = new OnlinePayments_BykeaCash();
     275        $orderId = $ipnData['details']['order'];
     276        $invoice = $ipnData['invoice_number'];
     277        $order = wc_get_order( $orderId );
     278        $orderData = $order->get_data();
     279        $adminEmail = $bcashApi->email;
     280        $customerEmail = $orderData['billing']['email'];
     281        if($ipnData['payment_status'] == 'completed'){
     282            $order->update_status( 'processing' );
     283            $orderNote = __("Payment against invoice no: <a href='https://invoice.bykea.cash/receive/invoice/".$invoice."' target='_blank'>".$invoice."</a> has been confirmed.");
     284            $order->add_order_note( $orderNote );
     285            // Payment confirmation to admin
     286            $to = $adminEmail;
     287            $subject = 'Payment Notification from Bykea Cash';
     288            $headers = array('Content-Type: text/html; charset=UTF-8','From: '.get_bloginfo( 'name' ).' <wordpress@'.$_SERVER['HTTP_HOST'].'>');
     289            $message = '<html><body>';
     290            $message .= '<p>Dear Admin, we have received your payment against Order ID: '.$orderId.'. It will get transferred into your bank account shortly. Bykea Cash Invoice ID for this payment is "'.$invoice.'".</p>';
     291            $message .= '</body></html>';
     292            wp_mail($to,$subject,$message,$headers);
     293            // Payment confirmation to customer
     294            $to = $customerEmail;
     295            $subject = 'Payment Confirmation Notification';
     296            $headers = array('Content-Type: text/html; charset=UTF-8','From: '.get_bloginfo( 'name' ).' <wordpress@'.$_SERVER['HTTP_HOST'].'>');
     297            $message = '<html><body>';
     298            $message .= '<p>Dear Customer, your payment against Order ID: '.$orderId.' on '.home_url().' has been confirmed. You will receive update about your order shortly.</p>';
     299            $message .= '</body></html>';
     300            wp_mail($to,$subject,$message,$headers);
     301        }else{
     302            $order->update_status( 'failed' );
     303            $orderNote = __("Payment against invoice no: <a href='https://invoice.bykea.cash/receive/invoice/".$invoice."' target='_blank'>".$invoice."</a> has been declined.");
     304            $order->add_order_note( $orderNote );
     305            // Payment cancellation notification to admin
     306            $to = $adminEmail;
     307            $subject = 'Payment Notification from Bykea Cash';
     308            $headers = array('Content-Type: text/html; charset=UTF-8','From: '.get_bloginfo( 'name' ).' <wordpress@'.$_SERVER['HTTP_HOST'].'>');
     309            $message = '<html><body>';
     310            $message .= '<p>Dear Admin, payment made against Order ID: '.$orderId.'. has been declined. For more details please contact Bykea Cash Support. Bykea Cash Invoice ID for this payment is "'.$invoice.'".</p>';
     311            $message .= '</body></html>';
     312            wp_mail($to,$subject,$message,$headers);
     313            // Payment cancellation notification to customer
     314            $to = $customerEmail;
     315            $subject = 'Payment Decline Notification';
     316            $headers = array('Content-Type: text/html; charset=UTF-8','From: '.get_bloginfo( 'name' ).' <wordpress@'.$_SERVER['HTTP_HOST'].'>');
     317            $message = '<html><body>';
     318            $message .= '<p>Dear Customer, your payment against Order ID: '.$orderId.' on '.home_url().' has been voided. For more details, please contact website administrator.</p>';
     319            $message .= '</body></html>';
     320            wp_mail($to,$subject,$message,$headers);
     321        }
     322    }
     323}
     324add_action( 'rest_api_init', function () {
     325    register_rest_route( 'bcashapi/v1', '/ipn', array(
     326      'methods' => 'POST',
     327      'callback' => 'opbc_manage_IPN_Data',
     328    ) );
     329});
  • bykea-cash-online-payments/trunk/readme.txt

    r2688232 r2688907  
    55Requires at least: 4.0
    66Tested up to: 5.9
    7 Stable tag: 2.7
     7Stable tag: 2.8
    88Requires PHP: 7.4
    99License: GPLv3
     
    118118== Changelog ==
    119119
    120 = 2.7 =
    121 * Added functionality to choose payment options in the API
     120= 2.8 =
     121* Added IPN functionality for Cash Pickup option
    122122
    123123== Upgrade Notice ==
  • bykea-cash-online-payments/trunk/woocommerce-bykeacash.php

    r2688232 r2688907  
    160160                'title'     => __( 'Payment Options', 'online-payments-bykeacash' ),
    161161                'desc_tip'  => __( 'Select the payment option that you want to show to your customers', 'online-payments-bykeacash' ),
    162                 'type' => 'select',
    163                 'default' => 'card_payments',
    164                 'options' => array(
     162                'type'      => 'select',
     163                'class'     => $showClass." plugin-details-fields",
     164                'default'   => 'card_payments',
     165                'options'   => array(
    165166                    'card_payments' => 'Show Visa/Mastercard Payment Option',
    166167                    'cash_pickup' => 'Show Cash Pickup Payment Option',
Note: See TracChangeset for help on using the changeset viewer.