Module: Pay
- Defined in:
- lib/pay/braintree/webhooks/subscription_expired.rb,
lib/pay.rb,
lib/pay/env.rb,
lib/pay/engine.rb,
lib/pay/errors.rb,
lib/pay/paddle.rb,
lib/pay/stripe.rb,
lib/pay/payment.rb,
lib/pay/version.rb,
lib/pay/billable.rb,
lib/pay/receipts.rb,
lib/pay/webhooks.rb,
lib/pay/braintree.rb,
lib/pay/paddle/error.rb,
lib/pay/stripe/error.rb,
app/models/pay/charge.rb,
lib/pay/paddle/charge.rb,
lib/pay/stripe/charge.rb,
lib/pay/fake_processor.rb,
lib/pay/braintree/error.rb,
lib/pay/paddle/billable.rb,
lib/pay/stripe/billable.rb,
lib/pay/braintree/charge.rb,
lib/pay/braintree/billable.rb,
lib/pay/webhooks/delegator.rb,
app/jobs/pay/email_sync_job.rb,
app/mailers/pay/user_mailer.rb,
app/models/pay/subscription.rb,
lib/pay/billable/sync_email.rb,
lib/pay/paddle/subscription.rb,
lib/pay/stripe/subscription.rb,
app/jobs/pay/application_job.rb,
lib/pay/fake_processor/error.rb,
lib/pay/fake_processor/charge.rb,
lib/generators/pay/orm_helpers.rb,
lib/pay/braintree/subscription.rb,
lib/pay/fake_processor/billable.rb,
lib/generators/pay/pay_generator.rb,
lib/pay/stripe_marketplace/error.rb,
app/models/pay/application_record.rb,
lib/pay/stripe_marketplace/charge.rb,
app/helpers/pay/application_helper.rb,
app/mailers/pay/application_mailer.rb,
lib/generators/pay/views_generator.rb,
lib/pay/fake_processor/subscription.rb,
lib/pay/stripe_marketplace/billable.rb,
lib/pay/braintree/authorization_error.rb,
app/controllers/pay/payments_controller.rb,
lib/pay/stripe/webhooks/charge_refunded.rb,
lib/pay/stripe_marketplace/subscription.rb,
lib/generators/pay/email_views_generator.rb,
lib/pay/stripe/webhooks/charge_succeeded.rb,
lib/pay/stripe/webhooks/customer_deleted.rb,
lib/pay/stripe/webhooks/customer_updated.rb,
app/controllers/pay/application_controller.rb,
lib/pay/paddle/webhooks/signature_verifier.rb,
lib/pay/paddle/webhooks/subscription_created.rb,
lib/pay/paddle/webhooks/subscription_updated.rb,
lib/pay/stripe/webhooks/subscription_created.rb,
lib/pay/stripe/webhooks/subscription_deleted.rb,
lib/pay/stripe/webhooks/subscription_updated.rb,
lib/pay/stripe/webhooks/subscription_renewing.rb,
app/controllers/pay/webhooks/paddle_controller.rb,
app/controllers/pay/webhooks/stripe_controller.rb,
lib/pay/paddle/webhooks/subscription_cancelled.rb,
lib/pay/stripe/webhooks/payment_method_updated.rb,
lib/pay/stripe/webhooks/payment_action_required.rb,
lib/pay/braintree/webhooks/subscription_canceled.rb,
lib/pay/stripe/webhooks/payment_intent_succeeded.rb,
app/controllers/pay/webhooks/braintree_controller.rb,
lib/pay/braintree/webhooks/subscription_trial_ended.rb,
lib/pay/braintree/webhooks/subscription_went_active.rb,
lib/pay/stripe_marketplace/webhooks/charge_refunded.rb,
lib/pay/stripe_marketplace/webhooks/charge_succeeded.rb,
lib/pay/stripe_marketplace/webhooks/customer_deleted.rb,
lib/pay/stripe_marketplace/webhooks/customer_updated.rb,
lib/pay/braintree/webhooks/subscription_went_past_due.rb,
lib/pay/paddle/webhooks/subscription_payment_refunded.rb,
lib/pay/paddle/webhooks/subscription_payment_succeeded.rb,
lib/pay/stripe_marketplace/webhooks/subscription_created.rb,
lib/pay/stripe_marketplace/webhooks/subscription_deleted.rb,
lib/pay/stripe_marketplace/webhooks/subscription_updated.rb,
lib/pay/stripe_marketplace/webhooks/subscription_renewing.rb,
lib/pay/stripe_marketplace/webhooks/payment_method_updated.rb,
lib/pay/stripe_marketplace/webhooks/payment_action_required.rb,
lib/pay/braintree/webhooks/subscription_charged_successfully.rb,
lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb
Overview
A subscription successfully moves to the next billing cycle. This will also occur when either a new transaction is created mid-cycle due to proration on an upgrade or a billing cycle is skipped due to the presence of a negative balance that covers the cost of the subscription.
Defined Under Namespace
Modules: ApplicationHelper, Billable, Braintree, Env, FakeProcessor, Generators, Paddle, Receipts, Stripe, StripeMarketplace, Webhooks
Classes: ActionRequired, ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Charge, EmailSyncJob, Engine, Error, InvalidPaymentMethod, Payment, PaymentError, PaymentsController, Subscription, UserMailer
Constant Summary
collapse
- VERSION =
"2.6.7"
- @@billable_class =
"User"
- @@billable_table =
@@billable_class.tableize
- @@model_parent_class =
"ApplicationRecord"
- @@chargeable_class =
"Pay::Charge"
- @@chargeable_table =
"pay_charges"
- @@subscription_class =
"Pay::Subscription"
- @@subscription_table =
"pay_subscriptions"
- @@send_emails =
true
- @@automount_routes =
true
- @@default_product_name =
"default"
- @@default_plan_name =
"default"
- @@routes_path =
"/pay"
Class Method Summary
collapse
Class Method Details
.billable_models ⇒ Object
.charge_model ⇒ Object
89
90
91
92
93
94
95
|
# File 'lib/pay.rb', line 89
def self.charge_model
if Rails.application.config.cache_classes
@@charge_model ||= chargeable_class.constantize
else
chargeable_class.constantize
end
end
|
.find_billable(processor:, processor_id:) ⇒ Object
69
70
71
72
73
74
75
76
77
|
# File 'lib/pay.rb', line 69
def self.find_billable(processor:, processor_id:)
billable_models.each do |model|
if (record = model.find_by(processor: processor, processor_id: processor_id))
return record
end
end
nil
end
|
.receipts_supported? ⇒ Boolean
105
106
107
108
109
110
111
|
# File 'lib/pay.rb', line 105
def self.receipts_supported?
charge_model.respond_to?(:receipt) &&
application_name.present? &&
business_name &&
business_address &&
support_email
end
|
.setup {|_self| ... } ⇒ Object
61
62
63
|
# File 'lib/pay.rb', line 61
def self.setup
yield self
end
|
.subscription_model ⇒ Object
97
98
99
100
101
102
103
|
# File 'lib/pay.rb', line 97
def self.subscription_model
if Rails.application.config.cache_classes
@@subscription_model ||= subscription_class.constantize
else
subscription_class.constantize
end
end
|
.user_model ⇒ Object
79
80
81
82
83
84
85
86
87
|
# File 'lib/pay.rb', line 79
def self.user_model
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.")
if Rails.application.config.cache_classes
@@user_model ||= billable_class.constantize
else
billable_class.constantize
end
end
|