activemerchant 1.89.0 → 1.90.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
2
  SHA256:
3
- metadata.gz: fdeabb7b3450080d2817ffacaa19763da578a7af135d41539bff63857f92d8c5
4
- data.tar.gz: ffc300e51e51b3895a3719c165d9732980885c3e47024f60929742fb0a6ce66c
3
+ metadata.gz: '0966806ab488c5e7ce61def32caf6d697a360f41e8044398309b58e3318396b0'
4
+ data.tar.gz: 9793482a76e42cfab91c5918153f629c66fdfccbaeff49489eb06a9d97d892bb
5
5
  SHA512:
6
- metadata.gz: 673d733fff52ede8aeb3c2da8d8452ad37d9b3efdf676686b8fbf2828b6556c5e44158ada81ec70f226b26626f59ffd5fcbca0a7e5e03ad0cb0dfc12a22e181d
7
- data.tar.gz: 1197d9aa884da3d084e6e3e0d09700c29dcbdf8b9f7e003ea97f55fb369284ea718261ac4f1e7ca37154e8105c3282a7f641221062d2dae46a976f5939009873
6
+ metadata.gz: 7a852cfc08faedf04bac009e0facd471e8387882b2e340ba9428bb71c67b8480cedd626ca6a663262f0269d7c42923caec65c8e0e23ad6980346763a4739a234
7
+ data.tar.gz: cc5a90ebd00682fda94ab7898529570ca0fce25f23cb1d1049b2055feedbcf1fe172ec0fed2712f9a1b04ee4c18747297f389079fae0ca281f3110aa68bcad0a
data/CHANGELOG CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  == HEAD
4
4
 
5
+ == Version 1.90.0 (January 8, 2019)
6
+ * Mercado Pago: Support "gateway" processing mode [curiousepic] #3087
7
+ * Braintree: Update gem to latest version [curiousepic] #3091
8
+ * Adyen: Pass arbitrary riskData fields [curiousepic] #3089
9
+ * Worldpay: Fix cookie header name [curiousepic] #3099
10
+ * Paymentez: Adds support for extra_params optional field [molbrown] #3095
11
+ * Braintree Blue: Support Level 2 and 3 data fields [curiousepic] #3094
12
+ * Braintree Blue: Refactor line_items field [curiousepic] #3100
13
+ * TrustCommerce: Use `application_id` [nfarve] #3103
14
+ * Stripe: Add 3DS Support [nfarve] #3086
15
+
5
16
  == Version 1.89.0 (December 17, 2018)
6
17
  * Worldpay: handle Visa and MasterCard payouts differently [bpollack] #3068
7
18
  * QuickPay: update supported countries [ta] #3049
@@ -18,6 +29,7 @@
18
29
  * Adyen: Add 3DS Fix [nfarve] #3081
19
30
  * Payeezy: Add `stored_credentials` [nfarve] #3083
20
31
  * Fix CVC validation for 0 length CVC [filipebarcos] #3082
32
+ * NMI: Supports vendor_id and processor_id fields [molbrown] #3085
21
33
 
22
34
  == Version 1.88.0 (November 30, 2018)
23
35
  * Added ActiveSupport/Rails master support [Edouard-chin] #3065
@@ -159,6 +159,14 @@ module ActiveMerchant #:nodoc:
159
159
  post[:additionalData][:overwriteBrand] = normalize(options[:overwrite_brand]) if options[:overwrite_brand]
160
160
  post[:additionalData][:customRoutingFlag] = options[:custom_routing_flag] if options[:custom_routing_flag]
161
161
  post[:additionalData]['paymentdatasource.type'] = NETWORK_TOKENIZATION_CARD_SOURCE[payment.source.to_s] if payment.is_a?(NetworkTokenizationCreditCard)
162
+ add_risk_data(post, options)
163
+ end
164
+
165
+ def add_risk_data(post, options)
166
+ risk_data = {}
167
+ risk_data.merge!(options[:risk_data]) if options[:risk_data]
168
+
169
+ post[:additionalData][:riskData] = risk_data unless risk_data.empty?
162
170
  end
163
171
 
164
172
  def add_shopper_interaction(post, payment, options={})
@@ -445,6 +445,7 @@ module ActiveMerchant #:nodoc:
445
445
 
446
446
  def create_transaction(transaction_type, money, credit_card_or_vault_id, options)
447
447
  transaction_params = create_transaction_parameters(money, credit_card_or_vault_id, options)
448
+
448
449
  commit do
449
450
  result = @braintree_gateway.transaction.send(transaction_type, transaction_params)
450
451
  response = Response.new(result.success?, message_from_transaction_result(result), response_params(result), response_options(result))
@@ -588,6 +589,44 @@ module ActiveMerchant #:nodoc:
588
589
  parameters[:recurring] = true
589
590
  end
590
591
 
592
+ add_payment_method(parameters, credit_card_or_vault_id, options)
593
+
594
+ parameters[:billing] = map_address(options[:billing_address]) if options[:billing_address]
595
+ parameters[:shipping] = map_address(options[:shipping_address]) if options[:shipping_address]
596
+
597
+ channel = @options[:channel] || application_id
598
+ parameters[:channel] = channel if channel
599
+
600
+ if options[:descriptor_name] || options[:descriptor_phone] || options[:descriptor_url]
601
+ parameters[:descriptor] = {
602
+ name: options[:descriptor_name],
603
+ phone: options[:descriptor_phone],
604
+ url: options[:descriptor_url]
605
+ }
606
+ end
607
+
608
+ if options[:three_d_secure]
609
+ parameters[:three_d_secure_pass_thru] = {
610
+ cavv: options[:three_d_secure][:cavv],
611
+ eci_flag: options[:three_d_secure][:eci],
612
+ xid: options[:three_d_secure][:xid],
613
+ }
614
+ end
615
+
616
+ parameters[:tax_amount] = options[:tax_amount] if options[:tax_amount]
617
+ parameters[:tax_exempt] = options[:tax_exempt] if options[:tax_exempt]
618
+ parameters[:purchase_order_number] = options[:purchase_order_number] if options[:purchase_order_number]
619
+
620
+ parameters[:shipping_amount] = options[:shipping_amount] if options[:shipping_amount]
621
+ parameters[:discount_amount] = options[:discount_amount] if options[:discount_amount]
622
+ parameters[:ships_from_postal_code] = options[:ships_from_postal_code] if options[:ships_from_postal_code]
623
+
624
+ parameters[:line_items] = options[:line_items] if options[:line_items]
625
+
626
+ parameters
627
+ end
628
+
629
+ def add_payment_method(parameters, credit_card_or_vault_id, options)
591
630
  if credit_card_or_vault_id.is_a?(String) || credit_card_or_vault_id.is_a?(Integer)
592
631
  if options[:payment_method_token]
593
632
  parameters[:payment_method_token] = credit_card_or_vault_id
@@ -634,29 +673,6 @@ module ActiveMerchant #:nodoc:
634
673
  }
635
674
  end
636
675
  end
637
- parameters[:billing] = map_address(options[:billing_address]) if options[:billing_address]
638
- parameters[:shipping] = map_address(options[:shipping_address]) if options[:shipping_address]
639
-
640
- channel = @options[:channel] || application_id
641
- parameters[:channel] = channel if channel
642
-
643
- if options[:descriptor_name] || options[:descriptor_phone] || options[:descriptor_url]
644
- parameters[:descriptor] = {
645
- name: options[:descriptor_name],
646
- phone: options[:descriptor_phone],
647
- url: options[:descriptor_url]
648
- }
649
- end
650
-
651
- if options[:three_d_secure]
652
- parameters[:three_d_secure_pass_thru] = {
653
- cavv: options[:three_d_secure][:cavv],
654
- eci_flag: options[:three_d_secure][:eci],
655
- xid: options[:three_d_secure][:xid],
656
- }
657
- end
658
-
659
- parameters
660
676
  end
661
677
  end
662
678
  end
@@ -95,6 +95,7 @@ module ActiveMerchant #:nodoc:
95
95
  add_additional_data(post, options)
96
96
  add_customer_data(post, payment, options)
97
97
  add_address(post, options)
98
+ add_processing_mode(post, options)
98
99
  post[:binary_mode] = (options[:binary_mode].nil? ? true : options[:binary_mode])
99
100
  post
100
101
  end
@@ -105,6 +106,21 @@ module ActiveMerchant #:nodoc:
105
106
  post
106
107
  end
107
108
 
109
+ def add_processing_mode(post, options)
110
+ return unless options[:processing_mode]
111
+ post[:processing_mode] = options[:processing_mode]
112
+ post[:merchant_account_id] = options[:merchant_account_id] if options[:merchant_account_id]
113
+ add_merchant_services(post, options)
114
+ end
115
+
116
+ def add_merchant_services(post, options)
117
+ return unless options[:fraud_scoring] || options[:fraud_manual_review]
118
+ merchant_services = {}
119
+ merchant_services[:fraud_scoring] = options[:fraud_scoring] if options[:fraud_scoring]
120
+ merchant_services[:fraud_manual_review] = options[:fraud_manual_review] if options[:fraud_manual_review]
121
+ post[:merchant_services] = merchant_services
122
+ end
123
+
108
124
  def add_additional_data(post, options)
109
125
  post[:sponsor_id] = options[:sponsor_id]
110
126
  post[:device_id] = options[:device_id] if options[:device_id]
@@ -32,6 +32,7 @@ module ActiveMerchant #:nodoc:
32
32
  add_invoice(post, amount, options)
33
33
  add_payment_method(post, payment_method, options)
34
34
  add_customer_data(post, options)
35
+ add_vendor_data(post, options)
35
36
  add_merchant_defined_fields(post, options)
36
37
 
37
38
  commit('sale', post)
@@ -42,6 +43,7 @@ module ActiveMerchant #:nodoc:
42
43
  add_invoice(post, amount, options)
43
44
  add_payment_method(post, payment_method, options)
44
45
  add_customer_data(post, options)
46
+ add_vendor_data(post, options)
45
47
  add_merchant_defined_fields(post, options)
46
48
 
47
49
  commit('auth', post)
@@ -78,6 +80,7 @@ module ActiveMerchant #:nodoc:
78
80
  add_invoice(post, amount, options)
79
81
  add_payment_method(post, payment_method, options)
80
82
  add_customer_data(post, options)
83
+ add_vendor_data(post, options)
81
84
 
82
85
  commit('credit', post)
83
86
  end
@@ -86,6 +89,7 @@ module ActiveMerchant #:nodoc:
86
89
  post = {}
87
90
  add_payment_method(post, payment_method, options)
88
91
  add_customer_data(post, options)
92
+ add_vendor_data(post, options)
89
93
  add_merchant_defined_fields(post, options)
90
94
 
91
95
  commit('validate', post)
@@ -96,6 +100,7 @@ module ActiveMerchant #:nodoc:
96
100
  add_invoice(post, nil, options)
97
101
  add_payment_method(post, payment_method, options)
98
102
  add_customer_data(post, options)
103
+ add_vendor_data(post, options)
99
104
  add_merchant_defined_fields(post, options)
100
105
 
101
106
  commit('add_customer', post)
@@ -192,6 +197,11 @@ module ActiveMerchant #:nodoc:
192
197
  end
193
198
  end
194
199
 
200
+ def add_vendor_data(post, options)
201
+ post[:vendor_id] = options[:vendor_id] if options[:vendor_id]
202
+ post[:processor_id] = options[:processor_id] if options[:processor_id]
203
+ end
204
+
195
205
  def add_merchant_defined_fields(post, options)
196
206
  (1..20).each do |each|
197
207
  key = "merchant_defined_field_#{each}".to_sym
@@ -52,6 +52,7 @@ module ActiveMerchant #:nodoc:
52
52
  add_invoice(post, money, options)
53
53
  add_payment(post, payment)
54
54
  add_customer_data(post, options)
55
+ add_extra_params(post, options)
55
56
  action = payment.is_a?(String) ? 'debit' : 'debit_cc'
56
57
 
57
58
  commit_transaction(action, post)
@@ -63,6 +64,7 @@ module ActiveMerchant #:nodoc:
63
64
  add_invoice(post, money, options)
64
65
  add_payment(post, payment)
65
66
  add_customer_data(post, options)
67
+ add_extra_params(post, options)
66
68
 
67
69
  commit_transaction('authorize', post)
68
70
  end
@@ -168,6 +170,18 @@ module ActiveMerchant #:nodoc:
168
170
  end
169
171
  end
170
172
 
173
+ def add_extra_params(post, options)
174
+ if options[:extra_params]
175
+ items = {}
176
+ options[:extra_params].each do |param|
177
+ param.each do |key, value|
178
+ items[key.to_sym] = value
179
+ end
180
+ end
181
+ post[:extra_params] = items
182
+ end
183
+ end
184
+
171
185
  def parse(body)
172
186
  JSON.parse(body)
173
187
  end
@@ -299,6 +299,31 @@ module ActiveMerchant #:nodoc:
299
299
  end
300
300
  end
301
301
 
302
+ def create_source(money, payment, type, options = {})
303
+ post = {}
304
+ add_amount(post, money, options, true)
305
+ post[:type] = type
306
+ if type == 'card'
307
+ add_creditcard(post, payment, options)
308
+ post[:card].delete(:name)
309
+ elsif type == 'three_d_secure'
310
+ post[:three_d_secure] = {card: payment}
311
+ post[:redirect] = {return_url: options[:redirect_url]}
312
+ end
313
+ commit(:post, 'sources', post, options)
314
+ end
315
+
316
+ def create_webhook_endpoint(options, events)
317
+ post = {}
318
+ post[:url] = options[:callback_url]
319
+ post[:enabled_events] = events
320
+ commit(:post, 'webhook_endpoints', post, options)
321
+ end
322
+
323
+ def delete_webhook_endpoint(options)
324
+ commit(:delete, "webhook_endpoints/#{options[:webhook_id]}", {}, options)
325
+ end
326
+
302
327
  def create_post_for_auth_or_purchase(money, payment, options)
303
328
  post = {}
304
329
 
@@ -581,7 +606,7 @@ module ActiveMerchant #:nodoc:
581
606
  def commit(method, url, parameters = nil, options = {})
582
607
  add_expand_parameters(parameters, options) if parameters
583
608
  response = api_request(method, url, parameters, options)
584
-
609
+ response['webhook_id'] = options[:webhook_id] if options[:webhook_id]
585
610
  success = success_from(response)
586
611
 
587
612
  card = card_from_response(response)
@@ -312,9 +312,9 @@ module ActiveMerchant #:nodoc:
312
312
  private
313
313
 
314
314
  def add_aggregator(params, options)
315
- if @options[:aggregator_id]
315
+ if @options[:aggregator_id] || application_id != Gateway.application_id
316
316
  params[:aggregators] = 1
317
- params[:aggregator1] = @options[:aggregator_id]
317
+ params[:aggregator1] = @options[:aggregator_id] || application_id
318
318
  end
319
319
  end
320
320
 
@@ -350,7 +350,7 @@ module ActiveMerchant #:nodoc:
350
350
  'Authorization' => encoded_credentials
351
351
  }
352
352
  if options[:cookie]
353
- headers['Set-Cookie'] = options[:cookie] if options[:cookie]
353
+ headers['Cookie'] = options[:cookie] if options[:cookie]
354
354
  end
355
355
  headers
356
356
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.89.0'
2
+ VERSION = '1.90.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.89.0
4
+ version: 1.90.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-17 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport