Mundipagg: Use `orders` endpoint for authorize and purchase
CE-1505
Currently, all requests to Mundipagg use the charges endpoint. However, we need to be able to send SubMerchant fields on all authorize and purchase calls, and the charges endpoint does not receive those fields.
This PR routes all authorize and purchase calls to the orders endpoint, and adds logic to handle the differences between the two. Requests to orders have different requirements than requests to charges:
- instead of accepting a
paymentobject,ordersaccepts apaymentsarray containing one or morepaymentobjects. -
ordersalso requires anitemsobject with three required subfields:amount,description, andquantity. These subfields cannot be blank.
The response returned from orders is structured differently than the response returned from charges. It essentially acts as a wrapper around the standard charges response, including one or more charges in a charges array, as well as an additional set of root-level fields. For this reason it is necessary to parse responses differently depending on which endpoint the request was hitting.
Rubocop: Running RuboCop... 699 files inspected, no offenses detected
Unit tests: 4707 tests, 73409 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
Remote tests: Loaded suite test/remote/gateways/remote_mundipagg_test 39 tests, 97 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed