eWAYPayment / eway-rapid-php

Eway Rapid PHP library
https://www.eway.com.au
MIT License
14 stars 24 forks source link

Original and useful error codes are removed in favor of a more-generic error code #9

Closed meglio closed 8 years ago

meglio commented 8 years ago

How to reproduce this bug:

  1. Create a new sandbox account.
  2. Do NOT configure it to be PCI-compliant
  3. Issue a transaction request via API; use a simple correct API request except that remove the TransactionType parameter, so that there are 2 errors in the request:
    • PCI not turned on in Sandbox
    • No TransactionType parameter

It can be seen in the original JSON response returned from the server that 2 error codes are returned and they explain the issues very well:

image

{"AuthorisationCode":null,"ResponseCode":null,"ResponseMessage":null,"TransactionID":null,"TransactionStatus":null,"TransactionType":"Unknown","BeagleScore":null,"Verification":null,"Customer":{"CardDetails":{"Number":"444433XXXXXX1111","Name":"TESTNAME TESTSURNAME","ExpiryMonth":"12","ExpiryYear":"30","StartMonth":null,"StartYear":null,"IssueNumber":null},"TokenCustomerID":null,"Reference":null,"Title":null,"FirstName":null,"LastName":null,"CompanyName":null,"JobDescription":null,"Street1":null,"Street2":null,"City":null,"State":null,"PostalCode":null,"Country":null,"Email":null,"Phone":null,"Mobile":null,"Comments":null,"Fax":null,"Url":null},"Payment":{"TotalAmount":12300,"InvoiceNumber":"INV-2016-193","InvoiceDescription":"Wine purchase","InvoiceReference":"R_193_F_32_C_84","CurrencyCode":"AUD"},"Errors":"V6111,V6010"}

The codes returned are:

However, this JSON is processed further - it is converted into an instance of CreateTransactionResponse. The instance's getErrors() method returns a single error with code S9995, which "hides" the original useful codes V6111 and V6010.

So, at the end, when calling getErrors(), you only get S9995, which does not help you to understand the issues with the request.

Looks like a bug unless I'm doing it in a wrong way.

incarnate commented 8 years ago

Thanks for the report - it looks like the 'Unknown' TransactionType is causing a problem loading the response. We need to handle building the response objects with unexpected values better to avoid this situation,

I'll see if I can get a release out this week to improve this, it is also causing a problem when trying to get the latest version of Rapid working with the SDK.

incarnate commented 8 years ago

Just released v1.3.0 which contains a fix for this issue.