Skip to content

Commit

Permalink
eWay Rapid: Update supported countries and cards
Browse files Browse the repository at this point in the history
Also adds invoice number support.

Closes activemerchant#1396.
  • Loading branch information
incarnate authored and ntalbott committed Dec 18, 2014
1 parent fcd3284 commit f5fa1ec
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Stripe: Add #scrub for scrubbing PCI information out of HTTP transcripts [girasquid]
* Cybersource: Add ability to verify a card [duff]
* BraintreeBlue: Expose the error code in the response params [duff]
* eWay Rapid: Update supported countries and card types [incarnate]

== Version 1.45.0 (December 1, 2014)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
* [ePay](http://epay.dk/) - DK, SE, NO
* [EVO Canada](http://www.evocanada.com/) - CA
* [eWAY](http://www.eway.com.au/) - AU, NZ, GB
* [eWAY Rapid 3.0](http://www.eway.com.au/) - AU
* [eWAY Rapid](http://www.eway.com.au/) - AU, NZ, GB, SG
* [E-xact](http://www.e-xact.com) - CA, US
* [Fat Zebra](https://www.fatzebra.com.au/) - AU
* [Federated Canada](http://www.federatedcanada.com/) - CA
Expand Down
9 changes: 6 additions & 3 deletions lib/active_merchant/billing/gateways/eway_rapid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class EwayRapidGateway < Gateway
self.live_url = "https://api.ewaypayments.com/"

self.money_format = :cents
self.supported_countries = ['AU', 'NZ', 'GB']
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
self.supported_countries = ['AU', 'NZ', 'GB', 'SG']
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
self.homepage_url = "http://www.eway.com.au/"
self.display_name = "eWAY Rapid 3.1"
self.default_currency = "AUD"
Expand Down Expand Up @@ -187,6 +187,7 @@ def add_invoice(params, money, options, key = "Payment")
params[key] = {
'TotalAmount' => localized_amount(money, currency_code),
'InvoiceReference' => truncate(options[:order_id]),
'InvoiceNumber' => truncate(options[:order_id], 12),
'InvoiceDescription' => truncate(options[:description], 64),
'CurrencyCode' => currency_code,
}
Expand Down Expand Up @@ -352,7 +353,7 @@ def truncate(value, max_size = 50)
'D4403' => 'No Merchant Failed',
'D4404' => 'Pick Up Card Failed',
'D4405' => 'Do Not Honour Failed',
'D4406' => 'Error Failed',
'D4406' => 'Error Failed',
'D4407' => 'Pick Up Card, Special Failed',
'D4409' => 'Request In Progress Failed',
'D4412' => 'Invalid Transaction Failed',
Expand Down Expand Up @@ -406,6 +407,8 @@ def truncate(value, max_size = 50)
'D4498' => 'PayPal Create Transaction Error Failed',
'D4499' => 'Invalid Transaction for Auth/Void Failed',
'S5000' => 'System Error',
'S5011' => 'PayPal Connection Error',
'S5012' => 'PayPal Settings Error',
'S5085' => 'Started 3dSecure',
'S5086' => 'Routed 3dSecure',
'S5087' => 'Completed 3dSecure',
Expand Down
2 changes: 1 addition & 1 deletion test/remote/gateways/remote_eway_rapid_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_successful_authorize_and_capture
def test_failed_authorize
response = @gateway.authorize(@failed_amount, @credit_card, @options)
assert_failure response
assert_equal "Error Failed", response.message
assert_equal "Error Failed", response.message
end

def test_failed_capture
Expand Down
15 changes: 8 additions & 7 deletions test/unit/gateways/eway_rapid_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def test_purchase_with_all_options
assert_match(%r{"TotalAmount":"200"}, data)
assert_match(%r{"InvoiceDescription":"The Really Long Description More Than Sixty Four Characters Gets"}, data)
assert_match(%r{"InvoiceReference":"orderid1"}, data)
assert_match(%r{"InvoiceNumber":"orderid1"}, data)
assert_match(%r{"CurrencyCode":"INR"}, data)

assert_match(%r{"Title":"Mr."}, data)
Expand Down Expand Up @@ -420,7 +421,7 @@ def successful_purchase_response(options = {})
},
"Payment": {
"TotalAmount": 100,
"InvoiceNumber": "",
"InvoiceNumber": "1",
"InvoiceDescription": "Store Purchase",
"InvoiceReference": "1",
"CurrencyCode": "AUD"
Expand Down Expand Up @@ -506,7 +507,7 @@ def failed_purchase_response
},
"Payment": {
"TotalAmount": -100,
"InvoiceNumber": null,
"InvoiceNumber": "1",
"InvoiceDescription": "Store Purchase",
"InvoiceReference": "1",
"CurrencyCode": "AUD"
Expand Down Expand Up @@ -565,7 +566,7 @@ def successful_authorize_response
},
"Payment": {
"TotalAmount":100,
"InvoiceNumber": "",
"InvoiceNumber": "1",
"InvoiceDescription": "Store Purchase",
"InvoiceReference": "1",
"CurrencyCode": "AUD"
Expand Down Expand Up @@ -618,7 +619,7 @@ def failed_authorize_response
},
"Payment": {
"TotalAmount": -100,
"InvoiceNumber": null,
"InvoiceNumber": "1",
"InvoiceDescription": "Store Purchase",
"InvoiceReference": "1",
"CurrencyCode": "AUD"
Expand Down Expand Up @@ -725,7 +726,7 @@ def successful_store_response
},
"Payment": {
"TotalAmount": 0,
"InvoiceNumber": "",
"InvoiceNumber": "1",
"InvoiceDescription": "Store Purchase",
"InvoiceReference": "1",
"CurrencyCode": "AUD"
Expand Down Expand Up @@ -778,7 +779,7 @@ def failed_store_response
},
"Payment": {
"TotalAmount": 0,
"InvoiceNumber": null,
"InvoiceNumber": "1",
"InvoiceDescription": "Store Purchase",
"InvoiceReference": "1",
"CurrencyCode": "AUD"
Expand Down Expand Up @@ -837,7 +838,7 @@ def successful_update_response
},
"Payment": {
"TotalAmount": 0,
"InvoiceNumber": "",
"InvoiceNumber": "1",
"InvoiceDescription": "Store Purchase",
"InvoiceReference": "1",
"CurrencyCode": "AUD"
Expand Down

0 comments on commit f5fa1ec

Please sign in to comment.