Convert Authorize.net doDirectPayment to use guzzle & add test
authoreileen <emcnaughton@wikimedia.org>
Fri, 5 Jun 2020 01:48:11 +0000 (13:48 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 5 Jun 2020 05:20:33 +0000 (17:20 +1200)
commit5aa044557cc4f42777a8ea722604b777daeb4990
tree84b26a8722ffbdba1154d26ea048a6963aa43337
parent98215beae04641dad4003d8499f75cd784013760
Convert Authorize.net doDirectPayment to use guzzle & add test

This brings the main Authorize.net payment function under testing, putting us in a better position to bring it
into line with more recommended coding practices.

Note the trick to writing tests for Guzzle is to first add the lines

```
    $this->setUpClientWithHistoryContainer();
    $this->processor->setGuzzleClient($this->getGuzzleClient());
... do the stuff

   $responses = $this->getResponseBodies();
   $requests = $this->getRequestBodies();
```

That allows you to capture the outgoing & incoming responses that form the expectations.
Obviously some credential wrangling is needed to get an OK response but it's also possible
with some processors (e.g ones that are basically done for) to just worry about ensuring
the outgoing is captured
CRM/Core/Payment/AuthorizeNet.php
tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php