pay 3.0.13 → 3.0.17

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pay might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f7c93c9c0a537a5afd2174c46197296cec0d6f89fecc726640406d7f1c97469
4
- data.tar.gz: b8c026b26f70a85c56adcbc680c1bfec034a1c9e036d22ebf4e939e1be7c0328
3
+ metadata.gz: 2268e7ac1a9c24a08f77336d8e17b46cc0dcefc17762dfd48ad698b11a3e990c
4
+ data.tar.gz: 8227fdb6f1fb10a657f5a731a200ddeb8e711884dcffafe1ffedaf06a1988c0e
5
5
  SHA512:
6
- metadata.gz: d3279bf171188b4e9ed298e6aa75cf7419620410cafe396b356c48f19e8d4761ffbf6886a1069625329b2483d957ca7cf88bcaf63d1f217b8f011784c24cf352
7
- data.tar.gz: c7da5e0cd1b194b5f126c5b22f67064847ba59f5a396f8e592f7f8329075ecff0624278f64ae0c1a0d65c394fb7ba425aba418b5679c1cad0e81282045b2992e
6
+ metadata.gz: 7b7131afb212c9ff2e0bc657ad26440b09765f2eaa7d2d50c38f110efed513c42547994b65fea9354e5d8429185ca5c5cb109e8cf5d42b57af2f95d69743cf30
7
+ data.tar.gz: d0a9cabba6b63a6a087687efe94f7c13a3040550e57c150dd171ebb4d2b3df6157cd87592de10d216d7c12a4f8bff5ce6e7cb0fd72411930ba6778c0cf0f7de9
data/README.md CHANGED
@@ -27,7 +27,7 @@ Our supported payment processors are:
27
27
 
28
28
  Want to add a new payment provider? Contributions are welcome.
29
29
 
30
- > We make our best attempt to standardize the different payment providers. They function differently so keep that in mind if you plan on doing more complex payments. It would be best to stick witha single payment provider in that case so you don't run into discrepancies.
30
+ > We make our best attempt to standardize the different payment providers. They function differently so keep that in mind if you plan on doing more complex payments. It would be best to stick with a single payment provider in that case so you don't run into discrepancies.
31
31
 
32
32
  ## 📚 Docs
33
33
 
@@ -72,11 +72,11 @@ module Pay
72
72
  end
73
73
 
74
74
  def amount_with_currency
75
- Pay::Currency.format(amount.to_i, currency: currency)
75
+ Pay::Currency.format(amount, currency: currency)
76
76
  end
77
77
 
78
78
  def amount_refunded_with_currency
79
- Pay::Currency.format(amount_refunded.to_i, currency: currency)
79
+ Pay::Currency.format(amount_refunded, currency: currency)
80
80
  end
81
81
 
82
82
  def charged_to
@@ -128,6 +128,12 @@ module Pay
128
128
  processor_subscription(expand: ["latest_invoice.payment_intent"]).latest_invoice.payment_intent
129
129
  end
130
130
 
131
+ def paddle_paused_from
132
+ if (timestamp = super)
133
+ Time.zone.parse(timestamp)
134
+ end
135
+ end
136
+
131
137
  private
132
138
 
133
139
  def cancel_if_active
@@ -5,7 +5,7 @@ Questions? Please reply to this email.<br/>
5
5
  ------------------------------------<br/>
6
6
  RECEIPT - SUBSCRIPTION<br/>
7
7
  <br/>
8
- Amount: USD <%= params[:charge].amount_with_currency %><br/>
8
+ Amount: <%= params[:charge].amount_with_currency %><br/>
9
9
  <br/>
10
10
  Charged to: <%= params[:charge].charged_to %><br/>
11
11
  Transaction ID: <%= params[:charge].id %><br/>
@@ -6,7 +6,7 @@ Questions? Please reply to this email.<br/>
6
6
  ------------------------------------<br/>
7
7
  RECEIPT - REFUND<br/>
8
8
  <br/>
9
- Amount: USD <%= params[:charge].amount_refunded_with_currency %><br/>
9
+ Amount: <%= params[:charge].amount_refunded_with_currency %><br/>
10
10
  <br/>
11
11
  Refunded to: <%= params[:charge].charged_to %><br/>
12
12
  Transaction ID: <%= params[:charge].id %><br/>
data/lib/pay/currency.rb CHANGED
@@ -12,9 +12,9 @@ module Pay
12
12
  end
13
13
 
14
14
  # Takes an amount (in cents) and currency and returns the formatted version for the currency
15
- def self.format(amount, currency:)
15
+ def self.format(amount, currency:, **options)
16
16
  currency ||= :usd
17
- new(currency).format_amount(amount)
17
+ new(currency).format_amount(amount, **options)
18
18
  end
19
19
 
20
20
  def initialize(iso_code)
@@ -23,7 +23,7 @@ module Pay
23
23
 
24
24
  def format_amount(amount, **options)
25
25
  number_to_currency(
26
- amount / subunit_to_unit.to_f,
26
+ amount.to_i / subunit_to_unit.to_f,
27
27
  {
28
28
  precision: precision,
29
29
  unit: unit,
data/lib/pay/payment.rb CHANGED
@@ -2,7 +2,7 @@ module Pay
2
2
  class Payment
3
3
  attr_reader :intent
4
4
 
5
- delegate :id, :amount, :client_secret, :customer, :status, :confirm, to: :intent
5
+ delegate :id, :amount, :client_secret, :currency, :customer, :status, :confirm, to: :intent
6
6
 
7
7
  def self.from_id(id)
8
8
  intent = id.start_with?("seti_") ? ::Stripe::SetupIntent.retrieve(id) : ::Stripe::PaymentIntent.retrieve(id)
@@ -41,6 +41,10 @@ module Pay
41
41
  intent.is_a?(::Stripe::SetupIntent)
42
42
  end
43
43
 
44
+ def amount_with_currency
45
+ Pay::Currency.format(amount, currency: currency)
46
+ end
47
+
44
48
  def validate
45
49
  if requires_payment_method?
46
50
  raise Pay::InvalidPaymentMethod.new(self)
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "3.0.13"
2
+ VERSION = "3.0.17"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.13
4
+ version: 3.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-09-11 00:00:00.000000000 Z
12
+ date: 2021-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
226
  requirements: []
227
- rubygems_version: 3.2.22
227
+ rubygems_version: 3.2.3
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: Payments engine for Ruby on Rails