Plugin Directory

Changeset 2763581

Timestamp:
07/29/2022 04:36:14 PM (2 years ago)
Author:
hkblab
Message:
  • Security improved
  • Assets update
  • In the gateway settings there is a new field created for the API Base URL
  • Currency support for SRD, USD and EURO
Location:
mope-payment-gateway-for-woocommerce
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mope-payment-gateway-for-woocommerce/trunk/README.md

    r2763144 r2763581  
    1313- Then, click on `manage` to customize the gateway and provide your API keys
    1414
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
    1533## Bugs & Feature requests
    1634If 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  
    11<?php
     2
     3
     4
     5
    26
    37/*
     
    3640        {
    3741            $this->id = 'mope';
    38             $this->mope_api_base_url = "https://api.mope.sr/api/";
     42            $this->mope_api_base_url =
    3943            $this->icon = esc_url(plugins_url('assets/mope_logo.png', __FILE__));
    4044            $this->has_fields = true;
     
    4953
    5054            $this->init_settings();
    51             $this->title = $this->get_option('title');
    52             $this->description = $this->get_option('description');
     55            $this->title = );
     56            $this->description = );
    5357            $this->enabled = $this->get_option('enabled');
    5458            $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 = );
    5761            $this->custom_wc_request_config = array(
    5862                'timeout' => 5,
     
    6064                    'User-Agent' => 'Mopé Php Client',
    6165                    'Content-Type' => 'application/json',
    62                     'Authorization' => 'Bearer ' . $this->mope_api_key
     66                    'Authorization' => 'Bearer ' .
    6367                )
    6468            );
     
    7781                    'label' => 'Enable/disable Mopé Payment Gateway',
    7882                    'type' => 'checkbox',
    79                     'description' => 'Make this payment method available to your users.',
     83                    'description' => 'Make this payment method available to your users.',
    8084                    'default' => 'no'
    8185                ),
    8286                'title' => array(
    83                     'title' => 'Title',
     87                    'title' => 'itle',
    8488                    'type' => 'text',
    8589                    'description' => 'Title for this payment method displayed at checkout.',
     
    9397                    'default' => 'Pay quickly and securely with your Mopé Mobile wallet.',
    9498                ),
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
    95109                'test_mode' => array(
    96110                    'title' => 'Test mode',
    97111                    'label' => 'Enable Test Mode',
    98112                    'type' => 'checkbox',
    99                     'description' => '',
    100                     'default' => 'yes',
     113                    'description' => '',
     114                    'default' => '',
    101115                    'desc_tip' => true,
    102116                ),
    103117                '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',
    110120                ),
    111121                'transaction_description' => array(
    112122                    'title' => 'Transaction Description',
    113123                    'type' => 'text',
    114                     'default' => site_url(),
     124                    'default' => ),
    115125                    'description' => 'Text that will be used to describe the transaction in a buyers Mopé Wallet',
    116126                )
     
    126136            $order_total_formatted = number_format($order_total1, 2, '', '');
    127137
    128             # use ?wc-api=callback because it works with all permalink setups
    129             # https://github.com/woocommerce/woocommerce/issues/23142#issuecomment-476604300
    130138            $returnURL = site_url() . '?wc-api=mope&order_id=' . $order_id;
    131139
     
    134142                'amount' => $order_total_formatted,
    135143                'order_id' => $order_id,
    136                 'currency' => 'SRD',
     144                'currency' => ,
    137145                'redirect_url' => $returnURL
    138146            );
     
    140148            $data_string = json_encode($data);
    141149            $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);
    143151            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
    145155                return array(
    146156                    'result' => 'error',
     
    148158                );
    149159            }
    150 
     160            $response_body = wp_remote_retrieve_body( $response );
    151161            $response_status = wp_remote_retrieve_response_code($response);
    152162            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');
    154164                return array(
    155165                    'result' => 'error',
     
    191201            }
    192202
    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);
    194204            $response_status = wp_remote_retrieve_response_code($response);
    195205
     
    222232            wc_add_notice('Unable to process your payment. Please try again.', 'error');
    223233            $this->redirect_to_cart();
    224         }
     234        }
    225235    }
    226236}
  • mope-payment-gateway-for-woocommerce/trunk/readme.txt

    r2763144 r2763581  
    11=== Mopé Payment Gateway ===
    22Contributors: Vokality
    3 Tags: woocommerce, Hakrinbank,mope, webshop, mope payment, Suriname mope,suriname
     3Tags: , Hakrinbank,mope, webshop, mope payment, Suriname mope,suriname
    44Author: Plauto Rafael De Moura Da Silva <rafael.demoura@hakrinbank.com>
    55Requires at least: 5.1
    6 Tested up to: 5.0.0
     6Tested up to:
    77Requires PHP: 7.2
    8 Stable tag: 2.0.1
     8Stable tag: 2.0.
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1515
    1616# Mopé Payment Gateway for WooCommerce
    17 Seamlessly accept payments from any Mopé wallet on your web shop.
     17Seamlessly accept payments from any Mopé wallet on your web shop.
    1818
    1919## Requirements
     
    2424
    2525## 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
    2831
    2932
     
    3538## Manual installation
    3639
    37 1. Upload `mope.php` to the `/wp-content/plugins/` directory
    38 2. Activate the plugin through the 'Plugins' menu in WordPress
     401. Download the plugin
     412. Extra the content of mope-payment-gateway-for-woocommerce.zip
     423. Upload the extracted  mope-payment-gateway-for-woocommerce folder (folder containing all plugin files) to the `/wp-content/plugins/` directory
     432. Activate the plugin through the 'Plugins' menu in your WordPress Dashboard
    39443. 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 keys
     454. Then, click on `
    4146
    4247
     
    4853== Changelog ==
    4954
     55
     56
     57
     58
     59
     60
    5061= 2.0.1 =
    5162* Assets update
    52 
    5363
    5464= 2.0.0 =
     
    7484
    7585== Upgrade Notice ==
     86
     87
     88
     89
     90
     91
    7692
    7793= 2.0.1 =
Note: See TracChangeset for help on using the changeset viewer.