helmutschneider / swish-php

PHP-wrapper for the Swish merchant api
MIT License
40 stars 19 forks source link

Added ability to return token #8

Closed vipmonkey closed 2 years ago

vipmonkey commented 6 years ago

When creating a payment without a payer a paymentToken is returned in header. Added ability to optionaly get this header

vipmonkey commented 6 years ago

"201 Created: Returned when Payment request was successfully created. Will return a Location header and if it is Swish m-commerce case, it will also return PaymentRequestToken header." on page 25 https://developer.getswish.se/content/uploads/2018/08/MerchantsAPI_Getswish_180814_v1.92.pdf

helmutschneider commented 6 years ago

Good idea. Using an reference parameter is not ideal though. We should refactor this method to return an object with both the ID and the PaymentRequestToken.

vipmonkey commented 6 years ago

yes ofc is that the best option. However with this pr i wanted to change as little as possible to not force others to have to refactor their codes implementing this function. This way it is optional and will not affect existing implementations.

helmutschneider commented 6 years ago

Understandable. I might refactor this method and then tag a 1.0 release. If you have more ideas for m-commerce, please post them. I have hardly touched that use case at all.

vipmonkey commented 6 years ago

gr8! just started implementing so will keep an eye open for other changes. but i don't think there will be any other problems since the difference is a token returned instead of a payer sent.

phpanos commented 4 years ago

I've also needed this functionality and would love for this to get merged. Any plans for that?

DanielMalmgren commented 2 years ago

I just realized that the id return from createPaymentRequest() is not the same thing as the token needed when triggering the Swish app. So now I'm in bad need for this to get merged. I get the feeling that I shouldn't be holding my breath though, is that right?

dhedberg commented 2 years ago

I created #20 to replace this PR, following the earlier suggestion to return an object instead.

I'm unable to test it beyond making sure that the tests still passes, but if someone here could confirm that it does the job and if there are no other objections, we can hopefully get it included in a new 3.0.0 release.

DanielMalmgren commented 2 years ago

That's great news! I think I may be able to test within a couple of days and report back.

dhedberg commented 2 years ago

Closing this as I have merged #20 and tagged version 3.0.0.