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

Change subject: WIP getHostedCheckoutStatus
......................................................................

WIP getHostedCheckoutStatus

Bug: T163948
Change-Id: I3d11fba2d4c900752c6e35d2182f412d95735696
---
M ingenico_gateway/config/var_map.yaml
M ingenico_gateway/ingenico.adapter.php
2 files changed, 29 insertions(+), 2 deletions(-)


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

diff --git a/ingenico_gateway/config/var_map.yaml 
b/ingenico_gateway/config/var_map.yaml
index 79c88d8..fb21f7e 100644
--- a/ingenico_gateway/config/var_map.yaml
+++ b/ingenico_gateway/config/var_map.yaml
@@ -14,3 +14,5 @@
 surname: last_name
 merchantReference: order_id
 hostedCheckoutId: gateway_session_id
+id: gateway_txn_id
+statusCode: gateway_status
diff --git a/ingenico_gateway/ingenico.adapter.php 
b/ingenico_gateway/ingenico.adapter.php
index 127e5be..ec8031d 100644
--- a/ingenico_gateway/ingenico.adapter.php
+++ b/ingenico_gateway/ingenico.adapter.php
@@ -90,6 +90,18 @@
                                'hostedCheckoutId'
                        )
                );
+
+               $this->transactions['getHostedCheckoutStatus'] = array(
+                       'request' => array( 'hostedCheckoutId' ),
+                       'response' => array(
+                               'id',
+                               'amount',
+                               'currencyCode',
+                               'avsResult',
+                               'cvvResult',
+                               'statusCode',
+                       )
+               );
        }
 
        /**
@@ -107,6 +119,12 @@
                );
        }
 
+       /**
+        * Make an API call to Ingenico Connect.
+        *
+        * @param array $data parameters for the transaction
+        * @return bool whether the API call succeeded
+        */
        public function curl_transaction( $data ) {
                $email = $this->getData_Unstaged_Escaped( 'email' );
                $this->logger->info( "Making API call for donor $email" );
@@ -120,11 +138,18 @@
                switch( $this->getCurrentTransaction() ) {
                        case 'createHostedCheckout':
                                $result = $provider->createHostedPayment( $data 
);
-                               $this->transaction_response->setRawResponse( 
json_encode( $result ) );
-                               return true;
+                               break;
+                       case 'getHostedCheckoutStatus':
+                               $result = $provider->getHostedPaymentStatus(
+                                       $data['hostedCheckoutId']
+                               );
+                               break;
                        default:
                                return false;
                }
+
+               $this->transaction_response->setRawResponse( json_encode( 
$result ) );
+               return true;
        }
 
        public function getBasedir() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d11fba2d4c900752c6e35d2182f412d95735696
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <ej...@ejegg.com>

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

Reply via email to