/** * Send http request to api and return response. * * @param string $operation the operation type to perform * @param array $args * * @return Response */ public function send($operation_type, array $args) { $fields = array_merge($this->authParams(), $args, compact('operation_type')); $response = new Response($this->client->post($this->apiUrl, ['body' => Xml::arrayToXml($fields)])); $response->offsetSet('original_args', $args); return $response; }
/** * Assert that the Xml::arrayToXml function correctly converts * the attributes to the expected string. * * @param string $expected should be field nodes to be wrapped in transaction * @param array $attributes */ protected function assertArrayToXml($expected, $attributes) { $expected = <<<XML <?xml version="1.0"?> <TRANSACTION><FIELDS>{$expected}</FIELDS></TRANSACTION> XML; $this->assertXmlStringEqualsXmlString($expected, Xml::arrayToXml($attributes)); }