eway_rapid 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bf2d582f80ab78226432c88df7781cfabe891278
4
- data.tar.gz: 775898c5b1a9f42a5b69ca3527197685265c0750
2
+ SHA256:
3
+ metadata.gz: b0a31499dfd48ef4a8c5e59971a038d9cf339562f961311b8659bf5ce391ee13
4
+ data.tar.gz: 8cea9af55a5db07c8af0604b03faa51c3fd7bc2015a95546552888d8991191e4
5
5
  SHA512:
6
- metadata.gz: 9b19a982240640157c65e2b4139d2012de21eabc41a204a23c7263b33cbe2e3ac8ae482c2baa16727af117ab601ced81506fbc423b5d01864eeaa8f10c4ea703
7
- data.tar.gz: 5ce639e7c8a1f166d9ed52565d28125570e87328a2c1b03944f3ed6b8b1b57fe63b05f8e99a01451796743c470628da7c92179079ceaec4ab7d7d904309f2609
6
+ metadata.gz: 533243b5a864cdfcaf701001602979c730beeb0aba0c9388fb4b73d8dc1210e54107a045c9469fc637895c192f0ac1b656247998dfa0e7b4e5e3a53350a6981a
7
+ data.tar.gz: 98c4e44e73e7a5854ada587463c2ee79d10715c511d4dc221874d7e2755c2fb889e87f3c75f6ea74a066aff1b5a539e8be60d0dd1e00f7f402570d794f0c91d8
@@ -1,12 +1,16 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0.0
5
4
  - 2.1
6
5
  - 2.2
7
- - 2.3.0
8
- - jruby-19mode
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
9
 
10
- before_install: gem install bundler -v 1.10.6
10
+ env:
11
+ - EWAY_API_VERSION=31
12
+ - EWAY_API_VERSION=40
13
+
14
+ before_install: gem install bundler -v 1.17.2
11
15
 
12
16
  sudo: false
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes will be documented in this file
4
4
 
5
+ ## 2.0.0
6
+
7
+ - Dropped support for Ruby 1.9
8
+ - Added support for save customer (thanks @brocktimus)
9
+ - Added support for Secure Fields (thanks @dNitza)
10
+ - Add support for setting a Rapid version
11
+ - Force use of TLS 1.2 for connections
12
+
5
13
  ## 1.2.0
6
14
 
7
15
  - Add support for Secure Fields and wallets with `secured_card_data field`
data/README.md CHANGED
@@ -9,16 +9,12 @@ A Ruby Gem to integrate with eWAY's Rapid Payment API.
9
9
  Sign up with eWAY at:
10
10
  - Australia: https://www.eway.com.au/
11
11
  - New Zealand: https://eway.io/nz/
12
- - UK: https://eway.io/uk/
13
- - Hong Kong: https://eway.io/hk/
14
- - Malaysia: https://eway.io/my/
15
- - Singapore: https://eway.io/sg/
16
12
 
17
13
  For testing, get a free eWAY Partner account: https://www.eway.com.au/developers
18
14
 
19
15
  ## Installation
20
16
 
21
- The eWAY Ruby Gem requires Ruby 1.9.3 or better, it also requires the rest-client and json gems.
17
+ The eWAY Ruby Gem requires Ruby 2.0.0 or better, it also requires the rest-client and json gems.
22
18
 
23
19
  Add this line to your application's Gemfile:
24
20
 
@@ -6,7 +6,7 @@ require 'eway_rapid/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'eway_rapid'
8
8
  spec.version = EwayRapid::VERSION
9
- spec.required_ruby_version = '>= 1.9.3'
9
+ spec.required_ruby_version = '>= 2.0.0'
10
10
  spec.author = ['eWAY']
11
11
  spec.summary = 'Ruby gem for eWAY\'s Rapid API'
12
12
  spec.description = 'Easy online payments with eWAY and the eWAY Rapid Ruby gem.'
@@ -16,17 +16,12 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.require_paths = ['lib']
18
18
 
19
- spec.add_dependency 'json', '~> 1.8.3'
19
+ spec.add_dependency 'json', '~> 2.1.0'
20
+ spec.add_dependency 'rest-client', '~> 2.0'
20
21
 
21
- # prevent dependency issues for Ruby 1.9
22
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
23
- spec.add_dependency 'rest-client', '~> 1.8.0'
24
- else
25
- spec.add_dependency 'rest-client', ['>= 1.8.0', '< 3.0']
26
- end
27
-
28
- spec.add_development_dependency 'bundler', '~> 1.10'
29
- spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'bundler', '~> 1.17'
23
+ spec.add_development_dependency 'rake', '~> 12.0'
30
24
  spec.add_development_dependency 'test-unit'
31
25
  spec.add_development_dependency 'simplecov'
26
+ spec.add_development_dependency 'rubocop'
32
27
  end
@@ -75,6 +75,7 @@ module EwayRapid
75
75
  CHECKOUT_PAYMENT = 'CheckoutPayment'
76
76
  CHECKOUT_URL = 'CheckoutUrl'
77
77
  TRANSACTION_TYPE = 'TransactionType'
78
+ SECURED_CARD_DATA = 'SecuredCardData'
78
79
  PARTNER_ID = 'PartnerID'
79
80
  TRANSACTIONS = 'Transactions'
80
81
  ERRORS_CAPITALIZED = 'Errors'
@@ -112,6 +113,10 @@ module EwayRapid
112
113
  AMOUNT = 'Amount'
113
114
  TRANSACTION_DATE = 'TransactionDateTime'
114
115
  SETTLEMENT_DATE = 'SettlementDateTime'
116
+ SOURCE = 'Source'
117
+ MAX_REFUND = 'MaxRefund'
118
+ ORIGINAL_TRANSACTION = 'OriginalTransactionId'
119
+ AMEX_EC_DATA = 'AmexECEncryptedData'
115
120
  JSON_SUFFIX = '.json'
116
121
  LIBRARY_NOT_HAVE_ENDPOINT_ERROR_CODE = 'S9990'
117
122
  API_KEY_INVALID_ERROR_CODE = 'S9991'
@@ -37,6 +37,7 @@ module EwayRapid
37
37
  attr_accessor :card_start_month
38
38
  attr_accessor :card_start_year
39
39
  attr_accessor :card_issue_number
40
+ attr_accessor :amex_ec_data
40
41
 
41
42
  def to_json(options={})
42
43
  {Constants::CUSTOMER => customer,
@@ -75,7 +76,8 @@ module EwayRapid
75
76
  Constants::CARD_EXPIRY_YEAR => card_expiry_year,
76
77
  Constants::CARD_START_MONTH => card_start_month,
77
78
  Constants::CARD_START_YEAR => card_start_year,
78
- Constants::CARD_ISSUE_NUMBER => card_issue_number}.to_json
79
+ Constants::CARD_ISSUE_NUMBER => card_issue_number,
80
+ Constants::AMEX_EC_DATA => amex_ec_data}.to_json
79
81
  end
80
82
 
81
83
  def self.from_json(json)
@@ -122,6 +124,7 @@ module EwayRapid
122
124
  create_access_code_response.card_start_month = hash[Constants::CARD_START_MONTH]
123
125
  create_access_code_response.card_start_year = hash[Constants::CARD_START_YEAR]
124
126
  create_access_code_response.card_issue_number = hash[Constants::CARD_ISSUE_NUMBER]
127
+ create_access_code_response.amex_ec_data = hash[Constants::AMEX_EC_DATA]
125
128
  create_access_code_response
126
129
  end
127
130
  end
@@ -7,6 +7,7 @@ module EwayRapid
7
7
  attr_accessor :payment
8
8
  attr_accessor :method
9
9
  attr_accessor :transaction_type
10
+ attr_accessor :secured_card_data
10
11
  attr_accessor :customer_ip
11
12
  attr_accessor :device_id
12
13
  attr_accessor :partner_id
@@ -20,6 +21,7 @@ module EwayRapid
20
21
  Constants::PAYMENT => InternalModels::Payment.to_hash(payment),
21
22
  Constants::METHOD => method,
22
23
  Constants::TRANSACTION_TYPE => transaction_type,
24
+ Constants::SECURED_CARD_DATA => secured_card_data,
23
25
  Constants::CUSTOMER_DEVICE_IP => customer_ip,
24
26
  Constants::DEVICE_ID => device_id,
25
27
  Constants::PARTNER_ID => partner_id,
@@ -10,6 +10,7 @@ module EwayRapid
10
10
  transaction.customer = get_eway_customer(i_transaction)
11
11
  transaction.payment_details = get_payment_details(i_transaction)
12
12
  transaction.shipping_details = get_shipping_details(i_transaction)
13
+ transaction.token_customer_id = i_transaction.token_customer_id
13
14
  transaction.options = i_transaction.options
14
15
  transaction
15
16
  end
@@ -12,6 +12,14 @@ module EwayRapid
12
12
  transaction_status.total = transaction.total_amount
13
13
  transaction_status.processing_details = get_processing_details(transaction)
14
14
  transaction_status.verification_result = get_verification_result(transaction)
15
+ transaction_status.transaction_date_time = transaction.transaction_date_time
16
+ transaction_status.transaction_captured = transaction.transaction_captured
17
+ transaction_status.source = transaction.source
18
+ transaction_status.max_refund = transaction.max_refund
19
+ transaction_status.original_transaction_id = transaction.original_transaction_id
20
+ transaction_status.fraud_action = transaction.fraud_action
21
+ transaction_status.currency_code = transaction.currency_code
22
+
15
23
  begin
16
24
  transaction_status.transaction_id = Integer(transaction.transaction_id) if transaction.transaction_id
17
25
  rescue
@@ -44,7 +44,11 @@ module EwayRapid
44
44
  end
45
45
 
46
46
  request.method = if transaction.capture
47
- Enums::RequestMethod::PROCESS_PAYMENT
47
+ if transaction.customer && (transaction.customer.token_customer_id || transaction.save_customer)
48
+ Enums::RequestMethod::TOKEN_PAYMENT
49
+ else
50
+ Enums::RequestMethod::PROCESS_PAYMENT
51
+ end
48
52
  else
49
53
  Enums::RequestMethod::AUTHORISE
50
54
  end
@@ -40,7 +40,11 @@ module EwayRapid
40
40
  request.options = option_converter.do_convert(input)
41
41
 
42
42
  request.method = if input.capture
43
- Enums::RequestMethod::PROCESS_PAYMENT
43
+ if input.customer && (input.customer.token_customer_id || input.save_customer)
44
+ Enums::RequestMethod::TOKEN_PAYMENT
45
+ else
46
+ Enums::RequestMethod::PROCESS_PAYMENT
47
+ end
44
48
  else
45
49
  Enums::RequestMethod::AUTHORISE
46
50
  end
@@ -30,6 +30,7 @@ module EwayRapid
30
30
  request.device_id = input.device_id
31
31
  request.partner_id = input.partner_id
32
32
  request.transaction_type = input.transaction_type || ''
33
+ request.secured_card_data = input.secured_card_data
33
34
  request.method = if input.capture
34
35
  Enums::RequestMethod::PROCESS_PAYMENT
35
36
  else
@@ -18,6 +18,7 @@ module EwayRapid
18
18
  transaction_response.errors = response.errors.split(/\s*,\s*/) if response.errors
19
19
  transaction_response.access_code = response.access_code
20
20
  transaction_response.form_action_url = response.form_action_url
21
+ transaction_response.amex_ec_data = response.amex_ec_data
21
22
  transaction_response
22
23
  end
23
24
  end
@@ -15,6 +15,7 @@ module EwayRapid
15
15
  request.customer_ip = input.customer_device_ip
16
16
  request.method = Constants::CREATE_TOKEN_CUSTOMER_METHOD
17
17
  request.transaction_type = Enums::TransactionType::MOTO
18
+ request.secured_card_data = input.secured_card_data
18
19
  request
19
20
  end
20
21
 
@@ -23,9 +24,9 @@ module EwayRapid
23
24
  # @param [String] password
24
25
  # @param [DirectPaymentRequest] request
25
26
  # @return [String]
26
- def self.send_request(url, api_key, password, request)
27
+ def self.send_request(url, api_key, password, version, request)
27
28
  begin
28
- CustDirectPaymentMsgProcess.new.do_post(url, api_key, password, request)
29
+ CustDirectPaymentMsgProcess.new.do_post(url, api_key, password, version, request)
29
30
  rescue SocketError => e
30
31
  raise Exceptions::CommunicationFailureException.new(e.message)
31
32
  rescue RestClient::Exception => e
@@ -68,8 +69,8 @@ module EwayRapid
68
69
  # @param [String] password
69
70
  # @param [CreateAccessCodeSharedRequest] request
70
71
  # @return [String]
71
- def self.send_request(url, api_key, password, request)
72
- CustResponsiveSharedMsgProcess.new.do_post(url, api_key, password, request)
72
+ def self.send_request(url, api_key, password, version, request)
73
+ CustResponsiveSharedMsgProcess.new.do_post(url, api_key, password, version, request)
73
74
  end
74
75
 
75
76
  # @param [String] response
@@ -102,8 +103,8 @@ module EwayRapid
102
103
  # @param [String] password
103
104
  # @param [CreateAccessCodeRequest] request
104
105
  # @return [String]
105
- def self.send_request(url, api_key, password, request)
106
- CustTransparentRedirectMsgProcess.new.do_post(url, api_key, password, request)
106
+ def self.send_request(url, api_key, password, version, request)
107
+ CustTransparentRedirectMsgProcess.new.do_post(url, api_key, password, version, request)
107
108
  end
108
109
 
109
110
  # @param [String] response
@@ -129,8 +130,8 @@ module EwayRapid
129
130
 
130
131
  # @param [DirectCustomerSearchRequest] request
131
132
  # @return [String]
132
- def self.send_request(url, api_key, password, request)
133
- QueryCustomerMsgProcess.new.do_post(url, api_key, password, request)
133
+ def self.send_request(url, api_key, password, version, request)
134
+ QueryCustomerMsgProcess.new.do_post(url, api_key, password, version, request)
134
135
  end
135
136
 
136
137
  # @param [String] response
@@ -165,8 +166,8 @@ module EwayRapid
165
166
  # @param [String] api_key
166
167
  # @param [String] password
167
168
  # @param [DirectPaymentRequest] request
168
- def self.send_request(url, api_key, password, request)
169
- CustDirectUpdateMsgProcess.new.do_post(url, api_key, password, request)
169
+ def self.send_request(url, api_key, password, version, request)
170
+ CustDirectUpdateMsgProcess.new.do_post(url, api_key, password, version, request)
170
171
  end
171
172
 
172
173
  # @param [String] response
@@ -202,8 +203,8 @@ module EwayRapid
202
203
  # @param [String] api_key
203
204
  # @param [String] password
204
205
  # @param [CreateAccessCodeSharedRequest] request
205
- def self.send_request(url, api_key, password, request)
206
- CustResponsiveUpdateMsgProcess.new.do_post(url, api_key, password, request)
206
+ def self.send_request(url, api_key, password, version, request)
207
+ CustResponsiveUpdateMsgProcess.new.do_post(url, api_key, password, version, request)
207
208
  end
208
209
 
209
210
  # @param [String] response
@@ -238,8 +239,8 @@ module EwayRapid
238
239
  # @param [String] api_key
239
240
  # @param [String] password
240
241
  # @param [CreateAccessCodeRequest] request
241
- def self.send_request(url, api_key, password, request)
242
- CustTransparentUpdateMsgProcess.new.do_post(url, api_key, password, request)
242
+ def self.send_request(url, api_key, password, version, request)
243
+ CustTransparentUpdateMsgProcess.new.do_post(url, api_key, password, version, request)
243
244
  end
244
245
 
245
246
  # @param [String] response
@@ -15,10 +15,10 @@ module EwayRapid
15
15
 
16
16
  # @param [DirectRefundRequest] request
17
17
  # @return [String]
18
- def self.send_request(url, api_key, password, request)
18
+ def self.send_request(url, api_key, password, version, request)
19
19
  url = url + '/' + request.refund.original_transaction_id.to_s + '/' + Constants::REFUND_SUB_PATH_METHOD
20
20
  url = URI.encode(url)
21
- RefundMsgProcess.new.do_post(url, api_key, password, request)
21
+ RefundMsgProcess.new.do_post(url, api_key, password, version, request)
22
22
  end
23
23
 
24
24
  # @param [String] response
@@ -49,8 +49,8 @@ module EwayRapid
49
49
  request
50
50
  end
51
51
 
52
- def self.send_request(url, api_key, password, request)
53
- CancelAuthorisationMsgProcess.new.do_post(url, api_key, password, request)
52
+ def self.send_request(url, api_key, password, version, request)
53
+ CancelAuthorisationMsgProcess.new.do_post(url, api_key, password, version, request)
54
54
  end
55
55
 
56
56
  # @param [String] response
@@ -8,7 +8,7 @@ module EwayRapid
8
8
  # @param [String] api_key rapid api key
9
9
  # @param [String] password rapid password
10
10
  # @param [String] request object to post
11
- def do_post(url, api_key, password, request)
11
+ def do_post(url, api_key, password, version, request)
12
12
  begin
13
13
  RestClient::Request.execute(
14
14
  :method => :post,
@@ -17,10 +17,12 @@ module EwayRapid
17
17
  :password => password,
18
18
  :payload => request.to_json,
19
19
  :timeout => 9000000,
20
+ :ssl_version => 'TLSv1_2',
20
21
  :headers => {
21
22
  :accept => :json,
22
23
  :content_type => :json,
23
- :user_agent => get_user_agent
24
+ :user_agent => get_user_agent,
25
+ :'X-EWAY-APIVERSION' => version
24
26
  }
25
27
  )
26
28
  rescue SocketError => e
@@ -39,17 +41,19 @@ module EwayRapid
39
41
  # @param [String] url rapid endpoint url
40
42
  # @param [String] api_key rapid api key
41
43
  # @param [String] password rapid password
42
- def do_get(url, api_key, password)
44
+ def do_get(url, api_key, password, version)
43
45
  begin
44
46
  RestClient::Request.new(
45
47
  :method => :get,
46
48
  :url => url,
47
49
  :user => api_key,
48
50
  :password => password,
51
+ :ssl_version => 'TLSv1_2',
49
52
  :headers => {
50
53
  :accept => :json,
51
54
  :content_type => :json,
52
- :user_agent => get_user_agent
55
+ :user_agent => get_user_agent,
56
+ :'X-EWAY-APIVERSION' => version
53
57
  }
54
58
  ).execute
55
59
  rescue SocketError => e
@@ -18,8 +18,8 @@ module EwayRapid
18
18
  # @param [String] password
19
19
  # @param [DirectPaymentRequest] request
20
20
  # @return [String]
21
- def self.send_request(url, api_key, password, request)
22
- TransDirectPaymentMsgProcess.new.do_post(url, api_key, password, request)
21
+ def self.send_request(url, api_key, password, version, request)
22
+ TransDirectPaymentMsgProcess.new.do_post(url, api_key, password, version, request)
23
23
  end
24
24
 
25
25
  # @param [String] response
@@ -47,8 +47,8 @@ module EwayRapid
47
47
  # @param [String] password
48
48
  # @param [CreateAccessCodeSharedRequest] request
49
49
  # @return [String]
50
- def self.send_request(url, api_key, password, request)
51
- TransResponsiveSharedMsgProcess.new.do_post(url, api_key, password, request)
50
+ def self.send_request(url, api_key, password, version, request)
51
+ TransResponsiveSharedMsgProcess.new.do_post(url, api_key, password, version, request)
52
52
  end
53
53
 
54
54
  # @param [String] response
@@ -76,8 +76,8 @@ module EwayRapid
76
76
  # @param [String] password
77
77
  # @param [CreateAccessCodeRequest] request
78
78
  # @return [String]
79
- def self.send_request(url, api_key, password, request)
80
- TransTransparentRedirectMsgProcess.new.do_post(url, api_key, password, request)
79
+ def self.send_request(url, api_key, password, version, request)
80
+ TransTransparentRedirectMsgProcess.new.do_post(url, api_key, password, version, request)
81
81
  end
82
82
 
83
83
  # @param [String] response
@@ -105,8 +105,8 @@ module EwayRapid
105
105
  # @param [String] password
106
106
  # @param [CapturePaymentRequest] request
107
107
  # @return [String]
108
- def self.send_request(url, api_key, password, request)
109
- CapturePaymentMsgProcess.new.do_post(url, api_key, password, request)
108
+ def self.send_request(url, api_key, password, version, request)
109
+ CapturePaymentMsgProcess.new.do_post(url, api_key, password, version, request)
110
110
  end
111
111
 
112
112
  # @param [String] response
@@ -122,8 +122,8 @@ module EwayRapid
122
122
  class TransQueryMsgProcess
123
123
  include RestProcess
124
124
 
125
- def self.process_post_msg(url, api_key, password)
126
- TransQueryMsgProcess.new.do_get(url, api_key, password)
125
+ def self.process_post_msg(url, api_key, password, version)
126
+ TransQueryMsgProcess.new.do_get(url, api_key, password, version)
127
127
  end
128
128
 
129
129
  # @param [String] response
@@ -148,8 +148,8 @@ module EwayRapid
148
148
  URI.encode_www_form(hash)
149
149
  end
150
150
 
151
- def self.send_request(url, api_key, password)
152
- SettlementSearchMsgProcess.new.do_get(url, api_key, password)
151
+ def self.send_request(url, api_key, password, version)
152
+ SettlementSearchMsgProcess.new.do_get(url, api_key, password, version)
153
153
  end
154
154
 
155
155
  def self.make_result(response)
@@ -334,6 +334,13 @@ module EwayRapid
334
334
  attr_accessor :customer
335
335
  attr_accessor :shipping_address
336
336
  attr_accessor :beagle_verification
337
+ attr_accessor :transaction_date_time
338
+ attr_accessor :transaction_captured
339
+ attr_accessor :source
340
+ attr_accessor :max_refund
341
+ attr_accessor :original_transaction_id
342
+ attr_accessor :fraud_action
343
+ attr_accessor :currency_code
337
344
  attr_accessor :errors
338
345
 
339
346
  def to_json(opts={})
@@ -353,7 +360,13 @@ module EwayRapid
353
360
  hash[Constants::VERIFICATION] = verification if verification
354
361
  hash[Constants::CUSTOMER] = customer if customer
355
362
  hash[Constants::SHIPPING_ADDRESS] = shipping_address if shipping_address
356
- hash[Constants::BEAGLE_VERIFICATION] = beagle_verification if beagle_verification
363
+ hash[Constants::TRANSACTION_DATE] = transaction_date_time if transaction_date_time
364
+ hash[Constants::TRANSACTION_CAPTURED] = transaction_captured if transaction_captured
365
+ hash[Constants::SOURCE] = source if source
366
+ hash[Constants::MAX_REFUND] = max_refund if max_refund
367
+ hash[Constants::ORIGINAL_TRANSACTION] = original_transaction_id if original_transaction_id
368
+ hash[Constants::FRAUD_ACTION] = fraud_action if fraud_action
369
+ hash[Constants::CURRENCY_CODE] = currency_code if currency_code
357
370
  hash[Constants::ERRORS] = errors if errors
358
371
  hash.to_json
359
372
  end
@@ -381,6 +394,13 @@ module EwayRapid
381
394
  transaction.customer = Customer.from_hash(hash[Constants::CUSTOMER])
382
395
  transaction.shipping_address = ShippingAddress.from_hash(hash[Constants::SHIPPING_ADDRESS])
383
396
  transaction.beagle_verification = BeagleVerification.from_hash(hash[Constants::BEAGLE_VERIFICATION])
397
+ transaction.transaction_date_time = hash[Constants::TRANSACTION_DATE]
398
+ transaction.transaction_captured = hash[Constants::TRANSACTION_CAPTURED]
399
+ transaction.source = hash[Constants::SOURCE]
400
+ transaction.max_refund = hash[Constants::MAX_REFUND]
401
+ transaction.original_transaction_id = hash[Constants::ORIGINAL_TRANSACTION]
402
+ transaction.fraud_action = hash[Constants::FRAUD_ACTION]
403
+ transaction.currency_code = hash[Constants::CURRENCY_CODE]
384
404
  transaction.errors = hash[Constants::ERRORS]
385
405
  transaction
386
406
  end
@@ -82,6 +82,7 @@ module EwayRapid
82
82
  attr_accessor :redirect_url
83
83
  attr_accessor :cancel_url
84
84
  attr_accessor :customer_device_ip
85
+ attr_accessor :secured_card_data
85
86
  end
86
87
 
87
88
  # Item information
@@ -290,6 +291,36 @@ module EwayRapid
290
291
  # The URL of the merchant's logo to display on the Responsive Shared Page
291
292
  attr_accessor :logo_url
292
293
 
294
+ # (v40+ only) A token used to configure AMEX Express Checkout
295
+ attr_accessor :amex_ec_data
296
+
297
+ # (v40+ query response only) The date and time the transaction took place
298
+ attr_accessor :transaction_date_time
299
+
300
+ # (v40+ query response only) True if funds were captured in the transaction
301
+ attr_accessor :transaction_captured
302
+
303
+ # (v40+ query response only) Reserved for future use
304
+ attr_accessor :source
305
+
306
+ # (v40+ query response only) The maximum amount that could be refunded from this transaction
307
+ attr_accessor :max_refund
308
+
309
+ # (v40+ query response only) Contains the original transaction ID if the queried transaction is a refund
310
+ attr_accessor :original_transaction_id
311
+
312
+ # (v40+ query response only) The fraud action that occurred if any. One of NotChallenged, Allow, Review, PreAuth, Processed, Approved, Block
313
+ attr_accessor :fraud_action
314
+
315
+ #(v40+ query response only) The ISO 4217 numeric currency code (e.g. AUD = 036)
316
+ attr_accessor :currency_code
317
+
318
+ # Set to true to create a token customer when the transaction is complete
319
+ attr_accessor :save_customer
320
+
321
+ # An eWAY-issued ID that represents the Token customer that was loaded or created for this transaction (if applicable)
322
+ attr_accessor :token_customer_id
323
+
293
324
  alias_method :customer_read_only?, :customer_read_only
294
325
  alias_method :checkout_payment?, :checkout_payment
295
326
  alias_method :verify_customer_phone?, :verify_customer_phone
@@ -311,6 +342,15 @@ module EwayRapid
311
342
  attr_accessor :verification_result
312
343
  attr_accessor :processing_details
313
344
 
345
+ # (v40+ query response only)
346
+ attr_accessor :transaction_date_time
347
+ attr_accessor :transaction_captured
348
+ attr_accessor :source
349
+ attr_accessor :max_refund
350
+ attr_accessor :original_transaction_id
351
+ attr_accessor :fraud_action
352
+ attr_accessor :currency_code
353
+
314
354
  alias_method :status?, :status
315
355
  end
316
356
 
@@ -20,5 +20,8 @@ module EwayRapid
20
20
  # and Responsive Shared)
21
21
  attr_accessor :access_code
22
22
 
23
+ # (v40+ only) A token used to configure AMEX Express Checkout
24
+ attr_accessor :amex_ec_data
25
+
23
26
  end
24
27
  end
@@ -16,6 +16,7 @@ module EwayRapid
16
16
  @api_key = api_key
17
17
  @password = password
18
18
  @rapid_endpoint = rapid_endpoint
19
+ @version = 31
19
20
 
20
21
  validate_api_param
21
22
  end
@@ -31,6 +32,13 @@ module EwayRapid
31
32
  validate_api_param
32
33
  end
33
34
 
35
+ # Sets the Rapid API version to use (e.g. 40)
36
+ #
37
+ # @param [Integer] version eWAY Rapid API version
38
+ def set_version(version)
39
+ @version = version
40
+ end
41
+
34
42
  # Creates a transaction either using an authorisation, the responsive shared
35
43
  # page, transparent redirect, or direct as the source of funds
36
44
  #
@@ -47,39 +55,39 @@ module EwayRapid
47
55
  url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX
48
56
 
49
57
  request = Message::TransactionProcess::TransDirectPaymentMsgProcess.create_request(transaction)
50
- response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, request)
58
+ response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
51
59
  Message::TransactionProcess::TransDirectPaymentMsgProcess.make_result(response)
52
60
  when Enums::PaymentMethod::RESPONSIVE_SHARED
53
61
  url = @web_url + Constants::RESPONSIVE_SHARED_METHOD_NAME + Constants::JSON_SUFFIX
54
62
 
55
63
  request = Message::TransactionProcess::TransResponsiveSharedMsgProcess.create_request(transaction)
56
- response = Message::TransactionProcess::TransResponsiveSharedMsgProcess.send_request(url, @api_key, @password, request)
64
+ response = Message::TransactionProcess::TransResponsiveSharedMsgProcess.send_request(url, @api_key, @password, @version, request)
57
65
  Message::TransactionProcess::TransResponsiveSharedMsgProcess.make_result(response)
58
66
  when Enums::PaymentMethod::TRANSPARENT_REDIRECT
59
67
  url = @web_url + Constants::TRANSPARENT_REDIRECT_METHOD_NAME + Constants::JSON_SUFFIX
60
68
 
61
69
  request = Message::TransactionProcess::TransTransparentRedirectMsgProcess.create_request(transaction)
62
- response = Message::TransactionProcess::TransTransparentRedirectMsgProcess.send_request(url, @api_key, @password, request)
70
+ response = Message::TransactionProcess::TransTransparentRedirectMsgProcess.send_request(url, @api_key, @password, @version, request)
63
71
  Message::TransactionProcess::TransTransparentRedirectMsgProcess.make_result(response)
64
72
  when Enums::PaymentMethod::WALLET
65
73
  if transaction.capture
66
74
  url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX
67
75
 
68
76
  request = Message::TransactionProcess::TransDirectPaymentMsgProcess.create_request(transaction)
69
- response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, request)
77
+ response = Message::TransactionProcess::TransDirectPaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
70
78
  Message::TransactionProcess::TransDirectPaymentMsgProcess.make_result(response)
71
79
  else
72
80
  url = @web_url + Constants::CAPTURE_PAYMENT_METHOD
73
81
 
74
82
  request = Message::TransactionProcess::CapturePaymentMsgProcess.create_request(transaction)
75
- response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, request)
83
+ response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
76
84
  Message::TransactionProcess::CapturePaymentMsgProcess.make_result(response)
77
85
  end
78
86
  when Enums::PaymentMethod::AUTHORISATION
79
87
  url = @web_url + Constants::CAPTURE_PAYMENT_METHOD
80
88
 
81
89
  request = Message::TransactionProcess::CapturePaymentMsgProcess.create_request(transaction)
82
- response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, request)
90
+ response = Message::TransactionProcess::CapturePaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
83
91
  Message::TransactionProcess::CapturePaymentMsgProcess.make_result(response)
84
92
  else
85
93
  make_response_with_exception(Exceptions::ParameterInvalidException.new('Unsupported payment type'), CreateTransactionResponse)
@@ -144,7 +152,7 @@ module EwayRapid
144
152
  url = @web_url + Constants::TRANSACTION_METHOD
145
153
 
146
154
  request = Message::RefundProcess::RefundMsgProcess.create_request(refund)
147
- response = Message::RefundProcess::RefundMsgProcess.send_request(url, @api_key, @password, request)
155
+ response = Message::RefundProcess::RefundMsgProcess.send_request(url, @api_key, @password, @version, request)
148
156
  Message::RefundProcess::RefundMsgProcess.make_result(response)
149
157
  rescue => e
150
158
  @logger.error(e.to_s) if @logger
@@ -164,7 +172,7 @@ module EwayRapid
164
172
  url = @web_url + Constants::CANCEL_AUTHORISATION_METHOD
165
173
 
166
174
  request = Message::RefundProcess::CancelAuthorisationMsgProcess.create_request(refund)
167
- response = Message::RefundProcess::CancelAuthorisationMsgProcess.send_request(url, @api_key, @password, request)
175
+ response = Message::RefundProcess::CancelAuthorisationMsgProcess.send_request(url, @api_key, @password, @version, request)
168
176
  Message::RefundProcess::CancelAuthorisationMsgProcess.make_result(response)
169
177
  rescue => e
170
178
  @logger.error(e.to_s) if @logger
@@ -188,19 +196,19 @@ module EwayRapid
188
196
  url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX
189
197
 
190
198
  request = Message::CustomerProcess::CustDirectPaymentMsgProcess.create_request(customer)
191
- response = Message::CustomerProcess::CustDirectPaymentMsgProcess.send_request(url, @api_key, @password, request)
199
+ response = Message::CustomerProcess::CustDirectPaymentMsgProcess.send_request(url, @api_key, @password, @version, request)
192
200
  Message::CustomerProcess::CustDirectPaymentMsgProcess.make_result(response)
193
201
  when Enums::PaymentMethod::RESPONSIVE_SHARED
194
202
  url = @web_url + Constants::RESPONSIVE_SHARED_METHOD_NAME + Constants::JSON_SUFFIX
195
203
 
196
204
  request = Message::CustomerProcess::CustResponsiveSharedMsgProcess.create_request(customer)
197
- response = Message::CustomerProcess::CustResponsiveSharedMsgProcess.send_request(url, @api_key, @password, request)
205
+ response = Message::CustomerProcess::CustResponsiveSharedMsgProcess.send_request(url, @api_key, @password, @version, request)
198
206
  Message::CustomerProcess::CustResponsiveSharedMsgProcess.make_result(response)
199
207
  when Enums::PaymentMethod::TRANSPARENT_REDIRECT
200
208
  url = @web_url + Constants::TRANSPARENT_REDIRECT_METHOD_NAME + Constants::JSON_SUFFIX
201
209
 
202
210
  request = Message::CustomerProcess::CustTransparentRedirectMsgProcess.create_request(customer)
203
- response = Message::CustomerProcess::CustTransparentRedirectMsgProcess.send_request(url, @api_key, @password, request)
211
+ response = Message::CustomerProcess::CustTransparentRedirectMsgProcess.send_request(url, @api_key, @password, @version, request)
204
212
  Message::CustomerProcess::CustTransparentRedirectMsgProcess.make_result(response)
205
213
  else
206
214
  make_response_with_exception(Exceptions::ParameterInvalidException.new('Unsupported payment type'), CreateCustomerResponse)
@@ -225,19 +233,19 @@ module EwayRapid
225
233
  when Enums::PaymentMethod::DIRECT
226
234
  url = @web_url + Constants::DIRECT_PAYMENT_METHOD_NAME + Constants::JSON_SUFFIX
227
235
  request = Message::CustomerProcess::CustDirectUpdateMsgProcess.create_request(customer)
228
- response = Message::CustomerProcess::CustDirectUpdateMsgProcess.send_request(url, @api_key, @password, request)
236
+ response = Message::CustomerProcess::CustDirectUpdateMsgProcess.send_request(url, @api_key, @password, @version, request)
229
237
  Message::CustomerProcess::CustDirectUpdateMsgProcess.make_result(response)
230
238
  when Enums::PaymentMethod::RESPONSIVE_SHARED
231
239
  url = @web_url + Constants::RESPONSIVE_SHARED_METHOD_NAME + Constants::JSON_SUFFIX
232
240
 
233
241
  request = Message::CustomerProcess::CustResponsiveUpdateMsgProcess.create_request(customer)
234
- response = Message::CustomerProcess::CustResponsiveUpdateMsgProcess.send_request(url, @api_key, @password, request)
242
+ response = Message::CustomerProcess::CustResponsiveUpdateMsgProcess.send_request(url, @api_key, @password, @version, request)
235
243
  Message::CustomerProcess::CustResponsiveUpdateMsgProcess.make_result(response)
236
244
  when Enums::PaymentMethod::TRANSPARENT_REDIRECT
237
245
  url = @web_url + Constants::TRANSPARENT_REDIRECT_METHOD_NAME + Constants::JSON_SUFFIX
238
246
 
239
247
  request = Message::CustomerProcess::CustTransparentUpdateMsgProcess.create_request(customer)
240
- response = Message::CustomerProcess::CustTransparentUpdateMsgProcess.send_request(url, @api_key, @password, request)
248
+ response = Message::CustomerProcess::CustTransparentUpdateMsgProcess.send_request(url, @api_key, @password, @version, request)
241
249
  Message::CustomerProcess::CustTransparentUpdateMsgProcess.make_result(response)
242
250
  else
243
251
  return make_response_with_exception(Exceptions::ParameterInvalidException.new('Unsupported payment type'), CreateCustomerResponse)
@@ -263,7 +271,7 @@ module EwayRapid
263
271
  url = URI.encode(url)
264
272
 
265
273
  request = Message::CustomerProcess::QueryCustomerMsgProcess.create_request(token_customer_id.to_s)
266
- response = Message::CustomerProcess::QueryCustomerMsgProcess.send_request(url, @api_key, @password, request)
274
+ response = Message::CustomerProcess::QueryCustomerMsgProcess.send_request(url, @api_key, @password, @version, request)
267
275
  Message::CustomerProcess::QueryCustomerMsgProcess.make_result(response)
268
276
  rescue => e
269
277
  @logger.error(e.to_s) if @logger
@@ -284,7 +292,7 @@ module EwayRapid
284
292
  request = Message::TransactionProcess::SettlementSearchMsgProcess.create_request(search_request)
285
293
  url = @web_url + Constants::SETTLEMENT_SEARCH_METHOD + request
286
294
 
287
- response = Message::TransactionProcess::SettlementSearchMsgProcess.send_request(url, @api_key, @password)
295
+ response = Message::TransactionProcess::SettlementSearchMsgProcess.send_request(url, @api_key, @password, @version)
288
296
  Message::TransactionProcess::SettlementSearchMsgProcess.make_result(response)
289
297
 
290
298
  rescue => e
@@ -335,7 +343,7 @@ module EwayRapid
335
343
  end
336
344
  url = URI.encode(url)
337
345
 
338
- response = Message::TransactionProcess::TransQueryMsgProcess.process_post_msg(url, @api_key, @password)
346
+ response = Message::TransactionProcess::TransQueryMsgProcess.process_post_msg(url, @api_key, @password, @version)
339
347
  Message::TransactionProcess::TransQueryMsgProcess.make_result(response)
340
348
  rescue => e
341
349
  @logger.error(e.to_s) if @logger
@@ -1,3 +1,3 @@
1
1
  module EwayRapid
2
- VERSION = '1.2.1'
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eway_rapid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - eWAY
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-19 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -16,62 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.8.3
19
+ version: 2.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.8.3
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.8.0
34
- - - "<"
31
+ - - "~>"
35
32
  - !ruby/object:Gem::Version
36
- version: '3.0'
33
+ version: '2.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 1.8.0
44
- - - "<"
38
+ - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '3.0'
40
+ version: '2.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: bundler
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '1.10'
47
+ version: '1.17'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '1.10'
54
+ version: '1.17'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: rake
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - "~>"
66
60
  - !ruby/object:Gem::Version
67
- version: '10.0'
61
+ version: '12.0'
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
66
  - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: '10.0'
68
+ version: '12.0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: test-unit
77
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +94,20 @@ dependencies:
100
94
  - - ">="
101
95
  - !ruby/object:Gem::Version
102
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
103
111
  description: Easy online payments with eWAY and the eWAY Rapid Ruby gem.
104
112
  email:
105
113
  executables: []
@@ -197,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
205
  requirements:
198
206
  - - ">="
199
207
  - !ruby/object:Gem::Version
200
- version: 1.9.3
208
+ version: 2.0.0
201
209
  required_rubygems_version: !ruby/object:Gem::Requirement
202
210
  requirements:
203
211
  - - ">="
@@ -205,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
213
  version: '0'
206
214
  requirements: []
207
215
  rubyforge_project:
208
- rubygems_version: 2.4.5.1
216
+ rubygems_version: 2.7.6
209
217
  signing_key:
210
218
  specification_version: 4
211
219
  summary: Ruby gem for eWAY's Rapid API