thephpleague / omnipay-multisafepay

MultiSafepay driver for the Omnipay PHP payment processing library
MIT License
19 stars 22 forks source link

Send (type redirect) REST request with items #14

Open hubertprein opened 7 years ago

hubertprein commented 7 years ago

The array with items are transformed into an instance of ItemBag, with a collection of items. When you fire the redirect RestPurchaseRequest, it is executed through Guzzle. Guzzle then falls over the ItemBag, since it's not an array which can't be added to the GET request. So it tries to add the object to the request and pops up with this error: rawurlencode() expects parameter 1 to be string, object given

delatbabel commented 7 years ago

Can you submit a PR for this?

hubertprein commented 7 years ago

@delatbabel Euhm, I'm not sure we're on the same page here. I don't have a fix available, so what pull request could I make?

Swahjak commented 7 years ago

@delatbabel Why doesn't RestPurchaseRequest just simply use the same logic as PurchaseRequest? I was quite surprised that this isn't implemented since it is a core omnipay feature (the ItemBag).

if ($items = $this->getItems()) {
    $itemsHtml = '<ul>';
    foreach ($items as $item) {
        $itemsHtml .= "<li>{$item['quantity']} x {$item['name']}</li>";
    }
    $itemsHtml .= '</ul>';
    $transaction->addChild('items', htmlspecialchars($itemsHtml));
}
delatbabel commented 7 years ago

I'm actually not familiar enough with multisafepay to be able to answer that question. If you think that that code would resolve the issue then commit that, test it, and make a PR.

jeffreyzant commented 7 years ago

I just created a PR for this. :)