- A
- C
- E
- I
- L
- M
- P
- R
- S
- V
Attributes
| [R] | event |
Instance Public methods
add_member_to_plan() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 110 def add_member_to_plan member.plans << plan end
amount() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 29 def amount @_amount ||= Service::Money.new(charge.amount, charge.currency) end
charge() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 33 def charge payment_intent.charges.data.first end
charge_receipt_data() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 91 def charge_receipt_data { member_id: member.id, amount: amount.format, charge_id: charge.id, plan_id: public_plan_id } end
execute() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 14 def execute remove_pending_payment_intent_from_subscriptions recover_abandoned_charge add_member_to_plan send_notifications log_charge_event record_payment_event end
invoice_from_subscription?() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 53 def invoice_from_subscription? payment_intent.invoice.present? && subscription_id.present? && DB::Subscription.exists?(payment_gateway_id: subscription_id) end
log_charge_event() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 66 def log_charge_event Dispatch.track( model: member, action: :charge_created, title: "Charged #{amount.format}", details: {amount: amount.format, charge_id: charge.id} ) end
member() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 37 def member @_member ||= DB::Member.find_by(payment_gateway_id: payment_intent.customer) end
payment_intent() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 41 def payment_intent event.data.object end
perform(event) Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 8 def perform(event) @event = event execute if valid? end
plan() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 114 def plan site.plans.friendly.find(public_plan_id, allow_nil: true) end
plan_or_subscription_present?() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 45 def plan_or_subscription_present? plan.present? || invoice_from_subscription? end
public_plan_id() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 49 def public_plan_id payment_intent.metadata[:memberspace_plan_id] end
record_payment_event() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 100 def record_payment_event if payment_intent.livemode Service::Mixpanel.track(:record_payment, member:, currency: payment_intent.currency, amount_cents: payment_intent.amount_received, fee_cents: payment_intent.application_fee_amount) end end
recover_abandoned_charge() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 75 def recover_abandoned_charge FailedPaymentRecorder.new(charge, member).recover_abandoned_charge end
remove_pending_payment_intent_from_subscriptions() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 79 def remove_pending_payment_intent_from_subscriptions DB::Subscription.where(pending_intent_id: payment_intent.id).update_all(pending_intent_id: nil) end
send_notifications() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 83 def send_notifications if member.of_memberspace? && !!ENV["SEND_MEMBERSPACE_ROI_EMAIL"] Api::AdminBillingChargeReceiptJob.perform_later(site, charge_receipt_data) else Emailer.billing_charge_receipt(site, charge_receipt_data).deliver_later end end
site() Link
Source: show
# File engines/api/app/jobs/api/stripe_job/webhook/payment_intent/succeeded.rb, line 118 def site member.site end