Add expected responses & enble the handler
authoreileen <emcnaughton@wikimedia.org>
Fri, 4 Sep 2020 05:47:48 +0000 (17:47 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 4 Sep 2020 05:49:18 +0000 (17:49 +1200)
tests/phpunit/CRM/Core/Payment/PaypalProTrait.php

index c7e65b37b1ffc824b049c4470086af6ee4ffc2ba..126e2e7d370985d5e75bc17a56425647d09fdc3e 100644 (file)
@@ -9,12 +9,14 @@
  +--------------------------------------------------------------------+
  */
 
+use Civi\Test\GuzzleTestTrait;
+
 /**
  * Class CRM_Core_Payment_AuthorizeNetTest
  * @group headless
  */
 trait CRM_Core_Payment_PaypalProTrait {
-  use \Civi\Test\GuzzleTestTrait;
+  use GuzzleTestTrait;
 
   /**
    * @var \CRM_Core_Payment_PayPalImpl
@@ -35,7 +37,8 @@ trait CRM_Core_Payment_PaypalProTrait {
    */
   public function getExpectedSinglePaymentResponses() {
     return [
-      'placeholder',
+      'TIMESTAMP=2020%2d09%2d04T04%3a05%3a11Z&CORRELATIONID=246132f75a6f3&ACK=Success&VERSION=3&BUILD=54790461&AMT=5%2e24&CURRENCYCODE=USD&AVSCODE=A&CVV2MATCH=M&TRANSACTIONID=9TU23130NB247535M',
+      'RECEIVERBUSINESS=sunil%2e_1183377782_biz%40webaccess%2eco%2ein&RECEIVEREMAIL=sunil%2e_1183377782_biz%40webaccess%2eco%2ein&RECEIVERID=BNCETES6EECQQ&EMAIL=86Y37281N5671683A%40dcc2%2epaypal%2ecom&PAYERID=RYUKTRK2TRA4J&PAYERSTATUS=verified&COUNTRYCODE=US&ADDRESSOWNER=PayPal&ADDRESSSTATUS=None&INVNUM=68023&SALESTAX=0%2e00&TIMESTAMP=2020%2d09%2d04T05%3a18%3a33Z&CORRELATIONID=b74cfc6e440ea&ACK=Success&VERSION=3&BUILD=54686869&FIRSTNAME=John&LASTNAME=O%27Connor&TRANSACTIONID=58E89379MT3066727&RECEIPTID=3065%2d9946%2d9883%2d0395&TRANSACTIONTYPE=webaccept&PAYMENTTYPE=instant&ORDERTIME=2020%2d09%2d04T05%3a18%3a28Z&AMT=5%2e24&FEEAMT=0%2e45&TAXAMT=0%2e00&CURRENCYCODE=USD&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None&SHIPPINGMETHOD=Default&L_QTY0=1&L_TAXAMT0=0%2e00&L_CURRENCYCODE0=USD&L_AMT0=5%2e24',
     ];
   }
 
@@ -46,7 +49,8 @@ trait CRM_Core_Payment_PaypalProTrait {
    */
   public function getExpectedSinglePaymentRequests() {
     return [
-      'placeholder',
+      'user=sunil._1183377782_biz_api1.webaccess.co.in&pwd=1183377788&version=3&signature=APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH&subject=&method=DoDirectPayment&paymentAction=Sale&amt=5.24&currencyCode=USD&invnum=xyz&ipaddress=127.0.0.1&creditCardType=Visa&acct=4444333322221111&expDate=102022&cvv2=123&firstName=John&lastName=O%27Connor&email=&street=8+Hobbitton+Road&city=The+Shire&state=IL&countryCode=US&zip=5010&desc=&custom=&BUTTONSOURCE=CiviCRM_SP',
+      'TRANSACTIONID=9TU23130NB247535M&user=sunil._1183377782_biz_api1.webaccess.co.in&pwd=1183377788&version=3&signature=APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH&subject=&method=GetTransactionDetails',
     ];
   }
 
@@ -75,7 +79,7 @@ trait CRM_Core_Payment_PaypalProTrait {
     $responses = $this->isRecur ? $this->getExpectedRecurResponses() : $this->getExpectedSinglePaymentResponses();
     // Comment the next line out when trying to capture the response.
     // see https://github.com/civicrm/civicrm-core/pull/18350
-    //$this->createMockHandler($responses);
+    $this->createMockHandler($responses);
     $this->setUpClientWithHistoryContainer();
     $this->processor->setGuzzleClient($this->getGuzzleClient());
   }