pay 2.6.11 → 3.0.0
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 +4 -4
- data/README.md +35 -693
- data/app/controllers/pay/webhooks/braintree_controller.rb +10 -3
- data/app/controllers/pay/webhooks/paddle_controller.rb +7 -8
- data/app/controllers/pay/webhooks/stripe_controller.rb +6 -3
- data/app/jobs/pay/{email_sync_job.rb → customer_sync_job.rb} +3 -4
- data/app/models/pay/application_record.rb +1 -5
- data/app/models/pay/charge.rb +32 -17
- data/app/models/pay/customer.rb +87 -0
- data/app/models/pay/merchant.rb +19 -0
- data/app/models/pay/payment_method.rb +41 -0
- data/app/models/pay/subscription.rb +34 -30
- data/app/models/pay/webhook.rb +36 -0
- data/app/views/layouts/pay/application.html.erb +2 -3
- data/app/views/pay/payments/show.html.erb +109 -81
- data/app/views/pay/user_mailer/receipt.html.erb +2 -2
- data/app/views/pay/user_mailer/refund.html.erb +2 -2
- data/config/locales/en.yml +1 -1
- data/db/migrate/1_create_pay_tables.rb +72 -0
- data/lib/generators/active_record/billable_generator.rb +44 -0
- data/lib/generators/active_record/merchant_generator.rb +44 -0
- data/lib/generators/active_record/templates/billable_migration.rb +17 -0
- data/lib/generators/active_record/templates/merchant_migration.rb +12 -0
- data/lib/generators/pay/{pay_generator.rb → billable_generator.rb} +2 -3
- data/lib/generators/pay/merchant_generator.rb +17 -0
- data/lib/generators/pay/orm_helpers.rb +10 -6
- data/lib/pay/adapter.rb +22 -0
- data/lib/pay/attributes.rb +74 -0
- data/lib/pay/billable/sync_customer.rb +30 -0
- data/lib/pay/braintree/billable.rb +130 -105
- data/lib/pay/braintree/payment_method.rb +33 -0
- data/lib/pay/braintree/subscription.rb +9 -12
- data/lib/pay/braintree/webhooks/subscription_canceled.rb +1 -1
- data/lib/pay/braintree/webhooks/subscription_charged_successfully.rb +4 -4
- data/lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb +1 -1
- data/lib/pay/braintree/webhooks/subscription_expired.rb +1 -1
- data/lib/pay/braintree/webhooks/subscription_trial_ended.rb +2 -2
- data/lib/pay/braintree/webhooks/subscription_went_active.rb +1 -1
- data/lib/pay/braintree/webhooks/subscription_went_past_due.rb +1 -1
- data/lib/pay/braintree.rb +3 -2
- data/lib/pay/engine.rb +6 -1
- data/lib/pay/env.rb +8 -0
- data/lib/pay/fake_processor/billable.rb +45 -21
- data/lib/pay/fake_processor/payment_method.rb +21 -0
- data/lib/pay/fake_processor/subscription.rb +11 -8
- data/lib/pay/fake_processor.rb +2 -1
- data/lib/pay/merchant.rb +37 -0
- data/lib/pay/nano_id.rb +13 -0
- data/lib/pay/paddle/billable.rb +18 -48
- data/lib/pay/paddle/charge.rb +5 -5
- data/lib/pay/paddle/payment_method.rb +58 -0
- data/lib/pay/paddle/response.rb +0 -0
- data/lib/pay/paddle/subscription.rb +49 -8
- data/lib/pay/paddle/webhooks/subscription_cancelled.rb +6 -3
- data/lib/pay/paddle/webhooks/subscription_created.rb +1 -40
- data/lib/pay/paddle/webhooks/subscription_payment_refunded.rb +3 -3
- data/lib/pay/paddle/webhooks/subscription_payment_succeeded.rb +23 -23
- data/lib/pay/paddle/webhooks/subscription_updated.rb +2 -2
- data/lib/pay/paddle.rb +7 -3
- data/lib/pay/payment.rb +1 -1
- data/lib/pay/receipts.rb +35 -7
- data/lib/pay/stripe/billable.rb +82 -93
- data/lib/pay/stripe/charge.rb +65 -4
- data/lib/pay/stripe/merchant.rb +66 -0
- data/lib/pay/stripe/payment_method.rb +61 -0
- data/lib/pay/stripe/subscription.rb +91 -24
- data/lib/pay/stripe/webhooks/account_updated.rb +16 -0
- data/lib/pay/stripe/webhooks/charge_refunded.rb +2 -7
- data/lib/pay/stripe/webhooks/charge_succeeded.rb +2 -8
- data/lib/pay/stripe/webhooks/checkout_session_async_payment_succeeded.rb +15 -0
- data/lib/pay/stripe/webhooks/checkout_session_completed.rb +15 -0
- data/lib/pay/stripe/webhooks/customer_deleted.rb +7 -15
- data/lib/pay/stripe/webhooks/customer_updated.rb +10 -3
- data/lib/pay/stripe/webhooks/payment_action_required.rb +2 -2
- data/lib/pay/stripe/webhooks/payment_intent_succeeded.rb +6 -14
- data/lib/pay/stripe/webhooks/payment_method_attached.rb +15 -0
- data/lib/pay/stripe/webhooks/payment_method_detached.rb +12 -0
- data/lib/pay/stripe/webhooks/payment_method_updated.rb +10 -4
- data/lib/pay/stripe/webhooks/subscription_created.rb +1 -35
- data/lib/pay/stripe/webhooks/subscription_deleted.rb +2 -9
- data/lib/pay/stripe/webhooks/subscription_renewing.rb +14 -6
- data/lib/pay/stripe/webhooks/subscription_updated.rb +1 -28
- data/lib/pay/stripe.rb +17 -3
- data/lib/pay/version.rb +1 -1
- data/lib/pay/webhooks/delegator.rb +4 -0
- data/lib/pay/webhooks/process_job.rb +9 -0
- data/lib/pay/webhooks.rb +1 -0
- data/lib/pay.rb +8 -57
- metadata +34 -36
- data/db/migrate/20170205020145_create_pay_subscriptions.rb +0 -17
- data/db/migrate/20170727235816_create_pay_charges.rb +0 -18
- data/db/migrate/20190816015720_add_status_to_pay_subscriptions.rb +0 -14
- data/db/migrate/20200603134434_add_data_to_pay_models.rb +0 -22
- data/db/migrate/20210423235138_add_currency_to_pay_charges.rb +0 -5
- data/lib/generators/active_record/pay_generator.rb +0 -58
- data/lib/generators/active_record/templates/migration.rb +0 -9
- data/lib/pay/billable/sync_email.rb +0 -40
- data/lib/pay/billable.rb +0 -168
@@ -2,23 +2,15 @@ module Pay
|
|
2
2
|
module Stripe
|
3
3
|
module Webhooks
|
4
4
|
class PaymentIntentSucceeded
|
5
|
+
# This webhook does NOT send notifications because stripe sends both
|
6
|
+
# `charge.succeeded` and `payment_intent.succeeded` events.
|
7
|
+
#
|
8
|
+
# We use `charge.succeeded` as the single place to send notifications
|
9
|
+
|
5
10
|
def call(event)
|
6
11
|
object = event.data.object
|
7
|
-
billable = Pay.find_billable(processor: :stripe, processor_id: object.customer)
|
8
|
-
|
9
|
-
return unless billable.present?
|
10
|
-
|
11
12
|
object.charges.data.each do |charge|
|
12
|
-
|
13
|
-
|
14
|
-
charge = Pay::Stripe::Billable.new(billable).save_pay_charge(charge)
|
15
|
-
notify_user(billable, charge)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def notify_user(billable, charge)
|
20
|
-
if Pay.send_emails && charge.respond_to?(:receipt)
|
21
|
-
Pay::UserMailer.with(billable: billable, charge: charge).receipt.deliver_later
|
13
|
+
Pay::Stripe::Charge.sync(charge.id, stripe_account: event.try(:account))
|
22
14
|
end
|
23
15
|
end
|
24
16
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Pay
|
2
|
+
module Stripe
|
3
|
+
module Webhooks
|
4
|
+
class PaymentMethodAttached
|
5
|
+
def call(event)
|
6
|
+
object = event.data.object
|
7
|
+
pay_customer = Pay::Customer.find_by(processor: :stripe, processor_id: object.customer)
|
8
|
+
return unless pay_customer
|
9
|
+
|
10
|
+
pay_customer.save_payment_method(object, default: false)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -4,12 +4,18 @@ module Pay
|
|
4
4
|
class PaymentMethodUpdated
|
5
5
|
def call(event)
|
6
6
|
object = event.data.object
|
7
|
-
billable = Pay.find_billable(processor: :stripe, processor_id: object.customer)
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
if object.customer
|
9
|
+
pay_customer = Pay::Customer.find_by(processor: :stripe, processor_id: object.customer)
|
11
10
|
|
12
|
-
|
11
|
+
# Couldn't find user, we can skip
|
12
|
+
return unless pay_customer.present?
|
13
|
+
|
14
|
+
Pay::Stripe::PaymentMethod.sync(object.id, stripe_account: event.try(:account))
|
15
|
+
else
|
16
|
+
# If customer was removed, we should delete the payment method if it exists
|
17
|
+
Pay::PaymentMethod.find_by_processor_and_id(:stripe, object.id)&.destroy
|
18
|
+
end
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
@@ -3,41 +3,7 @@ module Pay
|
|
3
3
|
module Webhooks
|
4
4
|
class SubscriptionCreated
|
5
5
|
def call(event)
|
6
|
-
object
|
7
|
-
|
8
|
-
# We may already have the subscription in the database, so we can update that record
|
9
|
-
subscription = Pay.subscription_model.find_by(processor: :stripe, processor_id: object.id)
|
10
|
-
|
11
|
-
# Create the subscription in the database if we don't have it already
|
12
|
-
if subscription.nil?
|
13
|
-
# The customer should already be in the database
|
14
|
-
owner = Pay.find_billable(processor: :stripe, processor_id: object.customer)
|
15
|
-
|
16
|
-
if owner.nil?
|
17
|
-
Rails.logger.error("[Pay] Unable to find Pay::Billable with processor: :stripe and processor_id: '#{object.customer}'. Searched these models: #{Pay.billable_models.join(", ")}")
|
18
|
-
return
|
19
|
-
end
|
20
|
-
|
21
|
-
subscription = Pay.subscription_model.new(name: Pay.default_product_name, owner: owner, processor: :stripe, processor_id: object.id)
|
22
|
-
end
|
23
|
-
|
24
|
-
subscription.quantity = object.quantity
|
25
|
-
subscription.status = object.status
|
26
|
-
subscription.processor_plan = object.plan.id
|
27
|
-
subscription.trial_ends_at = Time.at(object.trial_end) if object.trial_end.present?
|
28
|
-
|
29
|
-
# If user was on trial, their subscription ends at the end of the trial
|
30
|
-
subscription.ends_at = if object.cancel_at_period_end && subscription.on_trial?
|
31
|
-
subscription.trial_ends_at
|
32
|
-
|
33
|
-
# User wasn't on trial, so subscription ends at period end
|
34
|
-
elsif object.cancel_at_period_end
|
35
|
-
Time.at(object.current_period_end)
|
36
|
-
|
37
|
-
# Subscription isn't marked to cancel at period end
|
38
|
-
end
|
39
|
-
|
40
|
-
subscription.save!
|
6
|
+
Pay::Stripe::Subscription.sync(event.data.object.id, stripe_account: event.try(:account))
|
41
7
|
end
|
42
8
|
end
|
43
9
|
end
|
@@ -3,15 +3,8 @@ module Pay
|
|
3
3
|
module Webhooks
|
4
4
|
class SubscriptionDeleted
|
5
5
|
def call(event)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# We couldn't find the subscription for some reason, maybe it's from another service
|
10
|
-
return if subscription.nil?
|
11
|
-
|
12
|
-
# User canceled subscriptions have an ends_at
|
13
|
-
# Automatically canceled subscriptions need this value set
|
14
|
-
subscription.update!(ends_at: Time.at(object.ended_at)) if subscription.ends_at.blank? && object.ended_at.present?
|
6
|
+
# Canceled subscriptions are still accessible via the API, so we can sync their details
|
7
|
+
Pay::Stripe::Subscription.sync(event.data.object.id, stripe_account: event.try(:account))
|
15
8
|
end
|
16
9
|
end
|
17
10
|
end
|
@@ -2,15 +2,23 @@ module Pay
|
|
2
2
|
module Stripe
|
3
3
|
module Webhooks
|
4
4
|
class SubscriptionRenewing
|
5
|
+
# Handles `invoice.upcoming` webhook from Stripe
|
6
|
+
# Occurs X number of days before a subscription is scheduled to create an invoice that is automatically charged—where X is determined by your subscriptions settings. Note: The received Invoice object will not have an invoice ID.
|
7
|
+
|
5
8
|
def call(event)
|
6
9
|
# Event is of type "invoice" see:
|
7
10
|
# https://stripe.com/docs/api/invoices/object
|
8
|
-
subscription = Pay.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
subscription = Pay::Subscription.find_by_processor_and_id(:stripe, event.data.object.subscription)
|
12
|
+
return unless subscription
|
13
|
+
|
14
|
+
# Stripe subscription items all have the same interval
|
15
|
+
price = event.data.object.lines.data.first.price
|
16
|
+
return unless price.type == "recurring"
|
17
|
+
|
18
|
+
interval = price.recurring.interval
|
19
|
+
return unless interval == "year"
|
20
|
+
|
21
|
+
notify_user(subscription.customer.owner, subscription, Time.zone.at(event.data.object.next_payment_attempt))
|
14
22
|
end
|
15
23
|
|
16
24
|
def notify_user(billable, subscription, date)
|
@@ -3,34 +3,7 @@ module Pay
|
|
3
3
|
module Webhooks
|
4
4
|
class SubscriptionUpdated
|
5
5
|
def call(event)
|
6
|
-
|
7
|
-
subscription = Pay.subscription_model.find_by(processor: :stripe, processor_id: object.id)
|
8
|
-
|
9
|
-
return if subscription.nil?
|
10
|
-
|
11
|
-
# Delete any subscription attempts that have expired
|
12
|
-
if object.status == "incomplete_expired"
|
13
|
-
subscription.destroy
|
14
|
-
return
|
15
|
-
end
|
16
|
-
|
17
|
-
subscription.status = object.status
|
18
|
-
subscription.quantity = object.quantity
|
19
|
-
subscription.processor_plan = object.plan.id
|
20
|
-
subscription.trial_ends_at = Time.at(object.trial_end) if object.trial_end.present?
|
21
|
-
|
22
|
-
# If user was on trial, their subscription ends at the end of the trial
|
23
|
-
subscription.ends_at = if object.cancel_at_period_end && subscription.on_trial?
|
24
|
-
subscription.trial_ends_at
|
25
|
-
|
26
|
-
# User wasn't on trial, so subscription ends at period end
|
27
|
-
elsif object.cancel_at_period_end
|
28
|
-
Time.at(object.current_period_end)
|
29
|
-
|
30
|
-
# Subscription isn't marked to cancel at period end
|
31
|
-
end
|
32
|
-
|
33
|
-
subscription.save!
|
6
|
+
Pay::Stripe::Subscription.sync(event.data.object.id)
|
34
7
|
end
|
35
8
|
end
|
36
9
|
end
|
data/lib/pay/stripe.rb
CHANGED
@@ -2,16 +2,23 @@ module Pay
|
|
2
2
|
module Stripe
|
3
3
|
autoload :Billable, "pay/stripe/billable"
|
4
4
|
autoload :Charge, "pay/stripe/charge"
|
5
|
-
autoload :Subscription, "pay/stripe/subscription"
|
6
5
|
autoload :Error, "pay/stripe/error"
|
6
|
+
autoload :Merchant, "pay/stripe/merchant"
|
7
|
+
autoload :PaymentMethod, "pay/stripe/payment_method"
|
8
|
+
autoload :Subscription, "pay/stripe/subscription"
|
7
9
|
|
8
10
|
module Webhooks
|
11
|
+
autoload :AccountUpdated, "pay/stripe/webhooks/account_updated"
|
9
12
|
autoload :ChargeRefunded, "pay/stripe/webhooks/charge_refunded"
|
10
13
|
autoload :ChargeSucceeded, "pay/stripe/webhooks/charge_succeeded"
|
14
|
+
autoload :CheckoutSessionCompleted, "pay/stripe/webhooks/checkout_session_completed"
|
15
|
+
autoload :CheckoutSessionAsyncPaymentSucceeded, "pay/stripe/webhooks/checkout_session_async_payment_succeeded"
|
11
16
|
autoload :CustomerDeleted, "pay/stripe/webhooks/customer_deleted"
|
12
17
|
autoload :CustomerUpdated, "pay/stripe/webhooks/customer_updated"
|
13
18
|
autoload :PaymentActionRequired, "pay/stripe/webhooks/payment_action_required"
|
14
19
|
autoload :PaymentIntentSucceeded, "pay/stripe/webhooks/payment_intent_succeeded"
|
20
|
+
autoload :PaymentMethodAttached, "pay/stripe/webhooks/payment_method_attached"
|
21
|
+
autoload :PaymentMethodDetached, "pay/stripe/webhooks/payment_method_detached"
|
15
22
|
autoload :PaymentMethodUpdated, "pay/stripe/webhooks/payment_method_updated"
|
16
23
|
autoload :SubscriptionCreated, "pay/stripe/webhooks/subscription_created"
|
17
24
|
autoload :SubscriptionDeleted, "pay/stripe/webhooks/subscription_deleted"
|
@@ -77,10 +84,17 @@ module Pay
|
|
77
84
|
events.subscribe "stripe.customer.deleted", Pay::Stripe::Webhooks::CustomerDeleted.new
|
78
85
|
|
79
86
|
# If a customer's payment source was deleted in Stripe, we should update as well
|
80
|
-
events.subscribe "stripe.payment_method.attached", Pay::Stripe::Webhooks::
|
87
|
+
events.subscribe "stripe.payment_method.attached", Pay::Stripe::Webhooks::PaymentMethodAttached.new
|
81
88
|
events.subscribe "stripe.payment_method.updated", Pay::Stripe::Webhooks::PaymentMethodUpdated.new
|
82
89
|
events.subscribe "stripe.payment_method.card_automatically_updated", Pay::Stripe::Webhooks::PaymentMethodUpdated.new
|
83
|
-
events.subscribe "stripe.payment_method.detached", Pay::Stripe::Webhooks::
|
90
|
+
events.subscribe "stripe.payment_method.detached", Pay::Stripe::Webhooks::PaymentMethodDetached.new
|
91
|
+
|
92
|
+
# If an account is updated in stripe, we should update it as well
|
93
|
+
events.subscribe "stripe.account.updated", Pay::Stripe::Webhooks::AccountUpdated.new
|
94
|
+
|
95
|
+
# Handle subscriptions in Stripe Checkout Sessions
|
96
|
+
events.subscribe "stripe.checkout.session.completed", Pay::Stripe::Webhooks::CheckoutSessionCompleted.new
|
97
|
+
events.subscribe "stripe.checkout.session.async_payment_succeeded", Pay::Stripe::Webhooks::CheckoutSessionAsyncPaymentSucceeded.new
|
84
98
|
end
|
85
99
|
end
|
86
100
|
end
|
data/lib/pay/version.rb
CHANGED
@@ -35,6 +35,10 @@ module Pay
|
|
35
35
|
backend.instrument name_with_namespace(type), event
|
36
36
|
end
|
37
37
|
|
38
|
+
def listening?(type)
|
39
|
+
backend.notifier.listening? name_with_namespace(type)
|
40
|
+
end
|
41
|
+
|
38
42
|
# Strips down to event data only
|
39
43
|
class NotificationAdapter
|
40
44
|
def initialize(subscriber)
|
data/lib/pay/webhooks.rb
CHANGED
data/lib/pay.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require "pay/version"
|
2
2
|
require "pay/engine"
|
3
3
|
require "pay/errors"
|
4
|
+
require "pay/adapter"
|
4
5
|
|
5
6
|
module Pay
|
6
|
-
autoload :
|
7
|
+
autoload :Attributes, "pay/attributes"
|
7
8
|
autoload :Env, "pay/env"
|
9
|
+
autoload :NanoId, "pay/nano_id"
|
8
10
|
autoload :Payment, "pay/payment"
|
9
11
|
autoload :Receipts, "pay/receipts"
|
10
12
|
|
@@ -16,27 +18,15 @@ module Pay
|
|
16
18
|
|
17
19
|
autoload :Webhooks, "pay/webhooks"
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
mattr_accessor :braintree_gateway
|
21
|
+
module Billable
|
22
|
+
autoload :SyncCustomer, "pay/billable/sync_customer"
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
@@billable_table = @@billable_class.tableize
|
25
|
+
mattr_accessor :braintree_gateway
|
26
26
|
|
27
27
|
mattr_accessor :model_parent_class
|
28
28
|
@@model_parent_class = "ApplicationRecord"
|
29
29
|
|
30
|
-
mattr_accessor :chargeable_class
|
31
|
-
mattr_accessor :chargeable_table
|
32
|
-
@@chargeable_class = "Pay::Charge"
|
33
|
-
@@chargeable_table = "pay_charges"
|
34
|
-
|
35
|
-
mattr_accessor :subscription_class
|
36
|
-
mattr_accessor :subscription_table
|
37
|
-
@@subscription_class = "Pay::Subscription"
|
38
|
-
@@subscription_table = "pay_subscriptions"
|
39
|
-
|
40
30
|
# Business details for receipts
|
41
31
|
mattr_accessor :application_name
|
42
32
|
mattr_accessor :business_address
|
@@ -52,6 +42,7 @@ module Pay
|
|
52
42
|
|
53
43
|
mattr_accessor :default_product_name
|
54
44
|
@@default_product_name = "default"
|
45
|
+
|
55
46
|
mattr_accessor :default_plan_name
|
56
47
|
@@default_plan_name = "default"
|
57
48
|
|
@@ -62,46 +53,6 @@ module Pay
|
|
62
53
|
yield self
|
63
54
|
end
|
64
55
|
|
65
|
-
def self.billable_models
|
66
|
-
Pay::Billable.includers
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.find_billable(processor:, processor_id:)
|
70
|
-
billable_models.each do |model|
|
71
|
-
if (record = model.find_by(processor: processor, processor_id: processor_id))
|
72
|
-
return record
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
nil
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.user_model
|
80
|
-
ActiveSupport::Deprecation.warn("Pay.user_model is deprecated and will be removed in v3. Instead, use `Pay.billable_models` now to support more than one billable model.")
|
81
|
-
|
82
|
-
if Rails.application.config.cache_classes
|
83
|
-
@@user_model ||= billable_class.constantize
|
84
|
-
else
|
85
|
-
billable_class.constantize
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def self.charge_model
|
90
|
-
if Rails.application.config.cache_classes
|
91
|
-
@@charge_model ||= chargeable_class.constantize
|
92
|
-
else
|
93
|
-
chargeable_class.constantize
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.subscription_model
|
98
|
-
if Rails.application.config.cache_classes
|
99
|
-
@@subscription_model ||= subscription_class.constantize
|
100
|
-
else
|
101
|
-
subscription_class.constantize
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
56
|
def self.receipts_supported?
|
106
57
|
charge_model.respond_to?(:receipt) &&
|
107
58
|
application_name.present? &&
|
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:
|
4
|
+
version: 3.0.0
|
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-
|
12
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -17,34 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 6.0.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: minitest-rails
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '6'
|
35
|
-
- - "<"
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '7.0'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: '6'
|
45
|
-
- - "<"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '7.0'
|
27
|
+
version: 6.0.0
|
48
28
|
- !ruby/object:Gem::Dependency
|
49
29
|
name: mocha
|
50
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,12 +102,16 @@ files:
|
|
122
102
|
- app/controllers/pay/webhooks/stripe_controller.rb
|
123
103
|
- app/helpers/pay/application_helper.rb
|
124
104
|
- app/jobs/pay/application_job.rb
|
125
|
-
- app/jobs/pay/
|
105
|
+
- app/jobs/pay/customer_sync_job.rb
|
126
106
|
- app/mailers/pay/application_mailer.rb
|
127
107
|
- app/mailers/pay/user_mailer.rb
|
128
108
|
- app/models/pay/application_record.rb
|
129
109
|
- app/models/pay/charge.rb
|
110
|
+
- app/models/pay/customer.rb
|
111
|
+
- app/models/pay/merchant.rb
|
112
|
+
- app/models/pay/payment_method.rb
|
130
113
|
- app/models/pay/subscription.rb
|
114
|
+
- app/models/pay/webhook.rb
|
131
115
|
- app/views/layouts/pay/application.html.erb
|
132
116
|
- app/views/pay/payments/show.html.erb
|
133
117
|
- app/views/pay/stripe/_checkout_button.html.erb
|
@@ -137,25 +121,26 @@ files:
|
|
137
121
|
- app/views/pay/user_mailer/subscription_renewing.html.erb
|
138
122
|
- config/locales/en.yml
|
139
123
|
- config/routes.rb
|
140
|
-
- db/migrate/
|
141
|
-
-
|
142
|
-
-
|
143
|
-
-
|
144
|
-
-
|
145
|
-
- lib/generators/
|
146
|
-
- lib/generators/active_record/templates/migration.rb
|
124
|
+
- db/migrate/1_create_pay_tables.rb
|
125
|
+
- lib/generators/active_record/billable_generator.rb
|
126
|
+
- lib/generators/active_record/merchant_generator.rb
|
127
|
+
- lib/generators/active_record/templates/billable_migration.rb
|
128
|
+
- lib/generators/active_record/templates/merchant_migration.rb
|
129
|
+
- lib/generators/pay/billable_generator.rb
|
147
130
|
- lib/generators/pay/email_views_generator.rb
|
131
|
+
- lib/generators/pay/merchant_generator.rb
|
148
132
|
- lib/generators/pay/orm_helpers.rb
|
149
|
-
- lib/generators/pay/pay_generator.rb
|
150
133
|
- lib/generators/pay/views_generator.rb
|
151
134
|
- lib/pay.rb
|
152
|
-
- lib/pay/
|
153
|
-
- lib/pay/
|
135
|
+
- lib/pay/adapter.rb
|
136
|
+
- lib/pay/attributes.rb
|
137
|
+
- lib/pay/billable/sync_customer.rb
|
154
138
|
- lib/pay/braintree.rb
|
155
139
|
- lib/pay/braintree/authorization_error.rb
|
156
140
|
- lib/pay/braintree/billable.rb
|
157
141
|
- lib/pay/braintree/charge.rb
|
158
142
|
- lib/pay/braintree/error.rb
|
143
|
+
- lib/pay/braintree/payment_method.rb
|
159
144
|
- lib/pay/braintree/subscription.rb
|
160
145
|
- lib/pay/braintree/webhooks/subscription_canceled.rb
|
161
146
|
- lib/pay/braintree/webhooks/subscription_charged_successfully.rb
|
@@ -171,11 +156,16 @@ files:
|
|
171
156
|
- lib/pay/fake_processor/billable.rb
|
172
157
|
- lib/pay/fake_processor/charge.rb
|
173
158
|
- lib/pay/fake_processor/error.rb
|
159
|
+
- lib/pay/fake_processor/payment_method.rb
|
174
160
|
- lib/pay/fake_processor/subscription.rb
|
161
|
+
- lib/pay/merchant.rb
|
162
|
+
- lib/pay/nano_id.rb
|
175
163
|
- lib/pay/paddle.rb
|
176
164
|
- lib/pay/paddle/billable.rb
|
177
165
|
- lib/pay/paddle/charge.rb
|
178
166
|
- lib/pay/paddle/error.rb
|
167
|
+
- lib/pay/paddle/payment_method.rb
|
168
|
+
- lib/pay/paddle/response.rb
|
179
169
|
- lib/pay/paddle/subscription.rb
|
180
170
|
- lib/pay/paddle/webhooks/signature_verifier.rb
|
181
171
|
- lib/pay/paddle/webhooks/subscription_cancelled.rb
|
@@ -189,13 +179,20 @@ files:
|
|
189
179
|
- lib/pay/stripe/billable.rb
|
190
180
|
- lib/pay/stripe/charge.rb
|
191
181
|
- lib/pay/stripe/error.rb
|
182
|
+
- lib/pay/stripe/merchant.rb
|
183
|
+
- lib/pay/stripe/payment_method.rb
|
192
184
|
- lib/pay/stripe/subscription.rb
|
185
|
+
- lib/pay/stripe/webhooks/account_updated.rb
|
193
186
|
- lib/pay/stripe/webhooks/charge_refunded.rb
|
194
187
|
- lib/pay/stripe/webhooks/charge_succeeded.rb
|
188
|
+
- lib/pay/stripe/webhooks/checkout_session_async_payment_succeeded.rb
|
189
|
+
- lib/pay/stripe/webhooks/checkout_session_completed.rb
|
195
190
|
- lib/pay/stripe/webhooks/customer_deleted.rb
|
196
191
|
- lib/pay/stripe/webhooks/customer_updated.rb
|
197
192
|
- lib/pay/stripe/webhooks/payment_action_required.rb
|
198
193
|
- lib/pay/stripe/webhooks/payment_intent_succeeded.rb
|
194
|
+
- lib/pay/stripe/webhooks/payment_method_attached.rb
|
195
|
+
- lib/pay/stripe/webhooks/payment_method_detached.rb
|
199
196
|
- lib/pay/stripe/webhooks/payment_method_updated.rb
|
200
197
|
- lib/pay/stripe/webhooks/subscription_created.rb
|
201
198
|
- lib/pay/stripe/webhooks/subscription_deleted.rb
|
@@ -204,6 +201,7 @@ files:
|
|
204
201
|
- lib/pay/version.rb
|
205
202
|
- lib/pay/webhooks.rb
|
206
203
|
- lib/pay/webhooks/delegator.rb
|
204
|
+
- lib/pay/webhooks/process_job.rb
|
207
205
|
homepage: https://github.com/pay-rails/pay
|
208
206
|
licenses:
|
209
207
|
- MIT
|
@@ -223,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
221
|
- !ruby/object:Gem::Version
|
224
222
|
version: '0'
|
225
223
|
requirements: []
|
226
|
-
rubygems_version: 3.2.
|
224
|
+
rubygems_version: 3.2.22
|
227
225
|
signing_key:
|
228
226
|
specification_version: 4
|
229
227
|
summary: Payments engine for Ruby on Rails
|