Changeset 2940706
- Timestamp:
- 07/20/2023 08:51:16 AM (3 years ago)
- Location:
- binance-pay/trunk
- Files:
-
- 2 edited
-
class-wc-gateway-binancepay.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
binance-pay/trunk/class-wc-gateway-binancepay.php
r2900971 r2940706 37 37 $this->has_fields = false; 38 38 $this->method_title = 'Binance Pay'; 39 $this->icon = apply_filters('woocommerce_binance_pay_icon', plugins_url('/assets/binance-logo.svg', __FILE__));39 $this->icon = apply_filters('woocommerce_binance_pay_icon', plugins_url('/assets/binance-logo.svg', __FILE__)); 40 40 $this->method_description = 'A payment gateway that sends your customers to Binance to pay with cryptocurrency.'; 41 41 … … 47 47 $this->api_key = $this->get_option('api_key'); 48 48 $this->secret_key = $this->get_option('secret_key'); 49 $this->transaction_currency = $this->get_option('transaction_currency'); 49 50 50 51 add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); … … 69 70 'title' => 'Secret Key', 70 71 'type' => 'password', 72 ), 73 'transaction_currency' => array( 74 'title' => 'Currency', 75 'type' => 'select', 76 'class' => 'wc-enhanced-select', 77 'description' => 'This is the currency used to create order in Binance Pay. With fiat selection, your customers will pay you with equivalent USDT, and your settlement currency will be in USDT as well.', 'woocommerce', 78 'default' => '', 79 'desc_tip' => true, 80 'custom_attributes' => array('required' => 'required'), 81 'options' => array( 82 'BUSD' => 'BUSD', 83 'USDT' => 'USDT', 84 'USD' => 'USD', 85 'EUR' => 'EUR', 86 'CHF' => 'CHF', 87 'GBP' => 'GBP', 88 'ARS' => 'ARS', 89 'CNY' => 'CNY', 90 'HKD' => 'HKD', 91 'NGN' => 'NGN', 92 ), 71 93 ) 72 94 ); … … 131 153 $req = array( 132 154 'env' => array('terminalType' => 'WEB'), 133 'merchantTradeNo' => $order_id, 134 'orderAmount' => $order->get_total(), 135 'currency' => 'BUSD'); 155 'merchantTradeNo' => $order_id 156 ); 157 $currency = $this->transaction_currency; 158 if (empty($currency)) { 159 $currency = 'BUSD'; 160 } 161 if ($currency == 'BUSD' || $currency == 'USDT') { 162 $req['orderAmount'] = $order->get_total(); 163 $req['currency'] = $currency; 164 } else { 165 $req['fiatAmount'] = $order->get_total(); 166 $req['fiatCurrency'] = $currency; 167 } 136 168 $req['goods'] = array(); 137 169 $req['passThroughInfo'] = "wooCommerce-1.0"; … … 173 205 ); 174 206 $args = array( 175 'body' => json_encode($req),176 'timeout' => '60',207 'body' => json_encode($req), 208 'timeout' => '60', 177 209 'redirection' => '8', 178 210 'httpversion' => '1.0', 179 'blocking' => true,180 'headers' => $headers,181 'cookies' => array(),182 ); 183 $response = wp_remote_post( $this->api_path . 'v2/order', $args);211 'blocking' => true, 212 'headers' => $headers, 213 'cookies' => array(), 214 ); 215 $response = wp_remote_post($this->api_path . 'v2/order', $args); 184 216 $responseBody = wp_remote_retrieve_body($response); 185 217 error_log("binance response " . $responseBody); -
binance-pay/trunk/readme.txt
r2919963 r2940706 5 5 Tested up to: 6.2 6 6 Requires PHP: 5.6 7 Stable tag: 1. 0.37 Stable tag: 1.1.0 8 8 License: Apache License, Version 2.0 9 9 License URI: http://www.apache.org/licenses/LICENSE-2.0 … … 50 50 = 1.0.3 = 51 51 * Update readme.txt 52 = 1.1.0 = 53 * Support the configuration of fiat currency, with fiat selection, your customers will pay you with equivalent USDT, and your settlement currency will be in USDT as well.
Note: See TracChangeset
for help on using the changeset viewer.