MyOnlineStore / omnipay-klarna-checkout

Klarna Checkout gateway for Omnipay
MIT License
13 stars 12 forks source link

Bug when capture has no response body (correctly so) #48

Closed CedNet closed 6 years ago

CedNet commented 6 years ago

Hi! In Klarnas API the capture request has an empty response body.

In the file https://github.com/MyOnlineStore/omnipay-klarna-checkout/blob/master/src/Message/AbstractRequest.php

On line 211 you are forcing a returntype of array.

The only way around handling this is catching a TypeError exception.

Maybe you should allow the API to handle a null response?

digibeuk commented 6 years ago

you mean : https://github.com/MyOnlineStore/omnipay-klarna-checkout/blob/master/src/Message/AbstractRequest.php#L211 (you can also link to lines in github :) )

I guess your are right, we can catch the \TypeError in the method and return an empty array.

For future reference : https://developers.klarna.com/api/#order-management-api-create-capture