Skip to content

Commit

Permalink
Merge pull request #18 from alexminza/v1.2.1
Browse files Browse the repository at this point in the history
v1.2.1
  • Loading branch information
alexminza authored Jun 27, 2021
2 parents 604854c + 355e9df commit 3fe610b
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 285 deletions.
Binary file modified languages/wc-moldovaagroindbank-ro_RO.mo
Binary file not shown.
180 changes: 92 additions & 88 deletions languages/wc-moldovaagroindbank-ro_RO.po

Large diffs are not rendered by default.

Binary file modified languages/wc-moldovaagroindbank-ru_RU.mo
Binary file not shown.
180 changes: 92 additions & 88 deletions languages/wc-moldovaagroindbank-ru_RU.po

Large diffs are not rendered by default.

182 changes: 93 additions & 89 deletions languages/wc-moldovaagroindbank.pot

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: alexminza
Donate link: https://www.paypal.me/AlexMinza
Tags: WooCommerce, Moldova, Agroindbank, MAIB, bank, payment, gateway, visa, mastercard, credit card
Requires at least: 4.8
Tested up to: 5.6
Tested up to: 5.7.2
Stable tag: trunk
Requires PHP: 7.0
License: GPLv3 or later
Expand Down Expand Up @@ -84,6 +84,9 @@ You can also contribute to the plugin by translating it. Simply visit [translate

See [wc-moldovaagroindbank project releases on GitHub](https://github.com/alexminza/wc-moldovaagroindbank/releases) for details.

= 1.2.1 =
Modified MAIB payment gateway URL for 3DS v2 compliance

= 1.2.0 =
Updated Tested up to 5.6 and WC tested up to 4.8.0

Expand Down Expand Up @@ -127,5 +130,5 @@ Initial release

== Upgrade Notice ==

= 1.2.0 =
Updated Tested up to 5.6 and WC tested up to 4.8.0
= 1.2.1 =
Modified MAIB payment gateway URL for 3DS v2 compliance
15 changes: 8 additions & 7 deletions vendor/fruitware/maib-api/Fruitware/MaibApi/MaibDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
class MaibDescription extends Description {
/**
* @param array $options Custom options to apply to the description
* @param string $merchantHandler Merchant Handler URI
* - formatter: Can provide a custom SchemaFormatter class
*/
public function __construct( array $options = [ ] ) {
public function __construct( array $options = [ ], $merchantHandler = '/ecomm2/MerchantHandler' ) {
parent::__construct( [
'name' => 'Maib API',
// 'baseUrl' => 'https://ecomm.maib.md:4455/ecomm2/MerchantHandler/', // demo server
'operations' => [
'registerSmsTransaction' => [
'httpMethod' => 'POST',
'uri' => '/ecomm2/MerchantHandler',
'uri' => $merchantHandler,
'description' => 'identifies the request for register SMS transaction',
'responseModel' => 'getResponse',
'parameters' => [
Expand Down Expand Up @@ -65,7 +66,7 @@ public function __construct( array $options = [ ] ) {
],
'registerDmsAuthorization' => [
'httpMethod' => 'POST',
'uri' => '/ecomm2/MerchantHandler',
'uri' => $merchantHandler,
'description' => 'identifies the request for register DMS transaction',
'responseModel' => 'getResponse',
'parameters' => [
Expand Down Expand Up @@ -115,7 +116,7 @@ public function __construct( array $options = [ ] ) {
],
'makeDMSTrans' => [
'httpMethod' => 'POST',
'uri' => '/ecomm2/MerchantHandler',
'uri' => $merchantHandler,
'description' => 'identifies the request for execute DMS transaction',
'responseModel' => 'getResponse',
'parameters' => [
Expand Down Expand Up @@ -170,7 +171,7 @@ public function __construct( array $options = [ ] ) {
],
'getTransactionResult' => [
'httpMethod' => 'POST',
'uri' => '/ecomm2/MerchantHandler',
'uri' => $merchantHandler,
'description' => 'identifies the request for get transaction result',
'responseModel' => 'getResponse',
'parameters' => [
Expand All @@ -195,7 +196,7 @@ public function __construct( array $options = [ ] ) {
],
'revertTransaction' => [
'httpMethod' => 'POST',
'uri' => '/ecomm2/MerchantHandler',
'uri' => $merchantHandler,
'description' => 'identifies the request for revert transaction',
'responseModel' => 'getResponse',
'parameters' => [
Expand All @@ -219,7 +220,7 @@ public function __construct( array $options = [ ] ) {
],
'closeDay' => [
'httpMethod' => 'POST',
'uri' => '/ecomm2/MerchantHandler',
'uri' => $merchantHandler,
'description' => 'End of business day',
'responseModel' => 'getResponse',
'parameters' => [
Expand Down
29 changes: 19 additions & 10 deletions wc-moldovaagroindbank.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Moldova Agroindbank Payment Gateway
* Description: Accept Visa and Mastercard directly on your store with the Moldova Agroindbank payment gateway for WooCommerce.
* Plugin URI: https://github.com/alexminza/wc-moldovaagroindbank
* Version: 1.2.0
* Version: 1.2.1
* Author: Alexander Minza
* Author URI: https://profiles.wordpress.org/alexminza
* Developer: Alexander Minza
Expand All @@ -13,9 +13,9 @@
* License: GPLv3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Requires at least: 4.8
* Tested up to: 5.6
* Tested up to: 5.7.2
* WC requires at least: 3.3
* WC tested up to: 4.8.0
* WC tested up to: 5.4.1
*/

//Looking to contribute code to this plugin? Go ahead and fork the repository over at GitHub https://github.com/alexminza/wc-moldovaagroindbank
Expand Down Expand Up @@ -97,9 +97,6 @@ public function __construct() {
$this->has_fields = false;
$this->supports = array('products', 'refunds');

$this->init_form_fields();
$this->init_settings();

#region Initialize user set variables
$this->enabled = $this->get_option('enabled', 'yes');
$this->title = $this->get_option('title', $this->method_title);
Expand All @@ -123,15 +120,19 @@ public function __construct() {

$this->order_template = $this->get_option('order_template', self::ORDER_TEMPLATE);

$this->base_url = ($this->testmode ? 'https://ecomm.maib.md:4499' : 'https://ecomm.maib.md:4455');
$this->client_handler_url = ($this->testmode ? 'https://ecomm.maib.md:7443/ecomm2/ClientHandler' : 'https://ecomm.maib.md/ecomm2/ClientHandler');
$this->skip_receipt_page = true;
$this->base_url = ($this->testmode ? 'https://ecomm.maib.md:4499' : 'https://maib.ecommerce.md:11440');
$this->client_handler_url = ($this->testmode ? 'https://ecomm.maib.md:7443/ecomm2/ClientHandler' : 'https://maib.ecommerce.md:443/ecomm01/ClientHandler');
$this->merchant_handler_url = ($this->testmode ? '/ecomm2/MerchantHandler' : '/ecomm01/MerchantHandler');
$this->skip_receipt_page = true;

$this->maib_pfxcert = $this->get_option('maib_pfxcert');
$this->maib_pcert = $this->get_option('maib_pcert');
$this->maib_key = $this->get_option('maib_key');
$this->maib_key_password = $this->get_option('maib_key_password');

$this->init_form_fields();
$this->init_settings();

$this->initialize_certificates();

$this->update_option('maib_callback_url', $this->get_callback_url());
Expand Down Expand Up @@ -279,6 +280,7 @@ public function init_form_fields() {
'type' => 'text',
//'default' => $this->get_callback_url(),
//'disabled' => true,
'desc_tip' => sprintf(__('Bank payment gateway URL: %1$s', self::MOD_TEXT_DOMAIN), esc_url($this->get_maib_gateway_url())),
'custom_attributes' => array(
'readonly' => 'readonly'
)
Expand Down Expand Up @@ -625,7 +627,9 @@ protected function init_maib_client() {

#region Init Client
$guzzleClient = new Client($options);
$client = new MaibClient($guzzleClient);
//https://github.com/alexminza/wc-moldovaagroindbank/issues/17#issuecomment-850337174
$maibDescription = new MaibDescription([], $this->merchant_handler_url);
$client = new MaibClient($guzzleClient, $maibDescription);

if($this->debug) {
//Create a log for client class (monolog/monolog required)
Expand All @@ -640,6 +644,11 @@ protected function init_maib_client() {
return $client;
}

protected function get_maib_gateway_url() {
$gateway_url = $this->base_url . $this->merchant_handler_url;
return $gateway_url;
}

public function process_payment($order_id) {
if(!$this->check_settings()) {
$message = sprintf(__('%1$s is not properly configured.', self::MOD_TEXT_DOMAIN), $this->method_title);
Expand Down

0 comments on commit 3fe610b

Please sign in to comment.