From f5fa1ec094376515abeda100df2edbe0785755e4 Mon Sep 17 00:00:00 2001 From: John C Date: Fri, 26 Sep 2014 14:32:06 +0000 Subject: [PATCH] eWay Rapid: Update supported countries and cards Also adds invoice number support. Closes #1396. --- CHANGELOG | 1 + README.md | 2 +- .../billing/gateways/eway_rapid.rb | 9 ++++++--- test/remote/gateways/remote_eway_rapid_test.rb | 2 +- test/unit/gateways/eway_rapid_test.rb | 15 ++++++++------- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e59d8651342..15ff6f253ff 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/README.md b/README.md index b1c9ebedcc7..20858ce8d1e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/active_merchant/billing/gateways/eway_rapid.rb b/lib/active_merchant/billing/gateways/eway_rapid.rb index 7760057b69d..04d9436e3a1 100644 --- a/lib/active_merchant/billing/gateways/eway_rapid.rb +++ b/lib/active_merchant/billing/gateways/eway_rapid.rb @@ -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" @@ -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, } @@ -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', @@ -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', diff --git a/test/remote/gateways/remote_eway_rapid_test.rb b/test/remote/gateways/remote_eway_rapid_test.rb index 8493682cf51..43e926aee9c 100644 --- a/test/remote/gateways/remote_eway_rapid_test.rb +++ b/test/remote/gateways/remote_eway_rapid_test.rb @@ -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 diff --git a/test/unit/gateways/eway_rapid_test.rb b/test/unit/gateways/eway_rapid_test.rb index 7c3fdd40c4d..5498f051a94 100644 --- a/test/unit/gateways/eway_rapid_test.rb +++ b/test/unit/gateways/eway_rapid_test.rb @@ -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) @@ -420,7 +421,7 @@ def successful_purchase_response(options = {}) }, "Payment": { "TotalAmount": 100, - "InvoiceNumber": "", + "InvoiceNumber": "1", "InvoiceDescription": "Store Purchase", "InvoiceReference": "1", "CurrencyCode": "AUD" @@ -506,7 +507,7 @@ def failed_purchase_response }, "Payment": { "TotalAmount": -100, - "InvoiceNumber": null, + "InvoiceNumber": "1", "InvoiceDescription": "Store Purchase", "InvoiceReference": "1", "CurrencyCode": "AUD" @@ -565,7 +566,7 @@ def successful_authorize_response }, "Payment": { "TotalAmount":100, - "InvoiceNumber": "", + "InvoiceNumber": "1", "InvoiceDescription": "Store Purchase", "InvoiceReference": "1", "CurrencyCode": "AUD" @@ -618,7 +619,7 @@ def failed_authorize_response }, "Payment": { "TotalAmount": -100, - "InvoiceNumber": null, + "InvoiceNumber": "1", "InvoiceDescription": "Store Purchase", "InvoiceReference": "1", "CurrencyCode": "AUD" @@ -725,7 +726,7 @@ def successful_store_response }, "Payment": { "TotalAmount": 0, - "InvoiceNumber": "", + "InvoiceNumber": "1", "InvoiceDescription": "Store Purchase", "InvoiceReference": "1", "CurrencyCode": "AUD" @@ -778,7 +779,7 @@ def failed_store_response }, "Payment": { "TotalAmount": 0, - "InvoiceNumber": null, + "InvoiceNumber": "1", "InvoiceDescription": "Store Purchase", "InvoiceReference": "1", "CurrencyCode": "AUD" @@ -837,7 +838,7 @@ def successful_update_response }, "Payment": { "TotalAmount": 0, - "InvoiceNumber": "", + "InvoiceNumber": "1", "InvoiceDescription": "Store Purchase", "InvoiceReference": "1", "CurrencyCode": "AUD"