pay 6.1.0 → 6.1.1

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: 17a91b33a5c76733e60014f15e285b51e77d1d4794456afba359691edc4e44c2
4
+ data.tar.gz: f7b991d7a54f7fa57a54a56571f2ee4badeeb1aaaa62dc5f2cc6f889254818d3
5
5
  SHA512:
6
- metadata.gz: 17b2cbc585ca9e78c21e859483f92ede7d37588baa404cef2a67b8f8f9c57169def03487925cf0b1238fd662c952e7e5716960f0d9257eace5815855cbe9e2a8
7
- data.tar.gz: 5ed7a082eee1b3c053cf39feffc25a7a07f837e14fe0a8267fcd7bb2ec851d1858063f9c3bdbaff76aad20b8c57effa31c4d1acf96804426c22e5419da4f198c
6
+ metadata.gz: 5ef34ddc4e6b0ba75abab2577d216a85af478fa22c0bc8a16d312b5979e782fac467204e66ac72f7fa4f9e0b4dfa16f879aad82b27251ed290e05353c48df92c
7
+ data.tar.gz: e8dd4dbbdc01aa58ce21228b84a69bb70df05a814ab306b9e2b417b3e178bf50732117b73cad0f01dbb04035bbeb834f2aa2052b010c042b1d5e1f7660149188
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, expand: ["latest_charge"]}, {stripe_account: event.try(:account)}.compact)
10
+ Pay::Stripe::Charge.sync(payment_intent.latest_charge.id, object: 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.1"
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.1
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-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails