pay 6.2.2 → 6.2.4

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: 10e2efeb851c80d2bb81878942929c95411fa43a781bfdfee41f3d9b99da61b4
4
- data.tar.gz: 7080610378fd2efa259611084f41160143186ef06fb1c9d997e7d1cee72eb74d
3
+ metadata.gz: c8e011241e3e5ad2aab2e5384bb155277b2f3795d9296e1fc2199ae7d2a3c758
4
+ data.tar.gz: 6476845b1fb2e8a118eb44462b30af9381fd7ad8f1bffe14e276be369dee0988
5
5
  SHA512:
6
- metadata.gz: 4d3032094987e54cf1834619b96064cf77335f03b2e45555de4eb059cee0c6b1e0783abb6077621fe138301dd5fe29b415a3cd4e829c63bf55493208275e0025
7
- data.tar.gz: 6331154cae0f9f1c99a63b57c92e0b82e9197247ead694e9854a081eea19a2ff2859eef07d839b10b1d7204c00e42694ffce25e3f4f54f1e984e9f333dadc96e
6
+ metadata.gz: 52efd6d5f1e5c9ae46eb65636c11cb654cb6954e729be3de1864f4edf149c0e34e9f515247a425a5a7aef1edc30926ff6f7bfb2056bee803ebebadc6769af3e6
7
+ data.tar.gz: '0658c17acef2b2bf63d0b35cab1e3a335a41444a9ba8e603c3d4c686eba5d4c3c613e1a5e759f6924c90ef1f4d1fa87a6e1436c982b3204e11434d2d6312e6d7'
@@ -50,7 +50,7 @@ module Pay
50
50
  customer.processor == processor_name
51
51
  end
52
52
 
53
- scope processor_name, -> { where(processor: processor_name) }
53
+ scope processor_name, -> { joins(:customer).where(pay_customers: {processor: processor_name}) }
54
54
  end
55
55
 
56
56
  delegate :capture, :credit_note!, :credit_notes, to: :payment_processor
@@ -174,12 +174,17 @@ module Pay
174
174
  attrs[:metadata] = transaction.custom_fields
175
175
  attrs[:currency] = transaction.currency_iso_code
176
176
  attrs[:application_fee_amount] = transaction.service_fee_amount
177
+ attrs[:created_at] = transaction.created_at
177
178
 
178
179
  # Associate charge with subscription if we can
179
180
  if transaction.subscription_id
180
181
  pay_subscription = pay_customer.subscriptions.find_by(processor_id: transaction.subscription_id)
181
- attrs[:subscription] = pay_subscription
182
- attrs[:metadata] = pay_subscription.metadata
182
+ pay_subscription ||= Pay::Braintree::Subscription.sync(transaction.subscription_id)
183
+
184
+ if pay_subscription
185
+ attrs[:subscription] = pay_subscription
186
+ attrs[:metadata] = pay_subscription.metadata
187
+ end
183
188
  end
184
189
 
185
190
  charge = pay_customer.charges.find_or_initialize_by(processor_id: transaction.id)
@@ -6,7 +6,7 @@ module Pay
6
6
  delegate :customer, :processor_id, to: :pay_payment_method
7
7
 
8
8
  def self.sync(id, object: nil, try: 0, retries: 1)
9
- object ||= gateway.payment_method.find(id)
9
+ object ||= Pay.braintree_gateway.payment_method.find(id)
10
10
 
11
11
  pay_customer = Pay::Customer.find_by(processor: :braintree, processor_id: object.customer_id)
12
12
  return unless pay_customer
@@ -28,6 +28,9 @@ module Pay
28
28
  pay_customer = Pay::Customer.find_by(processor: :braintree, processor_id: payment_method.customer_id)
29
29
  return unless pay_customer
30
30
 
31
+ # Sync the PaymentMethod since we've got it
32
+ pay_customer.save_payment_method(payment_method, default: payment_method.default?)
33
+
31
34
  attributes = {
32
35
  created_at: object.created_at,
33
36
  current_period_end: object.billing_period_end_date,
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "6.2.2"
2
+ VERSION = "6.2.4"
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: 6.2.2
4
+ version: 6.2.4
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: 2023-01-05 00:00:00.000000000 Z
12
+ date: 2023-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  requirements: []
223
- rubygems_version: 3.3.26
223
+ rubygems_version: 3.4.3
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Payments engine for Ruby on Rails