rotassator / omnipay-payway-restapi

PayWay REST API gateway for Omnipay payment processing library
MIT License
4 stars 11 forks source link

Added getSingleUseTokenId to make one-time credit card payment #5

Closed ArjunKishore closed 7 years ago

ArjunKishore commented 7 years ago

To make a payment transaction without creating new customer.

Added SingleUseTokenId within data array of purchaseRequest as optional parameter to pass during purchase

https://www.payway.com.au/docs/rest.html#transactions

ArjunKishore commented 7 years ago

@brucealdridge Hi Bruce, Thanks for your help with my previous issue. I would like to add one time credit card payment without creating customer by passing SingleUseTokenId Wondering if you could review my pull request ?

Warm Regards, Arjun

brucealdridge commented 7 years ago

Haha, I just had the same issue! I'll delete my PR - but I don't have write access to the repo, so my review means nothing, paging @rotassator :)

rotassator commented 7 years ago

Sorry guys, I've been pretty flat out lately so I haven't had time to test the change out as yet.

How have you gone with testing this out so far?

I have a task reminder flashing in the back of my mind to set up some automated testing to help with this in the future. :P

brucealdridge commented 7 years ago

@rotassator without this fix, a customer needs to be created prior to initiating a payment. Because the singleUseToken is not sent through if provided a purchase can only be made with the payment method setup with the customer.

So this fix allows both

Tested and working fine, I'm deploying to production (with this fix) next week

ArjunKishore commented 7 years ago

@rotassator I have tested this and it works without any issues.
Currently I am only using one-time credit card payments without having to create customer.

rotassator commented 7 years ago

Just tested that one change with an existing site and it breaks credit card & direct debit functionality, giving the following error:

To process payments using a single use token, you must purchase the PayWay Net module with credit card payment channel. (singleUseTokenId)

I seem to remember that I initially had the code in there but took it out when it didn't work.

I'm pretty sure the Payway "Frame" references in the doco is new, as I don't remember it when I created the module.

ArjunKishore commented 7 years ago

As per my understanding a (singleUseTokenId) represents a credit card or a debit card. So we can make a purchase either using created customer id or singleUseTokenId which represents a card. Can you please tell me how do I replicate this error ? Currently, I am make payments like this

$gateway = Omnipay::create('PaywayRest');
$message = $gateway->purchase([
                    'customerNumber' => $customerId,
                    'singleUseTokenId' => $singleUseTokenId,
                    'principalAmount' => $total,
                    'currency' => 'AUD',
                    'orderNumber' =>$orderId' ]);
$response = `$message->send();