Changeset 1945463
- Timestamp:
- 09/23/2018 08:34:07 AM (8 years ago)
- Location:
- bank-saman-edd-gateway/trunk
- Files:
-
- 4 edited
-
bank-saman-edd-gateway.php (modified) (6 diffs)
-
langs/saman_edd-fa_IR.mo (modified) (previous)
-
langs/saman_edd-fa_IR.po (modified) (3 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bank-saman-edd-gateway/trunk/bank-saman-edd-gateway.php
r1590129 r1945463 2 2 /** 3 3 Plugin Name: Bank Saman EDD gateway 4 Version: 1.04 Version: 2.0 5 5 Description: Add Bank Saman gateway to easy digital downloads 6 Plugin URI: http ://pamjad.me/saman-getway-edd6 Plugin URI: https://pamjad.me/saman-getway-edd 7 7 Author: Pouriya Amjadzadeh 8 Author URI: http ://pamjad.me9 Donate link: http ://pamjad.me/donate10 Tags: easy digital downloads,EDD gateways,persian banks 11 Requires at least: 3.012 Tested up to: 4. 6.113 Stable tag: 4. 18 Author URI: https://pamjad.me 9 Donate link: https://pamjad.me/donate 10 Tags: easy digital downloads,EDD gateways,persian banks,getaway, 11 Requires at least: 4.0 12 Tested up to: 4.9.8 13 Stable tag: 4.5 14 14 License: GPLv2 or later 15 15 License URI: http://www.gnu.org/licenses/gpl-2.0.html 16 16 **/ 17 17 18 19 function load_textdomain_sedd() { 18 function pj_eddSaman_load_textdomain() { 20 19 load_plugin_textdomain( 'saman_edd', false, dirname( plugin_basename( __FILE__ ) ) . '/langs' ); 21 20 } 22 21 add_action( 'init', 'load_textdomain_sedd' ); 23 22 24 @session_start(); 23 @session_start(); // Start Session for get information 25 24 26 if ( !function_exists( 'edd_rial' ) ) { 25 //Change Rial to ریال 26 if ( !function_exists( 'edd_rial' ) ) { // Check if edd_rial() is not available 27 27 function edd_rial( $formatted, $currency, $price ) { 28 28 return $price . __('RIAL', 'saman_edd'); … … 31 31 } 32 32 33 function samanadd_gateway ($gateways) { 34 $gateways['saman'] = array('admin_label' => __('Saman Gateway', 'saman_edd'), 'checkout_label' => __('Pay with saman gateway', 'saman_edd')); 33 //Registers the gateway 34 function pj_eddSaman_register_gateway($gateways) { 35 $gateways['saman'] = array( 36 'admin_label' => __('Saman Gateway', 'saman_edd'), 37 'checkout_label' => __('Do transactions with bank saman gateway', 'saman_edd') 38 ); 35 39 return $gateways; 36 40 } 37 add_filter( 'edd_payment_gateways', 'samanadd_gateway');41 add_filter('edd_payment_gateways', 'pj_eddSaman_register_gateway'); 38 42 39 function samancc_form () { 40 do_action( 'samancc_form_action' ); 43 //Create Custom Credit From 44 function pj_eddSaman_saman_gateway_cc_form() { 45 do_action( 'saman_form_action' ); 46 return; 41 47 } 42 add_ filter( 'edd_saman_cc_form', 'samancc_form');48 add_action('edd_saman_gateway_cc_form', 'pj_eddSaman_saman_gateway_cc_form'); 43 49 44 function samanprocess_payment ($purchase_data) { 50 //Processes the payment of Edd for Saman Bank 51 function pj_eddSaman_process_payment($purchase_data) { 45 52 global $edd_options; 46 $payment_data = array( 47 'price' => $purchase_data['price'], 48 'date' => $purchase_data['date'], 49 'user_email' => $purchase_data['post_data']['edd_email'], 50 'purchase_key' => $purchase_data['purchase_key'], 51 'currency' => $edd_options['currency'], 52 'downloads' => $purchase_data['downloads'], 53 'cart_details' => $purchase_data['cart_details'], 54 'user_info' => $purchase_data['user_info'], 55 'status' => 'pending' 56 ); 57 $payment = edd_insert_payment($payment_data); 58 if ($payment) { 59 $merchant = $edd_options['merchant']; 60 $password = $edd_options['password']; 61 unset($_SESSION['saman_payment']); 62 $amount = str_replace(".00", "", $purchase_data['price']); 63 $_SESSION['saman_payment'] = $amount; 64 $callBackUrl = add_query_arg('order', 'saman', get_permalink($edd_options['success_page'])); 65 $send_atu="<script language='JavaScript' type='text/javascript'><!--document.getElementById('checkout_confirmation').submit();//--></script>"; 66 echo '<form id="checkout_confirmation" method="post" action="https://sep.shaparak.ir/Payment.aspx" style="margin:0px" > 67 <input type="hidden" id="Amount" name="Amount" value="'.esc_attr($amount).'"> 68 <input type="hidden" id="MID" name="MID" value="'.esc_attr($merchant).'"> 69 <input type="hidden" id="ResNum" name="ResNum" value="'.esc_attr($payment).'"> 70 <input type="hidden" id="RedirectURL" name="RedirectURL" value="'.esc_attr($callBackUrl).'"> 71 <!--<input type="submit" value="'.__('If you have not redirected click here', '').'" />--> 72 </form>'.$send_atu ; 73 exit; 74 } else { 75 edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']); 53 54 // check for any stored errors 55 $errors = edd_get_errors(); 56 57 if(!$errors) { 58 $purchase_summary = edd_get_purchase_summary($purchase_data); 59 60 /********************************** 61 * Setup the payment details 62 **********************************/ 63 $payment_Data = array( 64 'price' => $purchase_data['price'], 65 'date' => $purchase_data['date'], 66 'user_email' => $purchase_data['user_email'], 67 'purchase_key' => $purchase_data['purchase_key'], 68 'currency' => $edd_options['currency'], 69 'downloads' => $purchase_data['downloads'], 70 'cart_details' => $purchase_data['cart_details'], 71 'user_info' => $purchase_data['user_info'], 72 'status' => 'pending' 73 ); 74 //Record the pending payment 75 $payment = edd_insert_payment($payment_data); 76 77 if ($payment) { 78 if(!edd_is_test_mode()) { 79 $merchant = $edd_options['merchant']; 80 unset($_SESSION['saman_payment']); 81 $amount = str_replace(".00", "", $purchase_data['price']); 82 $_SESSION['saman_payment'] = $amount; 83 $callBackUrl = add_query_arg( 'order', 'saman', get_permalink( $edd_options['success_page'] ) ); ?> 84 <form id="samanpeyment" method="POST" action="https://sep.shaparak.ir/Payment.aspx"> 85 <input type="hidden" id="Amount" name="Amount" value="<?php echo esc_attr($amount); ?>"> 86 <input type="hidden" id="MID" name="MID" value="<?php echo esc_attr($merchant); ?>"> 87 <input type="hidden" id="ResNum" name="ResNum" value="<?php echo esc_attr($payment); ?>"> 88 <input type="hidden" id="RedirectURL" name="RedirectURL" value="<?php echo esc_attr($callBackUrl); ?>"> 89 <input type="submit" value="<?php _e('If you have not redirected click here', 'saman_edd'); ?>" /> 90 </form> 91 <script>document.forms['samanpeyment'].submit()</script> 92 <?php 93 exit; 94 } else { 95 edd_update_payment_status($payment, 'complete'); 96 unset($_SESSION['saman_payment']); 97 edd_send_to_success_page(); 98 } 99 } else { 100 edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']); 101 } 76 102 } 77 103 } 78 add_action('edd_gateway_saman ', 'samanprocess_payment');104 add_action('edd_gateway_saman_gateway', 'pj_eddSaman_process_payment'); 79 105 80 function samanverify() {106 function pj_eddSaman_verify_payment() { 81 107 global $edd_options; 82 if (isset($_GET['order']) and $_GET['order'] == 'saman') { 83 if ( !$_POST['ResNum'] OR !$_POST['RefNum'] OR !$_POST['State']){ 108 109 if (isset($_GET['order']) && $_GET['order'] == 'saman') { 110 111 if ( !$_POST['ResNum'] || !$_POST['RefNum'] || !$_POST['State']) { 84 112 $output[status] = 0; 85 113 } else { … … 89 117 90 118 if (isset($RefNum)) { 91 if (!class_exists('nusoap_client')) 92 require_once("nusoap.php"); 93 $merchantID = trim($edd_options['merchant']); 119 120 //Load nusoap if unavailable 121 if (!class_exists('nusoap_client')) require_once("nusoap.php"); 122 123 $merchantID = trim($edd_options['merchant']); 94 124 $password = $edd_options['password']; 95 $soapclient = new nusoap_client('https://sep.shaparak.ir/payments/referencepayment.asmx?wsdl','wsdl');125 $soapclient = new nusoap_client('https://sep.shaparak.ir/payments/referencepayment.asmx?wsdl','wsdl'); 96 126 $soapProxy = $soapclient->getProxy() ; 97 127 $amount = $soapProxy->VerifyTransaction($RefNum,$merchantID); 98 if (($amount > 0) AND ($State=='OK')) { 128 129 if (($amount > 0) && ($State == 'OK')) { 99 130 if($amount == $_SESSION['saman_payment']) { 100 131 unset($_SESSION['saman_payment']); … … 112 143 } 113 144 } 145 146 //Check if status failed update payment status 114 147 if($output[status]==0){ 115 148 edd_update_payment_status(sanitize_text_field( $_POST['ResNum'] ), 'failed'); … … 120 153 } 121 154 } 122 add_action('init', ' samanverify');155 add_action('init', 'pj_eddSaman_verify_payment'); 123 156 124 function samanadd_settings($settings) {157 function pj_eddSaman_add_settings($settings) { 125 158 $saman_settings = array ( 126 159 array ( 127 160 'id' => 'saman_settings', 128 'name' => __('<strong>Saman Setting</strong>', 'saman_edd'),129 'desc' => __('Setting SamanBank', 'saman_edd'),161 'name' => '<strong>'.__('Saman Setting', 'saman_edd').'</strong>', 162 'desc' => __('Setting for Saman Bank, Should get from Bank', 'saman_edd'), 130 163 'type' => 'header' 131 164 ), … … 147 180 return array_merge( $settings, $saman_settings ); 148 181 } 149 add_filter('edd_settings_gateways', 'samanadd_settings'); 182 add_filter('edd_settings_gateways', 'pj_eddSaman_add_settings'); 183 150 184 ?> -
bank-saman-edd-gateway/trunk/langs/saman_edd-fa_IR.po
r1573914 r1945463 2 2 msgstr "" 3 3 "Project-Id-Version: Bank Saman EDD gateway\n" 4 "POT-Creation-Date: 201 6-11-13 20:31+0330\n"5 "PO-Revision-Date: 201 6-11-13 20:33+0330\n"4 "POT-Creation-Date: 2018-09-23 10:44+0330\n" 5 "PO-Revision-Date: 2018-09-23 10:45+0330\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 1.8. 11\n"12 "X-Generator: Poedit 1.8.7\n" 13 13 "X-Poedit-Basepath: ..\n" 14 "X-Poedit-WPHeader: edd-saman.php\n"14 "X-Poedit-WPHeader: bank-saman-edd-gateway.php\n" 15 15 "Plural-Forms: nplurals=1; plural=0;\n" 16 16 "X-Poedit-SourceCharset: UTF-8\n" 17 17 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" 18 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c; "19 "_n _noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"18 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" 19 "_nx_noop:3c,1,2;__ngettext_noop:1,2\n" 20 20 "X-Poedit-SearchPath-0: .\n" 21 21 "X-Poedit-SearchPathExcluded-0: *.js\n" 22 22 23 #: edd-saman.php:26 24 msgid "Settings" 25 msgstr "تنظیمات" 26 27 #: edd-saman.php:36 23 #: bank-saman-edd-gateway.php:29 28 24 msgid "RIAL" 29 25 msgstr "ریال" 30 26 31 #: edd-saman.php:4227 #: bank-saman-edd-gateway.php:37 32 28 msgid "Saman Gateway" 33 29 msgstr "درگاه پرداخت سامان" 34 30 35 #: edd-saman.php:4236 msgid " Pay withsaman gateway"37 msgstr " پرداخت با درگاه بانکسامان"31 #: bank-saman-edd-gateway.php:38 32 msgid "Do transactions with bank saman gateway" 33 msgstr "انجام تراکنش های آنلاین با درگاه بانکی سامان" 38 34 39 #: edd-saman.php:8435 #: bank-saman-edd-gateway.php:91 40 36 msgid "If you have not redirected click here" 41 msgstr " در صورتی عدم انتقال اینجا کلیک کنید"37 msgstr "اگر به صورت خودکار منتقل نشدید اینجا کلیک کنید." 42 38 43 #: edd-saman.php:15044 msgid " <strong>Saman Setting</strong>"39 #: bank-saman-edd-gateway.php:162 40 msgid "Saman Setting" 45 41 msgstr "تنظیمات بانک سامان" 46 42 47 #: edd-saman.php:15148 msgid "Setting SamanBank"49 msgstr " پیکربندی درگاه پرداخت بانک سامان"43 #: bank-saman-edd-gateway.php:163 44 msgid "Setting for Saman Bank, Should get from Bank" 45 msgstr "تنظیمات درگاه بانک سامان. (کلیه این اطلاعات میبایست از بانک تهیه شود)" 50 46 51 #: edd-saman.php:15647 #: bank-saman-edd-gateway.php:168 52 48 msgid "Merchant code" 53 msgstr " کد پزیرنده"49 msgstr "شناسه مرچنت" 54 50 55 #: edd-saman.php:16351 #: bank-saman-edd-gateway.php:175 56 52 msgid "Merchant pass" 57 msgstr "رمز پذیرنده"53 msgstr "رمزعبور مرچنت" 58 54 59 55 #. Plugin Name of the plugin/theme 60 56 msgid "Bank Saman EDD gateway" 61 msgstr "درگاه پرداخت بانک سامان برای EDD"57 msgstr "درگاه پرداخت سامان برای Easy Digital Downloads" 62 58 63 59 #. Plugin URI of the plugin/theme 64 60 msgid "http://pamjad.me/saman-getway-edd" 65 msgstr " http://pamjad.me/saman-getway-edd"61 msgstr "https://pamjad.me/saman-getway-edd" 66 62 67 63 #. Description of the plugin/theme 68 64 msgid "Add Bank Saman gateway to easy digital downloads" 69 msgstr "افزودن درگاه پرداخت بانک سامان به افزونه دانلود در ازای پرداخت"65 msgstr "افزودن درگاه پرداخت بانک سامان به افزونه دانلود در ازای پرداخت (EDD)" 70 66 71 67 #. Author of the plugin/theme … … 75 71 #. Author URI of the plugin/theme 76 72 msgid "http://pamjad.me" 77 msgstr "http://pamjad.me" 73 msgstr "https://pamjad.me" 74 75 #~ msgid "<strong>Saman Setting</strong>" 76 #~ msgstr "<strong>Saman Setting</strong>" -
bank-saman-edd-gateway/trunk/readme.txt
r1590129 r1945463 5 5 Donate link: http://pamjad.me/donate 6 6 Tags: easy digital downloads,EDD gateways,persian banks 7 Requires at least: 3.08 Tested up to: 4. 7.27 Requires at least: 4.0 8 Tested up to: 4.9.8 9 9 Stable tag: 4.1 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html 12 12 13 Add Bank Saman gateway to easy digital downloads13 Add Bank Saman payment gateway to easy digital downloads transactions 14 14 15 15 == Description == … … 22 22 * Change currency "RIAL" to "ریال" in persian language. 23 23 * Without any advertising. 24 * Support Test Mode 24 25 25 26 Language Support: … … 27 28 * Persian 28 29 * English 30 * Arabic 29 31 30 32 NOTE : before install this plugin, you should installed [Easy Digital Downloads](https://wordpress.org/plugins/easy-digital-downloads/ "Easy Digital Downloads") … … 40 42 2. English Payement gateways setting. 41 43 44 == Donations == 45 You can Donate plugin author here http://pamjad.me/donate 46 42 47 == Changelog == 43 48 44 = 1.1=45 * Now redirect to bank directly.49 = 2.0 = 50 *Release Date - 23 September 2018* 46 51 47 == Donations == 48 You can Donate plugin author here http://pamjad.me/donate 52 * Fixing redirect problem. 53 * Added Test Mode Support. 54 * Rewrite functions from first 55 * Added Arabic Language
Note: See TracChangeset
for help on using the changeset viewer.