Changeset 2661697
- Timestamp:
- 01/22/2022 08:51:19 AM (4 years ago)
- Location:
- gateway-payping-easy-digital-downloads
- Files:
-
- 7 added
- 4 edited
-
tags/1.1.0 (added)
-
tags/1.1.0/edd-payping.php (added)
-
tags/1.1.0/gateways (added)
-
tags/1.1.0/gateways/payping.php (added)
-
tags/1.1.0/includes (added)
-
tags/1.1.0/includes/toman-currency.php (added)
-
tags/1.1.0/readme.txt (added)
-
trunk/edd-payping.php (modified) (1 diff)
-
trunk/gateways/payping.php (modified) (15 diffs)
-
trunk/includes/toman-currency.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gateway-payping-easy-digital-downloads/trunk/edd-payping.php
r2615295 r2661697 2 2 /* 3 3 Plugin Name: Gateway PayPing Easy Digital Downloads 4 Version: 1. 1.04 Version: 1.2.0 5 5 Description: افزونه درگاه پرداخت پیپینگ برای Easy Digital Downloads 6 6 Plugin URI: https://www.payping.ir/ -
gateway-payping-easy-digital-downloads/trunk/gateways/payping.php
r2616244 r2661697 1 1 <?php 2 if( ! defined( 'ABSPATH' ) ) exit; 3 if( ! class_exists( 'EDD_payping_Gateway' ) ): 4 class EDD_payping_Gateway{ 2 if ( ! defined( 'ABSPATH' ) ) exit; 3 4 if ( ! class_exists( 'EDD_payping_Gateway' ) ) : 5 6 class EDD_payping_Gateway { 5 7 6 8 /* Show Debug In Console */ … … 16 18 } 17 19 18 public function __construct(){ 20 public function __construct() { 21 19 22 add_filter( 'edd_payment_gateways', array( $this, 'add' ) ); 20 23 add_action( 'edd_payping_cc_form' , array( $this, 'cc_form' ) ); … … 22 25 add_action( 'edd_verify_payping' , array( $this, 'verify' ) ); 23 26 add_filter( 'edd_settings_gateways', array( $this, 'settings' ) ); 27 24 28 add_action( 'edd_payment_receipt_after', array( $this, 'receipt' ) ); 29 25 30 add_action( 'init', array( $this, 'listen' ) ); 26 31 } 27 32 28 public function add( $gateways ) {33 public function add( $gateways ) { 29 34 global $edd_options; 35 30 36 $gateways[ 'payping' ] = array( 31 37 'checkout_label' => isset( $edd_options['payping_label'] ) ? $edd_options['payping_label'] : 'درگاه پرداخت آنلاین پیپینگ', 32 38 'admin_label' => 'پیپینگ' 33 39 ); 40 34 41 return $gateways; 35 42 } 36 43 37 public function cc_form() {44 public function cc_form() { 38 45 return; 39 46 } 40 47 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 } 42 59 global $edd_options; 43 60 @ session_start(); 44 61 $payment = $this->insert_payment( $purchase_data ); 45 62 46 if( $payment ){ 63 if ( $payment ) { 64 47 65 $tokenCode = ( isset( $edd_options[ 'payping_tokenCode' ] ) ? $edd_options[ 'payping_tokenCode' ] : '' ); 48 66 $desc = 'پرداخت شماره #' . $payment; 49 67 $callback = add_query_arg( 'verify_payping', '1', get_permalink( $edd_options['success_page'] ) ); 50 68 51 $amount = intval( $purchase_data['price'] ) ;69 $amount = intval( $purchase_data['price'] ) ; 52 70 if ( edd_get_currency() == 'IRR' or strtoupper(edd_get_currency()) == 'RIAL' or strtoupper(edd_get_currency()) == 'ريال' ) 53 71 $amount = $amount / 10; // Return back to original one. … … 55 73 $data = array( 56 74 'clientRefId' => $payment, 75 'payerName' => $full_name, 57 76 'payerIdentity' => $purchase_data['user_email'], 58 77 'Amount' => $amount, … … 75 94 ); 76 95 77 $response = wp_remote_post('https://api.payping.ir/v 1/pay', $args);96 $response = wp_remote_post('https://api.payping.ir/v2/pay', $args); 78 97 $res_header = wp_remote_retrieve_headers($response); 79 98 $payping_id_request = $res_header['x-paypingrequest-id']; … … 82 101 $this->WC_GPP_Debug_Log($edd_options['payping_header_Debug'], $response, "Pay"); 83 102 84 if ( is_wp_error($response) ){103 if ( is_wp_error($response) ) { 85 104 edd_insert_payment_note( $payment, 'شناسه درخواست پیپینگ: '.$payping_id_request ); 86 105 edd_update_payment_status( $payment, 'failed' ); … … 91 110 $code = wp_remote_retrieve_response_code( $response ); 92 111 if($code === 200){ 93 if (isset($response["body"]) and $response["body"] != ''){112 if (isset($response["body"]) and $response["body"] != '') { 94 113 $code_pay = wp_remote_retrieve_body($response); 95 114 $code_pay = json_decode($code_pay, true); … … 97 116 edd_update_payment_meta( $payment, 'payping_code', $code_pay ); 98 117 $_SESSION['pp_payment'] = $payment; 99 wp_redirect(sprintf('https://api.payping.ir/v 1/pay/gotoipg/%s', $code_pay["code"]));118 wp_redirect(sprintf('https://api.payping.ir/v2/pay/gotoipg/%s', $code_pay["code"])); 100 119 exit; 101 120 }else{ … … 119 138 120 139 121 public function verify() {140 public function verify() { 122 141 global $edd_options; 123 142 124 if ( isset( $_ GET['refid'] ) ) {125 $refid = sanitize_text_field( $_ GET['refid'] );143 if ( isset( $_REQUEST['refid'] ) ) { 144 $refid = sanitize_text_field( $_REQUEST['refid'] ); 126 145 $payment = edd_get_payment( $_SESSION['pp_payment'] ); 127 146 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'] ) ); 130 149 } 131 if ( $payment->status == 'complete' ) return false;150 if ( $payment->status == 'complete' ) return false; 132 151 133 152 $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()) == 'ريال' ) 135 154 $amount = $amount / 10; // Return back to original one. 136 155 … … 164 183 edd_empty_cart(); 165 184 166 if ( version_compare( EDD_VERSION, '2.1', '>=' ) )185 if ( version_compare( EDD_VERSION, '2.1', '>=' ) ) 167 186 edd_set_payment_transaction_id( $payment->ID, $refid ); 168 187 169 if ( is_wp_error($response) ){188 if ( is_wp_error($response) ) { 170 189 $Status = 'failed'; 171 190 $Fault = 'wp-remote Error.'; … … 173 192 }else{ 174 193 $code = wp_remote_retrieve_response_code( $response ); 175 if ( $code == 200 ){194 if ( $code == 200 ) { 176 195 if (isset($refid) and $refid != '') { 177 196 edd_insert_payment_note( $payment->ID, 'شماره تراکنش: '.$refid ); … … 219 238 * @return array 220 239 */ 221 public function settings( $settings ) {240 public function settings( $settings ) { 222 241 return array_merge( $settings, array( 223 'payping_header' => array(242 'payping_header' => array( 224 243 'id' => 'payping_header', 225 244 'type' => 'header', … … 256 275 * @return int $payment_id 257 276 */ 258 private function insert_payment( $purchase_data ) {277 private function insert_payment( $purchase_data ) { 259 278 global $edd_options; 260 279 … … 283 302 */ 284 303 public function listen() { 285 if ( isset( $_ GET[ 'verify_payping' ] ) && $_GET[ 'verify_payping' ] ) {304 if ( isset( $_REQUEST[ 'verify_payping' ] ) && $_REQUEST[ 'verify_payping' ] ) { 286 305 do_action( 'edd_verify_payping' ); 287 306 } … … 316 335 } 317 336 } 337 318 338 endif; 319 339 -
gateway-payping-easy-digital-downloads/trunk/includes/toman-currency.php
r2616244 r2661697 7 7 * @return array 8 8 */ 9 if ( ! function_exists('irg_add_toman_currencyP')):10 function irpayping_add_toman_currency( $currencies ) {9 if ( ! function_exists('irg_add_toman_currencyP')): 10 function irpayping_add_toman_currency( $currencies ) { 11 11 $currencies['IRT'] = 'تومان'; 12 12 return $currencies; … … 18 18 * Format decimals 19 19 */ 20 add_filter( 'edd_sanitize_amount_decimals', function( $decimals ) {20 add_filter( 'edd_sanitize_amount_decimals', function( $decimals ) { 21 21 22 22 $currency = function_exists('edd_get_currency') ? edd_get_currency() : ''; … … 31 31 } ); 32 32 33 add_filter( 'edd_format_amount_decimals', function( $decimals ) {33 add_filter( 'edd_format_amount_decimals', function( $decimals ) { 34 34 35 35 $currency = function_exists('edd_get_currency') ? edd_get_currency() : ''; … … 44 44 } ); 45 45 46 if ( function_exists('per_number') ){46 if ( function_exists('per_number') ) { 47 47 add_filter( 'edd_irt_currency_filter_after', 'per_number', 10, 2 ); 48 48 } 49 49 50 50 add_filter( 'edd_irt_currency_filter_after', 'irpayping_toman_postfix', 10, 2 ); 51 function irpayping_toman_postfix( $price, $did ) {51 function irpayping_toman_postfix( $price, $did ) { 52 52 return str_replace( 'IRT', 'تومان', $price ); 53 53 } 54 54 55 55 add_filter( 'edd_rial_currency_filter_after', 'rialpayping_postfix', 10, 2 ); 56 function rialpayping_postfix( $price, $did ) {56 function rialpayping_postfix( $price, $did ) { 57 57 return str_replace( 'RIAL', 'ریال', $price ); 58 58 } -
gateway-payping-easy-digital-downloads/trunk/readme.txt
r2616244 r2661697 4 4 Donate link: https://payping.ir 5 5 Requires at least: 4.0.0 6 Tested up to: 5.8 .16 Tested up to: 5.8 7 7 Requires PHP: 7.0 8 Stable tag: 1. 1.08 Stable tag: 1.2.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 23 23 release Plugin 24 24 25 == 1.2.0 == 26 ارتقا به نسخه وبسرویس v2 پیپینگ 27 رفع مشکل عدم نمایش نام پرداخت کننده در پنل پیپینگ 28 25 29 == Upgrade Notice == 26 30 Update
Note: See TracChangeset
for help on using the changeset viewer.