activemerchant 1.92.0 → 1.93.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: 7269c204ea4aba074e22b8d23828116e472e5537bee163e0e60159192609cc27
4
- data.tar.gz: 4b42091ca8a875d56f2bd1cc53d8440e63733930143ee662d9ca5ef87ff3cd00
3
+ metadata.gz: 077fd706902e893fc2824d409a604bc8512849f142e8503c6c1d2081f6fd64b4
4
+ data.tar.gz: 34a4a0385f319d09e2000ad4f150814f9b86a331b75941f594387ba7cb30c5b5
5
5
  SHA512:
6
- metadata.gz: 8a4cf32bc3055e7f8f6663a024f26424a498ec66f746a703f504723275f969f67fbfbd1cb4b7824245deef9dc7769dd94451a0d7a182491a19439a9df258f624
7
- data.tar.gz: 847b1508be32ccd72185dc2e6d58075e4e6fecf693e069a068ab34dee1c8fd848e6dc760bf44708a9e4d97ca00fbcec9955b6612311555194d3bb5ee9e6351a2
6
+ metadata.gz: 0bc0752fc32fb159b99aa2d0fe36fe3b7d2f1f3059945c76b30f80dad9a8d236f29e5ea5b7105636bb4de16398ae44b2dec13fac230dbc6380ff3496f0476a3c
7
+ data.tar.gz: 479edb7ec96840e1b05f89955f11fe2b89914dda0f8ebcd42428c40de80e84e93901b79d4549858aba3c95c308052b68412d9d6b984a154aaa3f636315b6e404
data/CHANGELOG CHANGED
@@ -1,8 +1,12 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
3
  == HEAD
4
+ == Version 1.93.0 (April 18, 2019)
5
+ * Stripe: Do not consider a refund unsuccessful if only refunding the fee failed [jasonwebster] #3188
6
+ * Stripe: Fix webhook creation for connected account [jknipp] #3193
7
+ * Adyen: Upgrade to v40 API version [davidsantoso] #3192
4
8
 
5
- == Version 1.91.0 (April 8, 2019)
9
+ == Version 1.92.0 (April 8, 2019)
6
10
  * BluePay: Send customer IP address when provided [jknipp] #3149
7
11
  * PaymentExpress: Use ip field for client_info field [jknipp] #3150
8
12
  * Bambora Asia-Pacific: Adds Store [molbrown] #3147
@@ -4,8 +4,8 @@ module ActiveMerchant #:nodoc:
4
4
 
5
5
  # we recommend setting up merchant-specific endpoints.
6
6
  # https://docs.adyen.com/developers/api-manual#apiendpoints
7
- self.test_url = 'https://pal-test.adyen.com/pal/servlet/Payment/v18'
8
- self.live_url = 'https://pal-live.adyen.com/pal/servlet/Payment/v18'
7
+ self.test_url = 'https://pal-test.adyen.com/pal/servlet/Payment/v40'
8
+ self.live_url = 'https://pal-live.adyen.com/pal/servlet/Payment/v40'
9
9
 
10
10
  self.supported_countries = ['AT', 'AU', 'BE', 'BG', 'BR', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'HK', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SG', 'SK', 'SI', 'US']
11
11
  self.default_currency = 'USD'
@@ -150,14 +150,21 @@ module ActiveMerchant #:nodoc:
150
150
  post[:reason] = options[:reason] if options[:reason]
151
151
  post[:expand] = [:charge]
152
152
 
153
- MultiResponse.run(:first) do |r|
154
- r.process { commit(:post, "charges/#{CGI.escape(identification)}/refunds", post, options) }
153
+ response = commit(:post, "charges/#{CGI.escape(identification)}/refunds", post, options)
155
154
 
156
- if options[:refund_fee_amount] && options[:refund_fee_amount].to_s != '0'
157
- r.process { fetch_application_fee(identification, options) }
158
- r.process { refund_application_fee(options[:refund_fee_amount].to_i, application_fee_from_response(r.responses.last), options) }
155
+ if options[:refund_fee_amount] && options[:refund_fee_amount].to_s != '0'
156
+ charge = api_request(:get, "charges/#{CGI.escape(identification)}", nil, options)
157
+
158
+ if application_fee = charge['application_fee']
159
+ fee_refund_options = {
160
+ currency: options[:currency], # currency isn't used by Stripe here, but we need it for #add_amount
161
+ key: @fee_refund_api_key
162
+ }
163
+ refund_application_fee(options[:refund_fee_amount].to_i, application_fee, fee_refund_options)
159
164
  end
160
165
  end
166
+
167
+ response
161
168
  end
162
169
 
163
170
  def verify(payment, options = {})
@@ -168,21 +175,10 @@ module ActiveMerchant #:nodoc:
168
175
  end
169
176
  end
170
177
 
171
- def application_fee_from_response(response)
172
- return unless response.success?
173
- response.params['application_fee'] unless response.params['application_fee'].empty?
174
- end
175
-
176
178
  def refund_application_fee(money, identification, options = {})
177
- return Response.new(false, 'Application fee id could not be found') unless identification
178
-
179
179
  post = {}
180
180
  add_amount(post, money, options)
181
- options[:key] = @fee_refund_api_key if @fee_refund_api_key
182
- options.delete(:stripe_account)
183
-
184
- refund_fee = commit(:post, "application_fees/#{CGI.escape(identification)}/refunds", post, options)
185
- application_fee_response!(refund_fee, "Application fee could not be refunded: #{refund_fee.message}")
181
+ commit(:post, "application_fees/#{CGI.escape(identification)}/refunds", post, options)
186
182
  end
187
183
 
188
184
  # Note: creating a new credit card will not change the customer's existing default credit card (use :set_default => true)
@@ -317,6 +313,8 @@ module ActiveMerchant #:nodoc:
317
313
  post = {}
318
314
  post[:url] = options[:callback_url]
319
315
  post[:enabled_events] = events
316
+ post[:connect] = true if options[:stripe_account]
317
+ options.delete(:stripe_account)
320
318
  commit(:post, 'webhook_endpoints', post, options)
321
319
  end
322
320
 
@@ -516,17 +514,6 @@ module ActiveMerchant #:nodoc:
516
514
  post[:metadata][:card_read_method] = creditcard.read_method if creditcard.respond_to?(:read_method)
517
515
  end
518
516
 
519
- def fetch_application_fee(identification, options = {})
520
- options[:key] = @fee_refund_api_key
521
-
522
- fetch_charge = commit(:get, "charges/#{CGI.escape(identification)}", nil, options)
523
- application_fee_response!(fetch_charge, "Application fee id could not be retrieved: #{fetch_charge.message}")
524
- end
525
-
526
- def application_fee_response!(response, message)
527
- response.success? ? response : Response.new(false, message)
528
- end
529
-
530
517
  def parse(body)
531
518
  JSON.parse(body)
532
519
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.92.0'
2
+ VERSION = '1.93.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.92.0
4
+ version: 1.93.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: 2019-04-08 00:00:00.000000000 Z
11
+ date: 2019-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport