Changeset 1721436
- Timestamp:
- 08/29/2017 06:42:20 PM (8 years ago)
- Location:
- camptix-kdcpay-gateway/trunk
- Files:
-
- 3 edited
-
camptix-kdcpay.php (modified) (2 diffs)
-
classes/class-camptix-payment-method-kdcpay.php (modified) (17 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
camptix-kdcpay-gateway/trunk/camptix-kdcpay.php
r1708153 r1721436 6 6 * Author: _KDC-Labs 7 7 * Author URI: http://www.kdclabs.com/ 8 * Version: 1. 4.58 * Version: 1.5.0 9 9 * License: GPLv2 or later 10 * Text Doomain: kdcpay 10 * Text Domain: camptix-kdcpay 11 * Domain Path: /languages 12 * GitHub Plugin URI: https://github.com/kdclabs/camptix-kdcpay-gateway 11 13 */ 12 14 13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. 14 16 15 // Add INR currency 17 // Load Plugin Text Domain. 18 add_action( 'init', 'camptix_kdcpay_load_textdomain' ); 19 function camptix_kdcpay_load_textdomain() { 20 load_plugin_textdomain( 'camptix-kdcpay', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 21 } 22 23 // Add INR currency. 16 24 add_filter( 'camptix_currencies', 'camptix_kdcpay_add_inr_currency' ); 17 25 function camptix_kdcpay_add_inr_currency( $currencies ) { 18 if ( ! $currencies['INR']) {26 if ( ! array_key_exists( 'INR',$currencies ) ) { 19 27 $currencies['INR'] = array( 20 'label' => __( 'Indian Rupees', ' kdcpay' ),28 'label' => __( 'Indian Rupees', 'camptix-kdcpay' ), 21 29 'format' => '₹ %s', 22 30 ); 23 31 } 24 if ( ! $currencies['LKR']) {32 if ( ! array_key_exists( 'LKR',$currencies ) ) { 25 33 $currencies['LKR'] = array( 26 'label' => __( 'Sri Lankan Rupees', ' kdcpay' ),34 'label' => __( 'Sri Lankan Rupees', 'camptix-kdcpay' ), 27 35 'format' => 'රු %s', 28 36 ); … … 38 46 camptix_register_addon( 'CampTix_Payment_Method_KDCpay' ); 39 47 } 40 41 ?> -
camptix-kdcpay-gateway/trunk/classes/class-camptix-payment-method-kdcpay.php
r1708151 r1721436 1 1 <?php 2 3 2 /** 4 3 * CampTix KDCpay Payment Method … … 42 41 add_action( 'template_redirect', array( $this, 'template_redirect' ) ); 43 42 } 44 43 45 44 /** 46 45 * CampTix fields in the settings section for entering the Payment Credentials 47 46 */ 48 47 function payment_settings_fields() { 49 $this->add_settings_field_helper( 'payment_url', 'Payment URL', array( $this, 'field_text' ) );50 $this->add_settings_field_helper( 'merchant_id', 'Merchant ID', array( $this, 'field_text' ) );51 $this->add_settings_field_helper( 'merchant_key', 'Merchant Key', array( $this, 'field_text' ) );52 $this->add_settings_field_helper( 'attendee_mobile_id', __( 'Mobile Field ID', ' kdcpay' ), array( $this, 'field_text' ), __( "To obtain the ID, view the form's source code and look for input name: `tix_attendee_questions[1][###]` correspondng to your Mobile field question. ### = Filed ID", 'kdcpay') );53 $this->add_settings_field_helper( 'iframe', __( 'Show in iFrame', ' kdcpay' ), array( $this, 'field_yesno' ),54 __( "Yes = The payment form will loaded on next page | No = Page will be Redirected.", ' kdcpay' )48 $this->add_settings_field_helper( 'payment_url', __( 'Payment URL', 'camptix-kdcpay' ), array( $this, 'field_text' ) ); 49 $this->add_settings_field_helper( 'merchant_id', __( 'Merchant ID', 'camptix-kdcpay' ), array( $this, 'field_text' ) ); 50 $this->add_settings_field_helper( 'merchant_key', __( 'Merchant Key', 'camptix-kdcpay' ), array( $this, 'field_text' ) ); 51 $this->add_settings_field_helper( 'attendee_mobile_id', __( 'Mobile Field ID', 'camptix-kdcpay' ), array( $this, 'field_text' ), __( "To obtain the ID, view the form's source code and look for input name: `tix_attendee_questions[1][###]` correspondng to your Mobile field question. ### = Filed ID", 'camptix-kdcpay') ); 52 $this->add_settings_field_helper( 'iframe', __( 'Show in iFrame', 'camptix-kdcpay' ), array( $this, 'field_yesno' ), 53 __( "Yes = The payment form will loaded on next page | No = Page will be Redirected.", 'camptix-kdcpay' ) 55 54 ); 56 $this->add_settings_field_helper( 'sandbox', __( 'Sandbox Mode', ' kdcpay' ), array( $this, 'field_yesno' ),57 __( "The KDCpay Sandbox is a way to test payments without using real accounts and transactions. When enabled it will use sandbox merchant details instead of the ones defined above.", ' kdcpay' )55 $this->add_settings_field_helper( 'sandbox', __( 'Sandbox Mode', 'camptix-kdcpay' ), array( $this, 'field_yesno' ), 56 __( "The KDCpay Sandbox is a way to test payments without using real accounts and transactions. When enabled it will use sandbox merchant details instead of the ones defined above.", 'camptix-kdcpay' ) 58 57 ); 59 58 } 60 59 61 60 /** 62 61 * CampTix validate the submited options … … 168 167 $this->payment_result( $payment_token, CampTix_Plugin::PAYMENT_STATUS_FAILED ); 169 168 } 170 169 171 170 wp_safe_redirect( esc_url_raw( $url . '#tix' ) ); 172 171 die(); … … 182 181 183 182 if ( ! in_array( $this->camptix_options['currency'], $this->supported_currencies ) ) 184 die( __( 'The selected currency is not supported by this payment method.', ' kdcpay' ) );183 die( __( 'The selected currency is not supported by this payment method.', 'camptix-kdcpay' ) ); 185 184 186 185 $return_url = add_query_arg( array( … … 199 198 'tix_payment_method' => 'camptix_kdcpay', 200 199 ), $this->get_tickets_url() ); 201 200 202 201 $payment_url = $this->options['payment_url']; 203 202 $merchant_id = $this->options['merchant_id']; … … 233 232 foreach ( $attendees as $attendee ) { 234 233 $tix_id = get_post( get_post_meta( $attendee->ID, 'tix_ticket_id', true ) ); 235 234 236 235 // Get Mobile Number 237 236 $attendee_questions = get_post_meta( $attendee->ID, 'tix_questions', true ); // Array of Attendee Questons … … 242 241 } 243 242 244 $attendee_info[] = array( 245 $attendee->ID, 246 get_post_meta( $attendee->ID, 'tix_email', true ), 247 get_post_meta( $attendee->ID, 'tix_first_name', true ), 243 $attendee_info[] = array( 244 $attendee->ID, 245 get_post_meta( $attendee->ID, 'tix_email', true ), 246 get_post_meta( $attendee->ID, 'tix_first_name', true ), 248 247 get_post_meta( $attendee->ID, 'tix_last_name', true ), 249 248 get_post_meta( $attendee->ID, 'tix_ticket_discounted_price', true ), … … 254 253 ); // array(0=id,1=email,2=first_name,3=last_name,4=tix_amount,5=tix_name,6=access_token,7=edit_token,8=mobile); 255 254 } 256 255 257 256 $payload = array( 258 257 'mid' => $merchant_id, // Merchant details … … 269 268 270 269 // For CampTix considering Single and Multiple Tickets as a Single Item | Required to show in the bill on payment page 271 'productDescription' => $event_name, // Text description-1, at least 1 item is mandatory 270 'productDescription' => $event_name, // Text description-1, at least 1 item is mandatory 272 271 'productAmount' => $order_total, // Amount specific to the item-1 273 'productQuantity' => '1', // Quntity specific to the item-1 272 'productQuantity' => '1', // Quntity specific to the item-1 274 273 275 274 'txnDate' => date( 'Y-m-d', time() + ( 60 * 60 * 5.5 ) ), // Date in IST (Indian Standard Time) 276 275 'udf1' => $payment_token, // Used by CampTix to associate with the present order (can not use `orderId` as only 20 charachters allowed) 277 'udf2' => $tix_quantity, // CAMPTIX : TIX->Quantity 276 'udf2' => $tix_quantity, // CAMPTIX : TIX->Quantity 278 277 'udf3' => json_encode( $attendee_info ), // CAMPTIX : Attendee->INFO 279 278 'app' => 'camptix', // CAMPTIX 280 279 'callBack' => '0' // Allow to remotely inform CampTix via `Notify URL` 281 280 ); 282 281 283 282 if ( $this->options['iframe'] ) { 284 283 $payload['display'] = 'iframe'; … … 286 285 $payload['display'] = 'redirect'; 287 286 } 288 287 289 288 if ( $this->options['sandbox'] ) { 290 289 $payload['mode'] = '0'; // DEMO … … 294 293 295 294 $payload['checksum'] = kdcpay_verify_payload( $secret_key, $payload, 'checkout' ); 296 295 297 296 $kdcpay_args_array = array(); 298 297 foreach ( $payload as $key => $value ) { … … 301 300 302 301 if ( $this->options['iframe'] ) { 303 302 304 303 $kdcpay_checkout_button = ''; 305 304 $kdcpay_checkout_target = ' target="kdcpay_payment_frame"'; … … 308 307 jQuery(document).ready(function(){ 309 308 window.addEventListener(\'message\', function(e) { 310 jQuery("#kdcpay_payment_frame").css("height",e.data[\'newHeight\']+\'px\'); 309 jQuery("#kdcpay_payment_frame").css("height",e.data[\'newHeight\']+\'px\'); 311 310 }, false); 312 311 }); … … 318 317 $kdcpay_checkout_button = '<p>Redirecting you to the Payment Page</p><input type="submit" value="Continue Now!" />'; 319 318 $kdcpay_checkout_iframe = ''; 320 321 } 322 319 320 } 321 323 322 $kdcpay_checkout = '<div id="tix"> 324 323 <form action="' . esc_url($payment_url) . '" method="post" id="kdcpay_payment_form"' . $kdcpay_checkout_target . '> … … 331 330 </script> 332 331 </div>'; 333 332 334 333 return $kdcpay_checkout; 335 334 } … … 364 363 $checksum_allowed_parameters = array( 'status', 'orderId', 'responseCode', 'responseDescription', 'amount', 'trackId', 'pgId', 'bankId', 'paidBy' ); 365 364 } 366 365 367 366 // Create a string to calculate Checksum Value 368 367 $check_parameters = ''; … … 378 377 } 379 378 } 380 379 381 380 return kdcpay_calculate_checksum( $check_parameters, $secret_key ); 382 381 } -
camptix-kdcpay-gateway/trunk/readme.txt
r1708153 r1721436 1 1 === CampTix KDCpay Payments === 2 Contributors: kdclabs, vachan 2 Contributors: kdclabs, vachan, ajitbohra 3 3 Donate link: http://www.kdclabs.com/donate/ 4 4 Tags: camptix, kdcpay 5 5 Requires at least: 3.5 6 6 Tested up to: 4.8.1 7 Stable tag: 1. 4.57 Stable tag: 1.5.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 32 32 33 33 == Changelog == 34 35 = 1.5.0 = 36 * Added: Internationlization (@ajitbohra) 37 * Fixed: Debug=ON Errors (@ajitbohra) 34 38 35 39 = 1.4.5 =
Note: See TracChangeset
for help on using the changeset viewer.