pay 6.1.0 → 6.1.2

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: beaa5a643c27c8dde835fe7593a12971c4c060fe5b2bb44c9790a61430d4570b
4
- data.tar.gz: 59b45703f436c77744623190946ae7e57f03627530e539c643510d82b35ee426
3
+ metadata.gz: 863cb9c39a6232694d37073f367ebc22f78a0fc7c4c775e9f0b9b64555fc5534
4
+ data.tar.gz: 0c2bae743a6e14f8f3608e76f7d515e3411d1d417e74e7e1a1a5dc8a99ec2b07
5
5
  SHA512:
6
- metadata.gz: 17b2cbc585ca9e78c21e859483f92ede7d37588baa404cef2a67b8f8f9c57169def03487925cf0b1238fd662c952e7e5716960f0d9257eace5815855cbe9e2a8
7
- data.tar.gz: 5ed7a082eee1b3c053cf39feffc25a7a07f837e14fe0a8267fcd7bb2ec851d1858063f9c3bdbaff76aad20b8c57effa31c4d1acf96804426c22e5419da4f198c
6
+ metadata.gz: 9af822c88226e681feb85f173a9eb15ab161926be39b08d6e4944b50db67f4b5dcf95b6fa443b3dd460b592627539cdc9769fccd82552ee36c90735201411782
7
+ data.tar.gz: a81b84cc6fe417b823b7b109066b0ed39da420fe2fe611b28e87feaff7ffb084b1c2fd8b65b163317fc033911277d070f73c33edf122c00aff89031a9644d633
data/lib/pay/receipts.rb CHANGED
@@ -119,7 +119,7 @@ module Pay
119
119
  company: {
120
120
  name: Pay.business_name,
121
121
  address: Pay.business_address,
122
- email: Pay.support_email,
122
+ email: Pay.support_email.address,
123
123
  logo: Pay.business_logo
124
124
  },
125
125
  line_items: receipt_line_items
@@ -155,7 +155,7 @@ module Pay
155
155
  company: {
156
156
  name: Pay.business_name,
157
157
  address: Pay.business_address,
158
- email: Pay.support_email,
158
+ email: Pay.support_email.address,
159
159
  logo: Pay.business_logo
160
160
  },
161
161
  line_items: pdf_line_items
@@ -125,7 +125,7 @@ module Pay
125
125
  # refund!(5_00, refund_application_fee: true)
126
126
  def refund!(amount_to_refund, **options)
127
127
  if invoice_id.present?
128
- description = options.delete(:description) || I18n.t("refund")
128
+ description = options.delete(:description) || I18n.t("pay.refund")
129
129
  lines = [{type: :custom_line_item, description: description, quantity: 1, unit_amount: amount_to_refund}]
130
130
  credit_note!(**options.merge(refund_amount: amount_to_refund, lines: lines))
131
131
  else
@@ -3,15 +3,11 @@ module Pay
3
3
  module Webhooks
4
4
  class CheckoutSessionCompleted
5
5
  def call(event)
6
- # TODO: Also handle payment intents
7
-
8
6
  locate_owner(event.data.object)
9
7
 
10
8
  if (payment_intent_id = event.data.object.payment_intent)
11
- payment_intent = ::Stripe::PaymentIntent.retrieve(payment_intent_id, {stripe_account: event.try(:account)}.compact)
12
- payment_intent.charges.each do |charge|
13
- Pay::Stripe::Charge.sync(charge.id, stripe_account: event.try(:account))
14
- end
9
+ payment_intent = ::Stripe::PaymentIntent.retrieve({id: payment_intent_id}, {stripe_account: event.try(:account)}.compact)
10
+ Pay::Stripe::Charge.sync(payment_intent.latest_charge, stripe_account: event.try(:account))
15
11
  end
16
12
 
17
13
  if (subscription_id = event.data.object.subscription)
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "6.1.0"
2
+ VERSION = "6.1.2"
3
3
  end
data/lib/pay.rb CHANGED
@@ -37,6 +37,10 @@ module Pay
37
37
  mattr_accessor :business_logo
38
38
  mattr_accessor :support_email
39
39
 
40
+ def self.support_email=(value)
41
+ @@support_email = value.is_a?(Mail::Address) ? value : Mail::Address.new(value)
42
+ end
43
+
40
44
  mattr_accessor :automount_routes
41
45
  @@automount_routes = true
42
46
 
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.1.0
4
+ version: 6.1.2
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: 2022-11-26 00:00:00.000000000 Z
12
+ date: 2022-12-17 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.7
223
+ rubygems_version: 3.3.26
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Payments engine for Ruby on Rails