Changeset 2763581
- Timestamp:
- 07/29/2022 04:36:14 PM (2 years ago)
- Location:
- mope-payment-gateway-for-woocommerce
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
mope-payment-gateway-for-woocommerce/trunk/README.md
r2763144 r2763581 13 13 - Then, click on `manage` to customize the gateway and provide your API keys 14 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 15 33 ## Bugs & Feature requests 16 34 If you've found a bug or have a feature request, you can create an [issue](https://github.com/HKBLab/mope/issues) -
mope-payment-gateway-for-woocommerce/trunk/mope.php
r2763149 r2763581 1 1 <?php 2 3 4 5 2 6 3 7 /* … … 36 40 { 37 41 $this->id = 'mope'; 38 $this->mope_api_base_url = "https://api.mope.sr/api/";42 $this->mope_api_base_url = 39 43 $this->icon = esc_url(plugins_url('assets/mope_logo.png', __FILE__)); 40 44 $this->has_fields = true; … … 49 53 50 54 $this->init_settings(); 51 $this->title = $this->get_option('title');52 $this->description = $this->get_option('description');55 $this->title = ); 56 $this->description = ); 53 57 $this->enabled = $this->get_option('enabled'); 54 58 $this->test_mode = 'yes' === $this->get_option('test_mode'); 55 $this->mope_api_key = $this->test_mode ? $this->get_option('test_private_key') : $this->get_option('private_key');56 $this->transaction_description = $this->get_option('transaction_description');59 $this->mope_api_key = $this->test_mode ? ); 60 $this->transaction_description = ); 57 61 $this->custom_wc_request_config = array( 58 62 'timeout' => 5, … … 60 64 'User-Agent' => 'Mopé Php Client', 61 65 'Content-Type' => 'application/json', 62 'Authorization' => 'Bearer ' . $this->mope_api_key66 'Authorization' => 'Bearer ' . 63 67 ) 64 68 ); … … 77 81 'label' => 'Enable/disable Mopé Payment Gateway', 78 82 'type' => 'checkbox', 79 'description' => 'Make this payment method available to your users. ',83 'description' => 'Make this payment method available to your users.', 80 84 'default' => 'no' 81 85 ), 82 86 'title' => array( 83 'title' => ' Title',87 'title' => 'itle', 84 88 'type' => 'text', 85 89 'description' => 'Title for this payment method displayed at checkout.', … … 93 97 'default' => 'Pay quickly and securely with your Mopé Mobile wallet.', 94 98 ), 99 100 101 102 103 104 105 106 107 108 95 109 'test_mode' => array( 96 110 'title' => 'Test mode', 97 111 'label' => 'Enable Test Mode', 98 112 'type' => 'checkbox', 99 'description' => ' ',100 'default' => ' yes',113 'description' => '', 114 'default' => '', 101 115 'desc_tip' => true, 102 116 ), 103 117 'test_private_key' => array( 104 'title' => 'Test Mopé Key', 105 'type' => 'password', 106 ), 107 'private_key' => array( 108 'title' => 'Live Mopé Key', 109 'type' => 'password' 118 'title' => 'Test Mopé Token Key', 119 'type' => 'text', 110 120 ), 111 121 'transaction_description' => array( 112 122 'title' => 'Transaction Description', 113 123 'type' => 'text', 114 'default' => site_url(),124 'default' => ), 115 125 'description' => 'Text that will be used to describe the transaction in a buyers Mopé Wallet', 116 126 ) … … 126 136 $order_total_formatted = number_format($order_total1, 2, '', ''); 127 137 128 # use ?wc-api=callback because it works with all permalink setups129 # https://github.com/woocommerce/woocommerce/issues/23142#issuecomment-476604300130 138 $returnURL = site_url() . '?wc-api=mope&order_id=' . $order_id; 131 139 … … 134 142 'amount' => $order_total_formatted, 135 143 'order_id' => $order_id, 136 'currency' => 'SRD',144 'currency' => , 137 145 'redirect_url' => $returnURL 138 146 ); … … 140 148 $data_string = json_encode($data); 141 149 $post_data = array_merge(array('body' => $data_string), $this->custom_wc_request_config); 142 $response = wp_remote_post($this->mope_api_base_url . ' shop/payment_request', $post_data);150 $response = wp_remote_post($this->mope_api_base_url . 'shop/payment_request', $post_data); 143 151 if (is_wp_error($response)) { 144 wc_add_notice("An unexpected error has occurred.", 'error'); 152 wc_add_notice("We're sorry, an unexpected error has occurred. Please try again later.:", 'error'); 153 154 145 155 return array( 146 156 'result' => 'error', … … 148 158 ); 149 159 } 150 160 $response_body = wp_remote_retrieve_body( $response ); 151 161 $response_status = wp_remote_retrieve_response_code($response); 152 162 if (intval($response_status) != 201) { 153 wc_add_notice("An error occurred communicating with Mopé. Please try again later .", 'error');163 wc_add_notice("An error occurred communicating with Mopé. Please try again later, 'error'); 154 164 return array( 155 165 'result' => 'error', … … 191 201 } 192 202 193 $response = wp_remote_get($this->mope_api_base_url . ' shop/payment_request/' . $payment_id, $this->custom_wc_request_config);203 $response = wp_remote_get($this->mope_api_base_url . 'shop/payment_request/' . $payment_id, $this->custom_wc_request_config); 194 204 $response_status = wp_remote_retrieve_response_code($response); 195 205 … … 222 232 wc_add_notice('Unable to process your payment. Please try again.', 'error'); 223 233 $this->redirect_to_cart(); 224 } 234 } 225 235 } 226 236 } -
mope-payment-gateway-for-woocommerce/trunk/readme.txt
r2763144 r2763581 1 1 === Mopé Payment Gateway === 2 2 Contributors: Vokality 3 Tags: woocommerce, Hakrinbank,mope, webshop, mope payment, Suriname mope,suriname3 Tags: , Hakrinbank,mope, webshop, mope payment, Suriname mope,suriname 4 4 Author: Plauto Rafael De Moura Da Silva <rafael.demoura@hakrinbank.com> 5 5 Requires at least: 5.1 6 Tested up to: 5.0.06 Tested up to: 7 7 Requires PHP: 7.2 8 Stable tag: 2.0. 18 Stable tag: 2.0. 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 16 16 # Mopé Payment Gateway for WooCommerce 17 Seamlessly accept payments from any Mopé wallet on your web shop .17 Seamlessly accept payments from any Mopé wallet on your web shop. 18 18 19 19 ## Requirements … … 24 24 25 25 ## Getting started 26 - Go to `WooCommerce` > `Settings` > `Payments`, then enable `Mopé Payment Gateway` 27 - Click on `manage` to customize the gateway and provide your API keys 26 - Install plugin 27 - Activate the plugin through the 'Plugins' menu in your WordPress Dashboard 28 - Go to WooCommerce > Settings > Payments and enable Mopé Payment Gateway 29 - Then, click on `Manage` to further customize and setup the Mope payment gateway 30 28 31 29 32 … … 35 38 ## Manual installation 36 39 37 1. Upload `mope.php` to the `/wp-content/plugins/` directory 38 2. Activate the plugin through the 'Plugins' menu in WordPress 40 1. Download the plugin 41 2. Extra the content of mope-payment-gateway-for-woocommerce.zip 42 3. Upload the extracted mope-payment-gateway-for-woocommerce folder (folder containing all plugin files) to the `/wp-content/plugins/` directory 43 2. Activate the plugin through the 'Plugins' menu in your WordPress Dashboard 39 44 3. Go to WooCommerce > Settings > Payments and enable Mopé Payment Gateway 40 4. Then, click on ` manage` to add customize the gateway and provide your API keys45 4. Then, click on ` 41 46 42 47 … … 48 53 == Changelog == 49 54 55 56 57 58 59 60 50 61 = 2.0.1 = 51 62 * Assets update 52 53 63 54 64 = 2.0.0 = … … 74 84 75 85 == Upgrade Notice == 86 87 88 89 90 91 76 92 77 93 = 2.0.1 =
Note: See TracChangeset
for help on using the changeset viewer.