Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/334733 )

Change subject: WIP Look up iDEAL banks without Ingenico SDK
......................................................................

WIP Look up iDEAL banks without Ingenico SDK

Bug: T128692
Change-Id: Ib22f3f18a184038e3c4c663083aed1c0069e5052
---
A PaymentProviders/Ingenico/BankPaymentProvider.php
1 file changed, 39 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/33/334733/1

diff --git a/PaymentProviders/Ingenico/BankPaymentProvider.php 
b/PaymentProviders/Ingenico/BankPaymentProvider.php
new file mode 100644
index 0000000..c42f13f
--- /dev/null
+++ b/PaymentProviders/Ingenico/BankPaymentProvider.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace SmashPig\PaymentProviders\Ingenico;
+
+/**
+ * Handle bank payments via Ingenico
+ * Will eventually implement PaymentProvider, but right now just looks
+ * up iDEAL banks
+ */
+class BankPaymentProvider extends IngenicoPaymentProvider {
+
+       /**
+        * Look up banks
+        * @param string $country 2 letter country ISO code
+        * @param string $currency 3 letter currency ISO code
+        * @param int $productId Numeric Ingenico id of payment product we're
+        *  listing banks for. Defaults to the code for iDEAL, the only product
+        *  supported as of early 2017
+        * @return array Keys are bank codes, values are names
+        */
+       public function getBankList( $country, $currency, $productId = 809 ) {
+               $query = array(
+                       'countryCode' => $country,
+                       'currencyCode' => $currency
+               );
+               $path = "products/$productId/directory";
+               $response = $this->makeApiCall( $path, 'GET', $query );
+
+               // TODO: base class should probably decode
+               $decoded = json_decode( $response['body'], true );
+
+               $banks = array();
+
+               foreach( $decoded->entries as $entry ) {
+                       $banks[$entry->issuerId] = $entry->issuerName;
+               }
+               return $banks;
+       }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib22f3f18a184038e3c4c663083aed1c0069e5052
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to