pay 11.2.2 → 11.3.0

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: 0e194484cea3ae3dee4d9fdded7e5732f182a5e7699128f2f86bfa020284806f
4
- data.tar.gz: 14b67bbf65d49fb2d7d73fdfbc8519baf5ddcade178ba88bd5b5b30534413d09
3
+ metadata.gz: 9edcf51b1a6346022cd5d504b2d6e730dadeb31580ae60da69b3f5c5414b97d8
4
+ data.tar.gz: 9cd3ea459bdd0f853efab3a72f32af739125740f22e78f756da1e6ea2a059a5e
5
5
  SHA512:
6
- metadata.gz: b2c00bd4c90a603a91b62202ba36c5cb3cfdd99fcacdd347e274c2bf6c6cb4d813115373e23c9a3e575559d3ec0d37561c8f9a08a60e028415dace786dfcbb16
7
- data.tar.gz: d62df086e5566fa6c25304c8cdbb54ef9ef401ba0a3023541085c57ab32214287c953d78f1c86be4aeaeb34cc26c29635bc00e4e4b757f7f3579d65fa2ceb02b
6
+ metadata.gz: 3e92c7fd1cd767d5d67160abd1bda24d1d9a9c56a4ea3ea883a1be04e65bdaf21fc5a2ad4c9268cad9d37747e6927f79bfcc4beadecbf3f6c79e499d7c890c64
7
+ data.tar.gz: ca5742925df0d3f6aaae8ed148a9710f5c1be43394c0918eb2f0afcba9cf3968546e9388768b98ff3181df8c8e9ddb83ad7ae8d27a5d1266100863e4dcb0b2d8
@@ -31,7 +31,7 @@ module Pay
31
31
  return
32
32
  end
33
33
 
34
- default_payment_method_id = pay_customer.api_record.invoice_settings.default_payment_method
34
+ default_payment_method_id = pay_customer.api_record.invoice_settings&.default_payment_method
35
35
  default = (id == default_payment_method_id)
36
36
 
37
37
  attributes = extract_attributes(object).merge(default: default, stripe_account: stripe_account)
@@ -279,7 +279,6 @@ module Pay
279
279
  unpause
280
280
  else
281
281
  @api_record = ::Stripe::Subscription.update(processor_id, {
282
- plan: processor_plan,
283
282
  trial_end: (on_trial? ? trial_ends_at.to_i : "now"),
284
283
  cancel_at_period_end: false
285
284
  }.merge(expand_options),
@@ -300,10 +299,9 @@ module Pay
300
299
  processor_id,
301
300
  {
302
301
  cancel_at_period_end: false,
303
- plan: plan,
302
+ items: [{id: subscription_items.first.id, plan: plan, quantity: quantity}],
304
303
  proration_behavior: proration_behavior,
305
- trial_end: (on_trial? ? trial_ends_at.to_i : "now"),
306
- quantity: quantity
304
+ trial_end: (on_trial? ? trial_ends_at.to_i : "now")
307
305
  }.merge(expand_options).merge(options),
308
306
  stripe_options
309
307
  )
@@ -28,7 +28,7 @@ module Pay
28
28
  # - Finds or creates a Pay::Customer for the process and marks it as default
29
29
  # - Removes the default flag from all other Pay::Customers
30
30
  # - Removes the default flag from all Pay::PaymentMethods
31
- def set_payment_processor(processor_name, allow_fake: false, **attributes)
31
+ def set_payment_processor(processor_name, allow_fake: false, stripe_account: nil, **attributes)
32
32
  raise Pay::Error, "Processor `#{processor_name}` is not allowed" if processor_name.to_s == "fake_processor" && !allow_fake
33
33
 
34
34
  # Safety check to make sure this is a valid Pay processor
@@ -37,7 +37,7 @@ module Pay
37
37
 
38
38
  with_lock do
39
39
  pay_customers.update_all(default: false)
40
- pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name).first_or_initialize
40
+ pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name, stripe_account: stripe_account).first_or_initialize
41
41
  pay_customer.update!(attributes.merge(default: true))
42
42
  end
43
43
 
@@ -45,14 +45,14 @@ module Pay
45
45
  reload_payment_processor
46
46
  end
47
47
 
48
- def add_payment_processor(processor_name, allow_fake: false, **attributes)
48
+ def add_payment_processor(processor_name, allow_fake: false, stripe_account: nil, **attributes)
49
49
  raise Pay::Error, "Processor `#{processor_name}` is not allowed" if processor_name.to_s == "fake_processor" && !allow_fake
50
50
 
51
51
  # Safety check to make sure this is a valid Pay processor
52
52
  klass = "Pay::#{processor_name.to_s.classify}::Customer".constantize
53
53
  raise ArgumentError, "not a valid payment processor" if klass.ancestors.exclude?(Pay::Customer)
54
54
 
55
- pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name).first_or_initialize
55
+ pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name, stripe_account: stripe_account).first_or_initialize
56
56
  pay_customer.update!(attributes)
57
57
  pay_customer
58
58
  end
data/lib/pay/stripe.rb CHANGED
@@ -27,7 +27,7 @@ module Pay
27
27
 
28
28
  extend Env
29
29
 
30
- REQUIRED_VERSION = "~> 15"
30
+ REQUIRED_VERSION = "~> 17"
31
31
 
32
32
  # A list of database model names that include Pay
33
33
  # Used for safely looking up models with client_reference_id
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "11.2.2"
2
+ VERSION = "11.3.0"
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: 11.2.2
4
+ version: 11.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes