Plugin Directory

Changeset 2661697


Ignore:
Timestamp:
01/22/2022 08:51:19 AM (4 years ago)
Author:
payping
Message:

update to version 1.2.0

Location:
gateway-payping-easy-digital-downloads
Files:
7 added
4 edited

Legend:

Unmodified
Added
Removed
  • gateway-payping-easy-digital-downloads/trunk/edd-payping.php

    r2615295 r2661697  
    22/*
    33Plugin Name: Gateway PayPing Easy Digital Downloads
    4 Version: 1.1.0
     4Version: 1.2.0
    55Description:  افزونه درگاه پرداخت پی‌پینگ برای Easy Digital Downloads
    66Plugin URI: https://www.payping.ir/
  • gateway-payping-easy-digital-downloads/trunk/gateways/payping.php

    r2616244 r2661697  
    11<?php
    2 if( ! defined( 'ABSPATH' ) ) exit;
    3 if( ! class_exists( 'EDD_payping_Gateway' ) ):
    4     class EDD_payping_Gateway{
     2if ( ! defined( 'ABSPATH' ) ) exit;
     3
     4if ( ! class_exists( 'EDD_payping_Gateway' ) ) :
     5
     6    class EDD_payping_Gateway {
    57       
    68        /* Show Debug In Console */
     
    1618        }
    1719       
    18         public function __construct(){
     20        public function __construct() {
     21
    1922            add_filter( 'edd_payment_gateways', array( $this, 'add' ) );
    2023            add_action( 'edd_payping_cc_form' , array( $this, 'cc_form' ) );
     
    2225            add_action( 'edd_verify_payping' , array( $this, 'verify' ) );
    2326            add_filter( 'edd_settings_gateways', array( $this, 'settings' ) );
     27
    2428            add_action( 'edd_payment_receipt_after', array( $this, 'receipt' ) );
     29
    2530            add_action( 'init', array( $this, 'listen' ) );
    2631        }
    2732
    28         public function add( $gateways ){
     33        public function add( $gateways ) {
    2934            global $edd_options;
     35
    3036            $gateways[ 'payping' ] = array(
    3137                'checkout_label'        =>  isset( $edd_options['payping_label'] ) ? $edd_options['payping_label'] : 'درگاه پرداخت آنلاین پی‌پینگ',
    3238                'admin_label'           =>  'پی‌پینگ'
    3339            );
     40
    3441            return $gateways;
    3542        }
    3643
    37         public function cc_form(){
     44        public function cc_form() {
    3845            return;
    3946        }
    4047
    41         public function process( $purchase_data ){
     48        public function process( $purchase_data ) {
     49            $user_data = $purchase_data['user_info'];
     50            if(isset($user_data)){
     51                $first_name = $user_data['first_name'];
     52                $last_name = $user_data['last_name'];
     53                $full_name = $user_data['first_name'].' '. $user_data['last_name'];
     54            }else{
     55                $first_name = __('وارد نشده‌است', 'payping');
     56                $last_name = __('وارد نشده‌است', 'payping');
     57                $full_name = $user_data['first_name'].' '. $user_data['last_name'];
     58            }
    4259            global $edd_options;
    4360            @ session_start();
    4461            $payment = $this->insert_payment( $purchase_data );
    4562
    46             if( $payment ){
     63            if ( $payment ) {
     64
    4765                $tokenCode = ( isset( $edd_options[ 'payping_tokenCode' ] ) ? $edd_options[ 'payping_tokenCode' ] : '' );
    4866                $desc = 'پرداخت شماره #' . $payment;
    4967                $callback = add_query_arg( 'verify_payping', '1', get_permalink( $edd_options['success_page'] ) );
    5068
    51                 $amount = intval( $purchase_data['price'] );
     69                $amount = intval( $purchase_data['price'] ) ;
    5270                if ( edd_get_currency() == 'IRR' or strtoupper(edd_get_currency()) == 'RIAL' or strtoupper(edd_get_currency()) == 'ريال' )
    5371                    $amount = $amount / 10; // Return back to original one.
     
    5573                $data = array(
    5674                    'clientRefId'           =>  $payment,
     75                    'payerName'             =>  $full_name,
    5776                    'payerIdentity'         =>  $purchase_data['user_email'],
    5877                    'Amount'                =>  $amount,
     
    7594                );
    7695
    77                     $response = wp_remote_post('https://api.payping.ir/v1/pay', $args);
     96                    $response = wp_remote_post('https://api.payping.ir/v2/pay', $args);
    7897                    $res_header = wp_remote_retrieve_headers($response);
    7998                    $payping_id_request = $res_header['x-paypingrequest-id'];
     
    82101                    $this->WC_GPP_Debug_Log($edd_options['payping_header_Debug'], $response, "Pay");
    83102               
    84                     if( is_wp_error($response) ){
     103                    if ( is_wp_error($response) ) {
    85104                        edd_insert_payment_note( $payment, 'شناسه درخواست پی‌پینگ: '.$payping_id_request );
    86105                        edd_update_payment_status( $payment, 'failed' );
     
    91110                        $code = wp_remote_retrieve_response_code( $response );
    92111                        if($code === 200){
    93                             if(isset($response["body"]) and $response["body"] != ''){
     112                            if (isset($response["body"]) and $response["body"] != '') {
    94113                                $code_pay = wp_remote_retrieve_body($response);
    95114                                $code_pay =  json_decode($code_pay, true);
     
    97116                                edd_update_payment_meta( $payment, 'payping_code', $code_pay );
    98117                                $_SESSION['pp_payment'] = $payment;
    99                                 wp_redirect(sprintf('https://api.payping.ir/v1/pay/gotoipg/%s', $code_pay["code"]));
     118                                wp_redirect(sprintf('https://api.payping.ir/v2/pay/gotoipg/%s', $code_pay["code"]));
    100119                                exit;
    101120                            }else{
     
    119138
    120139
    121         public function verify(){
     140        public function verify() {
    122141            global $edd_options;
    123142
    124             if ( isset( $_GET['refid'] ) ) {
    125                 $refid = sanitize_text_field( $_GET['refid'] );
     143            if ( isset( $_REQUEST['refid'] ) ) {
     144                $refid = sanitize_text_field( $_REQUEST['refid'] );
    126145                $payment = edd_get_payment( $_SESSION['pp_payment'] );
    127146                unset( $_SESSION['pp_payment'] );
    128                 if( ! $payment ){
    129                     $payment = edd_get_payment( sanitize_text_field( $_GET['clientrefid'] ) );
     147                if ( ! $payment ) {
     148                    $payment = edd_get_payment( sanitize_text_field( $_REQUEST['clientrefid'] ) );
    130149                }
    131                 if( $payment->status == 'complete' ) return false;
     150                if ( $payment->status == 'complete' ) return false;
    132151
    133152                $amount = intval( edd_get_payment_amount( $payment->ID ) ) ;
    134                 if( edd_get_currency() == 'IRR' or strtoupper(edd_get_currency()) == 'RIAL' or strtoupper(edd_get_currency()) == 'ريال' )
     153                if ( edd_get_currency() == 'IRR' or strtoupper(edd_get_currency()) == 'RIAL' or strtoupper(edd_get_currency()) == 'ريال' )
    135154                    $amount = $amount / 10; // Return back to original one.
    136155
     
    164183                    edd_empty_cart();
    165184
    166                     if( version_compare( EDD_VERSION, '2.1', '>=' ) )
     185                    if ( version_compare( EDD_VERSION, '2.1', '>=' ) )
    167186                        edd_set_payment_transaction_id( $payment->ID, $refid );                         
    168187               
    169                     if( is_wp_error($response) ){
     188                    if ( is_wp_error($response) ) {
    170189                        $Status = 'failed';
    171190                        $Fault = 'wp-remote Error.';
     
    173192                    }else{
    174193                        $code = wp_remote_retrieve_response_code( $response );
    175                         if( $code == 200 ){
     194                        if ( $code == 200 ) {
    176195                            if (isset($refid) and $refid != '') {
    177196                                edd_insert_payment_note( $payment->ID, 'شماره تراکنش: '.$refid );
     
    219238         * @return              array
    220239         */
    221         public function settings( $settings ){
     240        public function settings( $settings ) {
    222241            return array_merge( $settings, array(
    223                 'payping_header'    =>  array(
     242                'payping_header'        =>  array(
    224243                    'id'            =>  'payping_header',
    225244                    'type'          =>  'header',
     
    256275         * @return          int $payment_id
    257276         */
    258         private function insert_payment( $purchase_data ){
     277        private function insert_payment( $purchase_data ) {
    259278            global $edd_options;
    260279
     
    283302         */
    284303        public function listen() {
    285             if ( isset( $_GET[ 'verify_payping' ] ) && $_GET[ 'verify_payping' ] ) {
     304            if ( isset( $_REQUEST[ 'verify_payping' ] ) && $_REQUEST[ 'verify_payping' ] ) {
    286305                do_action( 'edd_verify_payping' );
    287306            }
     
    316335        }
    317336    }
     337
    318338endif;
    319339
  • gateway-payping-easy-digital-downloads/trunk/includes/toman-currency.php

    r2616244 r2661697  
    77 * @return              array
    88 */
    9 if( ! function_exists('irg_add_toman_currencyP')):
    10 function irpayping_add_toman_currency( $currencies ){
     9if ( ! function_exists('irg_add_toman_currencyP')):
     10function irpayping_add_toman_currency( $currencies ) {
    1111    $currencies['IRT'] = 'تومان';
    1212    return $currencies;
     
    1818 * Format decimals
    1919 */
    20 add_filter( 'edd_sanitize_amount_decimals', function( $decimals ){
     20add_filter( 'edd_sanitize_amount_decimals', function( $decimals ) {
    2121   
    2222    $currency = function_exists('edd_get_currency') ? edd_get_currency() : '';
     
    3131} );
    3232
    33 add_filter( 'edd_format_amount_decimals', function( $decimals ){
     33add_filter( 'edd_format_amount_decimals', function( $decimals ) {
    3434   
    3535    $currency = function_exists('edd_get_currency') ? edd_get_currency() : '';
     
    4444} );
    4545
    46 if( function_exists('per_number') ){
     46if ( function_exists('per_number') ) {
    4747    add_filter( 'edd_irt_currency_filter_after', 'per_number', 10, 2 );
    4848}
    4949
    5050add_filter( 'edd_irt_currency_filter_after', 'irpayping_toman_postfix', 10, 2 );
    51 function irpayping_toman_postfix( $price, $did ){
     51function irpayping_toman_postfix( $price, $did ) {
    5252    return str_replace( 'IRT', 'تومان', $price );
    5353}
    5454
    5555add_filter( 'edd_rial_currency_filter_after', 'rialpayping_postfix', 10, 2 );
    56 function rialpayping_postfix( $price, $did ){
     56function rialpayping_postfix( $price, $did ) {
    5757    return str_replace( 'RIAL', 'ریال', $price );
    5858}
  • gateway-payping-easy-digital-downloads/trunk/readme.txt

    r2616244 r2661697  
    44Donate link: https://payping.ir
    55Requires at least: 4.0.0
    6 Tested up to: 5.8.1
     6Tested up to: 5.8
    77Requires PHP: 7.0
    8 Stable tag: 1.1.0
     8Stable tag: 1.2.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2323release Plugin
    2424
     25== 1.2.0 ==
     26ارتقا به نسخه وبسرویس v2 پی‌پینگ
     27رفع مشکل عدم نمایش نام پرداخت کننده در پنل پی‌پینگ
     28
    2529== Upgrade Notice ==
    2630Update
Note: See TracChangeset for help on using the changeset viewer.