Changeset 3219597
- Timestamp:
- 01/09/2025 11:55:59 AM (13 months ago)
- Location:
- arca-payment-gateway/trunk
- Files:
-
- 4 edited
-
arca-payment-gateway.php (modified) (2 diffs)
-
includes/apg-orders.php (modified) (2 diffs)
-
includes/apg_REFUND.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
arca-payment-gateway/trunk/arca-payment-gateway.php
r3214804 r3219597 3 3 * Plugin Name: ArCa Payment Gateway 4 4 * Description: ArCa payment gateway, this Plugin allows you to accept online payments from local and international customers to Armenian banks, Idram payment system and adds ArCa paycenter as a payment gateway for WooCommerce and for GiveWP donation Plugin and TATIOSA hotel booking management platform. 5 * Version: 1. 3.95 * Version: 1.4.0 6 6 * Author: Planet Studio team 7 7 * Author URI: https://planetstudio.am … … 14 14 define('ARCAPG_DIR_NAME', dirname(plugin_basename( __FILE__ ))); 15 15 define('ARCAPG_URL', plugins_url(plugin_basename(dirname(__FILE__)))); 16 define('ARCAPG_VERSION', '1. 3.9');16 define('ARCAPG_VERSION', '1.4.0'); 17 17 define('ARCAPG_PRO', FALSE); 18 18 define('ARCAPG_DELETE_DATA_ACTIONS', false); -
arca-payment-gateway/trunk/includes/apg-orders.php
r3214804 r3219597 199 199 200 200 <a class="button" onclick="return apg_confirmAction();" href="<?php echo esc_url("?page=orderlog&act=refundPayment&rest_serverID=$rest_serverID&p=$p&orderId=$row->orderId"); apg_wp_nonce_arg(); ?>">Refund</a> 201 <?php if ( $arca_config->bankId == '10' ) { ?>201 <?php if ( $arca_config->bankId != '12' ) { ?> 202 202 <a class="button" onclick="return apg_confirmAction();" href="<?php echo esc_url("?page=orderlog&act=cancelPayment&rest_serverID=$rest_serverID&p=$p&orderId=$row->orderId"); apg_wp_nonce_arg(); ?>">Cancel</a> 203 203 <?php } ?> … … 206 206 207 207 <a class="button disabled">Refund</a> 208 <?php if ( $arca_config->bankId == '10' ) { ?>208 <?php if ( $arca_config->bankId != '12' ) { ?> 209 209 <a class="button disabled">Cancel</a> 210 210 <?php } ?> -
arca-payment-gateway/trunk/includes/apg_REFUND.php
r3214804 r3219597 72 72 default: 73 73 // ArCa API 74 return 'No action found for this operation.';74 return $this->cancelPayment_ArCa($orderId); 75 75 break; 76 76 } … … 320 320 'password' => $this->apg_vpos_accuonts[$result->currency]["api_password"], 321 321 'orderId' => $result->orderId, 322 'amount' => $result->amount ,322 'amount' => $result->amount * 100, 323 323 'currency' => $result->currency, 324 324 'language' => 'en', … … 374 374 } 375 375 376 private function cancelPayment_ArCa($orderId) 377 { 378 global $wpdb; 379 380 $orderId = sanitize_text_field( $orderId ?? null() ); 381 382 $table_name = $wpdb->prefix . 'arca_pg_orders'; 383 $query = $wpdb->prepare( 384 "SELECT * FROM $table_name where orderId = %s", 385 $orderId, 386 ); 387 $result = $wpdb->get_row($query); 388 389 // REST - order refound request 390 $requestUrl = "https://ipay". APG_URL_IF_TEST_MODE .".arca.am:". APG_PORT_IF_TEST_MODE ."/payment/rest/reverse.do"; 391 $args = array( 392 'headers' => array('Content-Type: text/html; charset=UTF-8'), 393 'body' => array( 394 'userName' => $this->apg_vpos_accuonts[$result->currency]["api_userName"], 395 'password' => $this->apg_vpos_accuonts[$result->currency]["api_password"], 396 'orderId' => $result->orderId, 397 'amount' => $result->amount * 100, 398 'currency' => $result->currency, 399 'language' => 'en', 400 ), 401 'method' => 'POST', 402 'data_format' => 'body', 403 ); 404 $response = wp_remote_post( $requestUrl, $args ); 405 406 407 if( is_object($response) ){ 408 $this->arca_pg_errorCatch("REST respons error: " . json_encode($response, JSON_UNESCAPED_UNICODE), $wc_orderId, $gwp_donationId); 409 } else { 410 $response = json_decode($response['body']); 411 } 412 413 // check REST response to JSON format 414 if (is_object($response) && isset($response->errorCode)) { 415 416 if ($response->errorCode == 0) { 417 418 // get previous stored response data 419 $OrderStatusExtended = json_decode( $wpdb->get_var("select OrderStatusExtended from " . $wpdb->prefix . "arca_pg_orders where orderId = '$orderId'"), true ); 420 421 // add new response 422 $OrderStatusExtended = array_merge($OrderStatusExtended, array( "Cancelation Response" => $response ) ); 423 424 // json encode 425 $OrderStatusExtended = json_encode( $OrderStatusExtended ); 426 427 // update order response data 428 $sql = "update " . $wpdb->prefix . "arca_pg_orders set OrderStatusExtended = '$OrderStatusExtended', paymentState = 'Canceled' where orderId = '$orderId'"; 429 $wpdb->query($sql); 430 431 // set wc order status 432 if ( $result->wc_orderId ) { 433 $apg_wc_order = wc_get_order($result->wc_orderId); 434 $apg_wc_order->set_status('wc-refunded', 'wc_apg_gatewey'); 435 $apg_wc_order->save(); 436 } 437 438 return "Canceled"; 439 440 } else { 441 $this->arca_pg_errorCatch("Refund - REST respons error: " . sanitize_text_field($response->errorCode)); 442 return "Failed"; 443 } 444 445 } else { 446 $this->arca_pg_errorCatch("Refund - REST response is not JSON data, response: " . sanitize_text_field($response)); 447 return "Failed"; 448 } 449 450 } 451 376 452 private function refundPayment_iDram($orderId) 377 453 { -
arca-payment-gateway/trunk/readme.txt
r3214804 r3219597 5 5 Requires PHP: 7.4 6 6 Tested up to: 6.7.1 7 Stable tag: 1. 3.97 Stable tag: 1.4.0 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 97 97 == Changelog == 98 98 99 = 1.4.0 = 100 *Add cancellation functionality for ArCa 101 99 102 = 1.3.9 = 100 103 *Fixed minor bugs
Note: See TracChangeset
for help on using the changeset viewer.