public function testExceptionMissingValuesToParams() { // initialize client $client = $this->createClient(); // initialize service $service = new Service\Payment($client); $json = '{ "card": { "number": "", "expiryMonth": "", "expiryYear": "", "cvc": "", "holderName": "" }, "amount": { "value": "", "currency": "" }, "reference": "", "merchantAccount": "" }'; $params = json_decode($json, true); $e = null; try { $result = $service->authorise($params); } catch (\Exception $e) { } $this->assertEquals('Adyen\\AdyenException', get_class($e)); $this->assertEquals('Missing the following values: merchantAccount,amount.value,amount.currency,reference', $e->getMessage()); }
public function testCreatePaymentWrongCvc() { // initialize client $client = $this->createClient(); // initialize service $service = new Service\Payment($client); $json = '{ "card": { "number": "4111111111111111", "expiryMonth": "08", "expiryYear": "2018", "cvc": "111", "holderName": "John Smith" }, "amount": { "value": 1500, "currency": "EUR" }, "reference": "payment-test", "merchantAccount": "' . $this->_merchantAccount . '" }'; $params = json_decode($json, true); try { $result = $service->authorise($params); } catch (\Exception $e) { $this->validateApiPermission($e); } // Assert $this->assertEquals('Refused', $result['resultCode']); $this->assertEquals('CVC Declined', $result['refusalReason']); }