Plugin Directory

Changeset 3219597


Ignore:
Timestamp:
01/09/2025 11:55:59 AM (13 months ago)
Author:
planetstudio
Message:

Publish new version

Location:
arca-payment-gateway/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • arca-payment-gateway/trunk/arca-payment-gateway.php

    r3214804 r3219597  
    33 * Plugin Name: ArCa Payment Gateway
    44 * 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.9
     5 * Version: 1.4.0
    66 * Author: Planet Studio team
    77 * Author URI: https://planetstudio.am
     
    1414define('ARCAPG_DIR_NAME', dirname(plugin_basename( __FILE__ )));
    1515define('ARCAPG_URL', plugins_url(plugin_basename(dirname(__FILE__))));
    16 define('ARCAPG_VERSION', '1.3.9');
     16define('ARCAPG_VERSION', '1.4.0');
    1717define('ARCAPG_PRO', FALSE);
    1818define('ARCAPG_DELETE_DATA_ACTIONS', false);
  • arca-payment-gateway/trunk/includes/apg-orders.php

    r3214804 r3219597  
    199199
    200200                                <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' ) { ?>
    202202                                    <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>
    203203                                <?php } ?>
     
    206206
    207207                                <a class="button disabled">Refund</a>
    208                                 <?php if ( $arca_config->bankId == '10' ) { ?>
     208                                <?php if ( $arca_config->bankId != '12' ) { ?>
    209209                                    <a class="button disabled">Cancel</a>
    210210                                <?php } ?>
  • arca-payment-gateway/trunk/includes/apg_REFUND.php

    r3214804 r3219597  
    7272            default:
    7373                // ArCa API
    74                 return 'No action found for this operation.';
     74                return $this->cancelPayment_ArCa($orderId);
    7575                break;
    7676        }
     
    320320                'password'  => $this->apg_vpos_accuonts[$result->currency]["api_password"],
    321321                'orderId'   => $result->orderId,
    322                 'amount'    => $result->amount,
     322                'amount'    => $result->amount * 100,
    323323                'currency'  => $result->currency,
    324324                'language'  => 'en',
     
    374374    }
    375375
     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
    376452    private function refundPayment_iDram($orderId)
    377453    {
  • arca-payment-gateway/trunk/readme.txt

    r3214804 r3219597  
    55Requires PHP: 7.4
    66Tested up to: 6.7.1
    7 Stable tag: 1.3.9
     7Stable tag: 1.4.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    9797== Changelog ==
    9898
     99= 1.4.0 =
     100*Add cancellation functionality for ArCa
     101
    99102= 1.3.9 =
    100103*Fixed minor bugs
Note: See TracChangeset for help on using the changeset viewer.