Closed vipmonkey closed 5 years ago
Attach some test data to reproduce this. Ideally all errors should be returned as Error
or some appropriate exception.
var_export of returned $client->getPaymentRequest($id); without this change
HelmutSchneider\Swish\PaymentRequest::__set_state(array(
'id' => 'C998D14B27E14978A5748C**********',
'payeePaymentReference' => 'reference',
'paymentReference' => 'AD163836B45A4E13B23A61**********',
'callbackUrl' => 'https://localhost',
'payerAlias' => NULL,
'payeeAlias' => '12********',
'amount' => 6,
'currency' => 'SEK',
'message' => 'message',
'status' => 'ERROR',
'dateCreated' => '2018-08-21T08:48:01.035Z',
'datePaid' => NULL,
))
var_export of returned $client->getPaymentRequest($id); with this change
HelmutSchneider\Swish\PaymentRequest::__set_state(array(
'id' => 'C998D14B27E14978A5748C**********',
'payeePaymentReference' => 'reference',
'paymentReference' => 'AD163836B45A4E13B23A61**********',
'callbackUrl' => 'https://localhost',
'payerAlias' => NULL,
'payeeAlias' => '12********',
'amount' => 6,
'currency' => 'SEK',
'message' => 'message',
'status' => 'ERROR',
'dateCreated' => '2018-08-21T08:48:01.035Z',
'datePaid' => NULL,
'errorCode' => 'TM01',
'errorMessage' => 'Swish timed out before the payment was started',
'additionalInformation' => '',
))
returned json in body for both above cases
{
id: "C998D14B27E14978A5748C**********",
payeePaymentReference: "reference",
paymentReference: "AD163836B45A4E13B23A61***********",
callbackUrl: "https://localhost",
payerAlias: null,
payeeAlias: "12********",
amount: 6,
currency: "SEK",
message: "message",
status: "ERROR",
dateCreated: "2018-08-21T08:48:01.035Z",
datePaid: null,
errorCode: "TM01",
errorMessage: "Swish timed out before the payment was started"
}
EDIT, sorry it did not take linebreaks so it looks crap
The Refund class is also missing the same error related properties (see specification page 37-38).
Yeah. I'm slowly coming around to the fact that we might have to put the errors in the actual PaymentRequest
and Refund
objects even though it's not ideal from a design perspective.
What is the thinking about not having them inside the objects? what will be the correct way to get this information if it is not included?
Initially it seemed like all swish errors would be sent as Error
objects (which also is in the spec). It turns out that is not quite true, and now we have a situation where errors must be handled in two separate ways 😟
Paymentrequest did not return error properties even if payment returned status error. Updated the paymentrequest to match the specification on page 34 https://developer.getswish.se/content/uploads/2018/08/MerchantsAPI_Getswish_180814_v1.92.pdf