Changeset 3161482
- Timestamp:
- 10/02/2024 11:45:50 AM (18 months ago)
- Location:
- payping-gravityforms/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (2 diffs)
-
payping-gravityforms.php (modified) (1 diff)
-
payping.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
payping-gravityforms/trunk/README.txt
r3122735 r3161482 6 6 Tested up to: 6.6 7 7 Requires PHP: 7.2 8 Stable tag: 2. 3.18 Stable tag: 2.4.1 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 26 26 == Privacy Policy == 27 27 This plugin follows strict privacy guidelines. When using the api.payping.ir service, user data is securely transmitted and stored following industry best practices. 28 29 30 == Changelog == 31 32 == 2.4.1 == 33 افزودن برخی از ویژگی ها. -
payping-gravityforms/trunk/payping-gravityforms.php
r3099658 r3161482 2 2 /* 3 3 Plugin Name: PayPing GravityForms 4 Version: 2. 3.14 Version: 2.4.1 5 5 Description: افزونه درگاه پرداخت پیپینگ برای Gravity forms 6 6 Plugin URI: https://www.payping.ir/ -
payping-gravityforms/trunk/payping.php
r3103209 r3161482 2046 2046 2047 2047 $data = array( 2048 ' payerName' => $user_name,2048 'PayerName' => $user_name, 2049 2049 'Amount' => $Amount, 2050 ' payerIdentity' => $Mobile,2051 ' returnUrl' => $ReturnPath,2050 'PayerIdentity' => $Mobile, 2051 'ReturnUrl' => $ReturnPath, 2052 2052 'Description' => $Description, 2053 'clientRefId' => $entry_id 2053 'ClientRefId' => $entry_id, 2054 'NationalCode' => '' 2054 2055 ); 2055 2056 2056 2057 try { 2057 $url = "https://api.payping.ir/v 1/pay";2058 $url = "https://api.payping.ir/v3/pay"; 2058 2059 $headers = array( 2060 'X-Platform' => 'GravityForms', 2061 'X-Platform-Version' => '2.3.1', 2059 2062 "Accept" => "application/json", 2060 2063 "Authorization" => "Bearer " . self::get_merchent(), … … 2081 2084 $response = json_decode($body, true); 2082 2085 2083 if (isset($response[" code"]) && $response["code"] != '') {2084 $Payment_URL = sprintf('https://api.payping.ir/v 1/pay/gotoipg/%s', $response["code"]);2086 if (isset($response["paymentCode"]) && $response["paymentCode"] != '') { 2087 $Payment_URL = sprintf('https://api.payping.ir/v3/pay/start/%s', $response["paymentCode"]); 2085 2088 2086 2089 if ($valid_checker) { … … 2135 2138 // #5 2136 2139 public static function Verify() { 2137 2140 2138 2141 if ( apply_filters( 'gf_gateway_payping_return', apply_filters( 'ppgf_gateway_verify_return', false ) ) ) { 2139 2142 return; … … 2160 2163 2161 2164 $form = RGFormsModel::get_form_meta( $form_id ); 2162 2165 2163 2166 $payment_type = gform_get_meta( $entry["id"], 'payment_type' ); 2164 2167 gform_delete_meta( $entry['id'], 'payment_type' ); … … 2209 2212 } 2210 2213 $Total_Money = GFCommon::to_money( $Total, $entry["currency"] ); 2211 2214 2212 2215 $free = false; 2213 if ( empty( $_GET['no'] ) || $_GET['no'] != 'true' ) { 2216 2217 $paypingResponse = stripslashes($_REQUEST['data']); 2218 $responseData = json_decode($paypingResponse, true); 2219 // Get refid 2220 if (isset($responseData['paymentRefId'])) { 2221 $refid = sanitize_text_field($responseData['paymentRefId']); 2222 }else{ 2223 $refid = null; 2224 } 2225 if ($_REQUEST['status'] == 0) { 2226 $Status = 'cancelled'; 2227 $Message = "کاربر در صفحه بانک از پرداخت انصراف داده است."; 2228 $Fault = 'تراكنش توسط شما لغو شد.'; 2229 2230 2231 } else{ 2232 if ( empty( $_GET['no'] ) || $_GET['no'] != 'true' ) { 2214 2233 2215 2234 //Start of payping … … 2217 2236 $Amount = GFPersian_Payments::amount( $Amount, 'IRT', $form, $entry ); 2218 2237 } 2219 2220 $Authority = isset($_GET['refid']) ? sanitize_text_field($_GET['refid']) : ''; 2221 $MerchantID = self::get_merchent(); 2238 $Authority = isset($responseData['paymentRefId']) ? sanitize_text_field($responseData['paymentRefId']) : ''; 2239 $MerchantID = self::get_merchent(); 2222 2240 2223 2241 try { 2224 $data = array(' refId' => sanitize_text_field($_GET['refid']), 'amount' => $Amount);2242 $data = array('PaymentRefId' => sanitize_text_field($responseData['paymentRefId']), 'Amount' => $Amount); 2225 2243 2226 $url = "https://api.payping.ir/v 1/pay/verify";2244 $url = "https://api.payping.ir/v3/pay/verify"; 2227 2245 $headers = array( 2228 2246 "Accept" => "application/json", … … 2240 2258 ) 2241 2259 ); 2242 2260 2243 2261 if (is_wp_error($response)) { 2244 2262 $Status = 'failed'; … … 2251 2269 $body = wp_remote_retrieve_body($response); 2252 2270 $response = json_decode($body, true); 2253 2254 if (isset($_GET["refid"]) && $_GET["refid"] != '') { 2271 if (isset($response["paymentRefId"]) && $response["paymentRefId"] != '') { 2255 2272 $Status = 'completed'; 2273 $Message = 'پرداخت با موفقیت انجام شد.'; 2256 2274 } else { 2257 $Message = 'متا فسانه سامانه قادر به دریافت کد پیگیری نمی باشد! ';2275 $Message = 'متاسفانه سامانه قادر به دریافت کد پیگیری نمی باشد! '; 2258 2276 $Status = 'failed'; 2259 2277 } … … 2262 2280 $Message = implode('. ', array_values(json_decode($body, true))); 2263 2281 $Status = 'failed'; 2282 }elseif ($header == 409){ 2283 $Status = 'completed'; 2284 $Message = 'این پرداخت قبلا تایید شده است.'; 2264 2285 } else { 2265 2286 $Message = self::Fault($header) . '(' . $header . ')'; … … 2273 2294 2274 2295 2275 $Transaction_ID = isset($_GET['refid']) ? absint($_GET['refid']) : '-'; 2296 $Transaction_ID = isset($refid) ? absint($refid) : '-'; 2297 $CardNumber = isset($responseData['cardNumber']) ? $responseData['cardNumber'] : '-'; 2276 2298 //End of payping 2277 2299 } else { … … 2281 2303 $free = true; 2282 2304 } 2283 2305 } 2306 2307 2308 2284 2309 $Status = ! empty( $Status ) ? $Status : 'failed'; 2285 2310 $transaction_id = ! empty( $Transaction_ID ) ? $Transaction_ID : ''; … … 2290 2315 $entry["transaction_id"] = $transaction_id; 2291 2316 $entry["transaction_type"] = $transaction_type; 2292 2293 2317 if ( $Status == 'completed' ) { 2294 2318 … … 2311 2335 $Note = sprintf( esc_html__( 'وضعیت پرداخت : رایگان - بدون نیاز به درگاه پرداخت', "payping-gravityforms" ) ); 2312 2336 } else { 2313 $Note = sprintf( esc_html__( 'وضعیت پرداخت : موفق - مبلغ پرداختی : %s - کد تراکنش : %s ', "payping-gravityforms" ), $Total_Money, $transaction_id);2337 $Note = sprintf( esc_html__( 'وضعیت پرداخت : موفق - مبلغ پرداختی : %s - کد تراکنش : %s | شماره کارت: %s', "payping-gravityforms" ), $Total_Money, $transaction_id , $CardNumber); 2314 2338 } 2315 2339 … … 2374 2398 do_action( "gform_paypal_fulfillment", $entry, $paypal_config, $transaction_id, $Total ); 2375 2399 } else if ( $Status == 'cancelled' ) { 2400 2376 2401 $entry["payment_status"] = "Cancelled"; 2377 2402 $entry["payment_amount"] = 0;
Note: See TracChangeset
for help on using the changeset viewer.