moneytree-rails 0.1.10 → 0.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82a73ef1112fc456b1f7418cad362291d5817be5a4c1ab0d37a315418087584f
4
- data.tar.gz: b31da6ae5001a28d162b6db90627654ccaa0adb74271aad2160357c971da2c33
3
+ metadata.gz: 0a606a849682a4f6127da7dfbb4a9d0606f315c819207653084088a3b230c179
4
+ data.tar.gz: d682ed115c7159fbbb81276b63b5e9d94b8e43032a201cb088bb2cf1e8b495a9
5
5
  SHA512:
6
- metadata.gz: d8de210345c2d0e8c813eb46b1d4f8f6e332df0b9013b6ced5b770886bc4a3246535f9cf9ad8ead5bcaef4c5cb40c24f20a383310a0407288f08e9dd34a3605e
7
- data.tar.gz: 1a133c019d8e1a1cfb64b21ea7d2f05a675660b81f6802213072fb38da9ce2c5b7f983be58c8bdb399b62a94916703712bba81c478805c17dbaa91c796ca8e58
6
+ metadata.gz: 6b9e27ae3746b2d400e3810ff71717e676d546aed60235fc3a1f0b0f81cce6b9fcaf70b5b3ccf0bdceb3f0b3070bfba018363a8b163ec2db311b687c4e259ed7
7
+ data.tar.gz: 9cd9a4892e98f7e6d4acad9fa9a026dda236215c3830576d3cd1ee3b779dfc4377c82226e333de0833272c962f39e8914b3aaa9f3789ce21945f5751d5e98a81
@@ -26,7 +26,7 @@ module Moneytree
26
26
  PERMISSION.to_s
27
27
  end
28
28
 
29
- def charge(amount, details, app_fee_amount: 0, description: "Charge for #{account.name}", metadata:)
29
+ def charge(amount, details, metadata:, app_fee_amount: 0, description: "Charge for #{account.name}")
30
30
  # `source` is obtained with Stripe.js; see https://stripe.com/docs/payments/accept-a-payment-charges#web-create-token
31
31
  response = ::Stripe::Charge.create(
32
32
  {
@@ -45,7 +45,8 @@ module Moneytree
45
45
  response[:failure_message],
46
46
  {
47
47
  charge_id: response[:id],
48
- card: response[:payment_method_details][:card]
48
+ card: response[:payment_method_details][:card],
49
+ has_application_fee: !app_fee_amount.zero?
49
50
  }
50
51
  )
51
52
  rescue ::Stripe::StripeError => e
@@ -58,7 +59,7 @@ module Moneytree
58
59
  charge: details[:charge_id],
59
60
  amount: (-amount * 100).to_i,
60
61
  metadata: metadata,
61
- refund_application_fee: Moneytree.refund_application_fee
62
+ refund_application_fee: details[:has_application_fee] && Moneytree.refund_application_fee
62
63
  },
63
64
  stripe_account: payment_gateway.psp_credentials[:stripe_user_id]
64
65
  )
@@ -1,3 +1,3 @@
1
1
  module Moneytree
2
- VERSION = '0.1.10'.freeze
2
+ VERSION = '0.1.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneytree-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kieran Klaassen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-27 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails