New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProPay: Add gateway #2405
ProPay: Add gateway #2405
Conversation
8ff149f
to
ea9f955
Compare
self.money_format = :cents | ||
self.supported_cardtypes = [:visa, :master, :american_express, :discover] | ||
|
||
self.homepage_url = 'http://www.example.net/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep 😞
def refund(money, authorization, options={}) | ||
request = build_xml_request do |xml| | ||
xml.transNum authorization | ||
xml.amount money if money |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this (and the one in capture
) be amount(money)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should! Good catch.
def capture(money, authorization, options={}) | ||
request = build_xml_request do |xml| | ||
xml.amount money if money | ||
xml.transNum authorization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how I feel about having both these direct additions to the xml in the action methods, and the one-line add_account
and add_recurring
methods extracted. Not a big deal though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. Sometimes I think it's ok to have the method just add the single value instead of always using any extracted methods. But, the more I think about it, it's probably better for me to keep using to extracted methods.
|
||
def verify(credit_card, options={}) | ||
MultiResponse.run(:use_first_response) do |r| | ||
r.process { authorize(100, credit_card, options) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't accept 0-value authorize
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I didn't try it actually. I've actually always gone off of the 100
that comes with the generator. I'll give it a shot and see what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried 0
auth during verify
and got an Invalid amount
error. 😿
end | ||
|
||
def add_recurring(xml, options) | ||
xml.recurringPayment options[:recurring_payment] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any best practice for options passed to a gateway that are boolean being true/false
vs the value of what's actually passed to the gateway? Or are there more options than Y/N
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've personally always thought it's better to pass the same value as what's in the gateway docs. Seems more explicit to me instead of relying on the underly adapter to do the right thing depending on true
/false
. That being said, I don't think there's actually a convention around this yet...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that does make sense; I'll try to remember to follow that in the future.
Alrighty, updates made. Thanks for the second set of eyes @curiousepic. Just waiting on the production URL from ProPay now... |
Live URL added. Just waiting on a 👍! |
@shasum Want to give a once-over and 👍 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good 👍
module Billing #:nodoc: | ||
class ProPayGateway < Gateway | ||
self.test_url = 'https://xmltest.propay.com/API/PropayAPI.aspx' | ||
self.live_url = 'https://example.com/live' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this one, the live_url
? :)
request = build_xml_request do |xml| | ||
xml.transNum authorization | ||
xml.amount money if money | ||
xml.currencyCode if options[:currency] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's needed. Noticed capture
does not have currency code unlike refund
.
end | ||
|
||
def add_account(xml, options) | ||
xml.accountNum options[:account_num] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is account_num
likely to change per transaction. Just want to make sure it's better as an option vs a credential.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shasum great question! Yes it is. ProPay is a payment gateway for platforms so for each transaction you need to specify the merchant (on your platform) that you want to actually receive the funds. Similar to WePay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool 👍
Thanks @shasum and @curiousepic! |
Adding the ProPay gateway. Just to note- still waiting on the production URL. I'll update the PR once it's given before merging in.
Remote Test Run
Unit Test Run