jenkins-bot has submitted this change and it was merged.

Change subject: Add more Chile payment methods
......................................................................


Add more Chile payment methods

Also allow a submethod to be in multiple groups.

Bug: T124323
Change-Id: Ifcd326621766eb333507d7794e90ce40cd475131
---
M astropay_gateway/astropay.adapter.php
M gateway_common/gateway.adapter.php
2 files changed, 48 insertions(+), 3 deletions(-)

Approvals:
  XenoRyet: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/astropay_gateway/astropay.adapter.php 
b/astropay_gateway/astropay.adapter.php
index c139864..3584f52 100644
--- a/astropay_gateway/astropay.adapter.php
+++ b/astropay_gateway/astropay.adapter.php
@@ -288,6 +288,7 @@
                        'countries' => array(
                                'AR' => true,
                                'BR' => true,
+                               'CL' => true,
                                'MX' => true,
                                'CO' => true,
                        ),
@@ -302,10 +303,22 @@
                        'countries' => array(
                                'AR' => true,
                                'BR' => true,
+                               'CL' => true,
                                'MX' => true,
                                'CO' => true,
                        ),
                        'logo' => 'card-mc-lg.png',
+               );
+
+               // Magna
+               $this->payment_submethods['magna'] = array(
+                       'bank_code' => 'MG',
+                       'label' => 'Magna',
+                       'group' => 'cc',
+                       'countries' => array(
+                               'CL' => true,
+                       ),
+                       'logo' => 'card-magna.png',
                );
 
                // American Express
@@ -316,6 +329,7 @@
                        'countries' => array(
                                'BR' => true,
                                'AR' => true,
+                               'CL' => true,
                                'CO' => true,
                        ),
                        'logo' => 'card-amex-lg.png',
@@ -358,6 +372,7 @@
                        'group' => 'cc',
                        'countries' => array(
                                'BR' => true,
+                               'CL' => true,
                                'CO' => true,
                        ),
                        'logo' => 'card-dinersclub-lg.png',
@@ -435,12 +450,40 @@
                        'logo' => 'card-argencard.png',
                );
 
+               // CMR Falabella
+               $this->payment_submethods['cmr'] = array(
+                       'bank_code' => 'CM',
+                       'label' => 'CMR',
+                       'group' => 'cc',
+                       'countries' => array( 'CL' => true, ),
+                       'logo' => 'card-cmr.png',
+               );
+
+               // Presto
+               $this->payment_submethods['presto'] = array(
+                       'bank_code' => 'PR',
+                       'label' => 'Presto',
+                       'group' => 'cc',
+                       'countries' => array( 'CL' => true, ),
+                       'logo' => 'card-presto.png',
+               );
+
                // Webpay
                $this->payment_submethods['webpay'] = array(
                        'bank_code' => 'WP',
                        'label' => 'Webpay',
-                       'group' => 'cc',
+                       'group' => array( 'cc', 'bt', ),
                        'countries' => array( 'CL' => true, ),
+                       'logo' => 'bank-webpay.png',
+               );
+
+               // Banco de Chile
+               $this->payment_submethods['banco_de_chile'] = array(
+                       'bank_code' => 'BX',
+                       'label' => 'Banco de Chile',
+                       'group' => 'bt',
+                       'countries' => array( 'CL' => true, ),
+                       'logo' => 'bank-banco_de_chile.png',
                );
 
                // Banco do Brasil
@@ -713,7 +756,8 @@
                $method = $this->getData_Staged( 'payment_method' );
                $bank = $this->getData_Staged( 'bank_code' );
                $filter = function( $submethod ) use ( $method, $bank ) {
-                       return $submethod['group'] === $method && 
$submethod['bank_code'] === $bank;
+                       $groups = (array) $submethod['group'];
+                       return in_array( $groups, $method ) && 
$submethod['bank_code'] === $bank;
                };
                $candidates = array_filter( $this->payment_submethods, $filter 
);
                if ( count( $candidates ) !== 1 ) {
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 1d57910..586f64f 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -4047,7 +4047,8 @@
 
                $submethods = array();
                foreach( $this->payment_submethods as $key => 
$available_submethod ) {
-                       if ( $available_submethod['group'] !== $method ) {
+                       $groups = (array) $available_submethod['group'];
+                       if ( !in_array( $method, $groups ) ) {
                                continue; // skip anything not part of the 
selected method
                        }
                        if (

-- 
To view, visit https://gerrit.wikimedia.org/r/275598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifcd326621766eb333507d7794e90ce40cd475131
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to