Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/281496

Change subject: Quit letting a submethod be in multiple groups
......................................................................

Quit letting a submethod be in multiple groups

Too confusing - we can use a different internal name for each.
Also split webpay into separate submethods for CC and BT.

Change-Id: Ie7a48e5380302fd907494f6ab0ea077bcc83b34c
---
M astropay_gateway/AstroPayMethodCodec.php
M astropay_gateway/config/payment_submethods.yaml
M gateway_common/gateway.adapter.php
3 files changed, 12 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/96/281496/1

diff --git a/astropay_gateway/AstroPayMethodCodec.php 
b/astropay_gateway/AstroPayMethodCodec.php
index dfa455c..dd5e151 100644
--- a/astropay_gateway/AstroPayMethodCodec.php
+++ b/astropay_gateway/AstroPayMethodCodec.php
@@ -11,8 +11,8 @@
                        return;
                }
                $filter = function( $submethod ) use ( $method, $bank ) {
-                       $groups = (array) $submethod['group'];
-                       return in_array( $method, $groups ) && 
$submethod['bank_code'] === $bank;
+                       $group = $submethod['group'];
+                       return $method === $group && $submethod['bank_code'] 
=== $bank;
                };
                $candidates = array_filter( $adapter->getPaymentSubmethods(), 
$filter );
 
diff --git a/astropay_gateway/config/payment_submethods.yaml 
b/astropay_gateway/config/payment_submethods.yaml
index 141de6d..b1679a7 100644
--- a/astropay_gateway/config/payment_submethods.yaml
+++ b/astropay_gateway/config/payment_submethods.yaml
@@ -142,9 +142,14 @@
 webpay:
     bank_code: WP
     label: Webpay
-    group:
-        - cc
-        - bt
+    group: cc
+    countries:
+        CL: true
+    logo: bank-webpay.png
+webpay_bt:
+    bank_code: WP
+    label: Webpay
+    group: bt
     countries:
         CL: true
     logo: bank-webpay.png
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 8f74e78..463a772 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -3587,8 +3587,8 @@
 
                $submethods = array();
                foreach( $this->payment_submethods as $key => 
$available_submethod ) {
-                       $groups = (array) $available_submethod['group'];
-                       if ( !in_array( $method, $groups ) ) {
+                       $group = $available_submethod['group'];
+                       if ( $method !== $group ) {
                                continue; // skip anything not part of the 
selected method
                        }
                        if (

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7a48e5380302fd907494f6ab0ea077bcc83b34c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

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

Reply via email to