killbill-stripe 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/stripe/api.rb +9 -7
- data/lib/stripe/ext/active_merchant/active_merchant.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbeb71a7aae52e4c3a9fe698f6155e177629cf03
|
4
|
+
data.tar.gz: 49a41004e15684354aad2a4bf2ca48afb582a4af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c3ce1d90ad13747342d5ca72efd2edb06bd547ea50a576552863cb4ff32176a6c7b64db7125a68b553cc9bd6092f1e3f581599b2c06073130376dbdfb900527
|
7
|
+
data.tar.gz: 3568addf8c662046a1cb0d65a286f1d35c4125c70c1ac8c824b495deb802df1309dce80cc1fa7ba7a72c3d91ffa65f73a3cbee6359259a1505acfc3ff7876faa
|
data/lib/stripe/api.rb
CHANGED
@@ -26,7 +26,7 @@ module Killbill #:nodoc:
|
|
26
26
|
pm = @payment_method_model.from_kb_payment_method_id(kb_payment_method_id, context.tenant_id)
|
27
27
|
|
28
28
|
options = {}
|
29
|
-
populate_defaults(pm, amount, properties, context, options)
|
29
|
+
populate_defaults(pm, amount, currency, properties, context, options)
|
30
30
|
|
31
31
|
properties = merge_properties(properties, options)
|
32
32
|
super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
|
@@ -44,7 +44,7 @@ module Killbill #:nodoc:
|
|
44
44
|
pm = @payment_method_model.from_kb_payment_method_id(kb_payment_method_id, context.tenant_id)
|
45
45
|
|
46
46
|
options = {}
|
47
|
-
populate_defaults(pm, amount, properties, context, options)
|
47
|
+
populate_defaults(pm, amount, currency, properties, context, options)
|
48
48
|
|
49
49
|
properties = merge_properties(properties, options)
|
50
50
|
super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
|
@@ -237,10 +237,10 @@ module Killbill #:nodoc:
|
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
240
|
-
def populate_defaults(pm, amount, properties, context, options)
|
240
|
+
def populate_defaults(pm, amount, currency, properties, context, options)
|
241
241
|
options[:customer] ||= pm.stripe_customer_id
|
242
242
|
options[:destination] ||= get_destination(properties, context)
|
243
|
-
options[:application_fee] ||= get_application_fee(amount, properties) unless options[:destination].nil?
|
243
|
+
options[:application_fee] ||= get_application_fee(amount, currency, properties) unless options[:destination].nil?
|
244
244
|
end
|
245
245
|
|
246
246
|
def get_destination(properties, context)
|
@@ -255,14 +255,16 @@ module Killbill #:nodoc:
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
-
def get_application_fee(amount, properties)
|
258
|
+
def get_application_fee(amount, currency, properties)
|
259
259
|
fees_amount = find_value_from_properties(properties, :fees_amount)
|
260
260
|
return fees_amount unless fees_amount.nil?
|
261
261
|
|
262
|
+
amount_in_cents = ::Monetize.from_numeric(amount, currency).cents.to_i
|
263
|
+
|
262
264
|
fees_percent = find_value_from_properties(properties, :fees_percent)
|
263
|
-
return (fees_percent *
|
265
|
+
return (fees_percent * amount_in_cents).to_i unless fees_percent.nil?
|
264
266
|
|
265
|
-
config(context.tenant_id)[:stripe][:fees_amount] || (config(context.tenant_id)[:stripe][:fees_percent].to_f *
|
267
|
+
config(context.tenant_id)[:stripe][:fees_amount] || (config(context.tenant_id)[:stripe][:fees_percent].to_f * amount_in_cents)
|
266
268
|
end
|
267
269
|
|
268
270
|
def is_bank_account?(properties)
|
@@ -42,6 +42,13 @@ module ActiveMerchant
|
|
42
42
|
headers
|
43
43
|
end
|
44
44
|
|
45
|
+
# Ignore the call to localized_amount upstream (money is already cents here)
|
46
|
+
def add_amount(post, money, options, include_currency = false)
|
47
|
+
currency = options[:currency] || currency(money)
|
48
|
+
post[:amount] = money
|
49
|
+
post[:currency] = currency.downcase if include_currency
|
50
|
+
end
|
51
|
+
|
45
52
|
# To create a charge on a card or a token, call
|
46
53
|
#
|
47
54
|
# purchase(money, card_hash_or_token, { ... })
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|