repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/braintree/braintree_card_type.rb | app/business/payments/charging/implementations/braintree/braintree_card_type.rb | # frozen_string_literal: true
class BraintreeCardType
CARD_TYPES = {
"Visa" => CardType::VISA,
"American Express" => CardType::AMERICAN_EXPRESS,
"MasterCard" => CardType::MASTERCARD,
"Discover" => CardType::DISCOVER,
"JCB" => CardType::JCB,
"Diners Club" => CardType::DINERS_CLUB,
CardType... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/braintree/braintree_charge.rb | app/business/payments/charging/implementations/braintree/braintree_charge.rb | # frozen_string_literal: true
class BraintreeCharge < BaseProcessorCharge
def initialize(braintree_charge, load_extra_details:)
self.charge_processor_id = BraintreeChargeProcessor.charge_processor_id
self.zip_check_result = nil
self.id = braintree_charge.id
self.status = braintree_charge.status.to_s.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/braintree/braintree_charge_intent.rb | app/business/payments/charging/implementations/braintree/braintree_charge_intent.rb | # frozen_string_literal: true
class BraintreeChargeIntent < ChargeIntent
def initialize(charge: nil)
self.charge = charge
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/braintree/braintree_chargeable_base.rb | app/business/payments/charging/implementations/braintree/braintree_chargeable_base.rb | # frozen_string_literal: true
class BraintreeChargeableBase
attr_accessor :braintree_device_data
attr_reader :payment_method_id
def charge_processor_id
BraintreeChargeProcessor.charge_processor_id
end
def prepare!
raise NotImplementedError
end
def funding_type
nil
end
def fingerprint
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_charge_processor.rb | app/business/payments/charging/implementations/stripe/stripe_charge_processor.rb | # frozen_string_literal: true
class StripeChargeProcessor
include StripeErrorHandler
extend CurrencyHelper
DISPLAY_NAME = "Stripe"
# https://stripe.com/docs/api/charges/object#charge_object-status
VALID_TRANSACTION_STATUSES = %w(succeeded pending).freeze
# https://stripe.com/docs/api/refunds/create#crea... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_chargeable_token.rb | app/business/payments/charging/implementations/stripe/stripe_chargeable_token.rb | # frozen_string_literal: true
# Public: Chargeable representing pre-tokenized data using Stripe.
class StripeChargeableToken
include StripeErrorHandler
attr_reader :payment_method_id
def initialize(token, zip_code, product_permalink:)
@token_s = token
@zip_code = zip_code
@merchant_account = get_me... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_card_type.rb | app/business/payments/charging/implementations/stripe/stripe_card_type.rb | # frozen_string_literal: true
class StripeCardType
CARD_TYPES = {
"Visa" => CardType::VISA,
"American Express" => CardType::AMERICAN_EXPRESS,
"MasterCard" => CardType::MASTERCARD,
"Discover" => CardType::DISCOVER,
"JCB" => CardType::JCB,
"Diners Club" => CardType::DINERS_CLUB,
"UnionPay" ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_charge_refund.rb | app/business/payments/charging/implementations/stripe/stripe_charge_refund.rb | # frozen_string_literal: true
class StripeChargeRefund < ChargeRefund
# Public: Create a ChargeRefund from a Stripe::Refund
#
# Inherits attr_accessor :charge_processor_id, :id, :charge_id, :flow_of_funds, :refund from ChargeRefund
attr_reader :charge,
:destination_payment_refund,
:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_chargeable_credit_card.rb | app/business/payments/charging/implementations/stripe/stripe_chargeable_credit_card.rb | # frozen_string_literal: true
# Public: Chargeable representing a card stored at Stripe.
class StripeChargeableCreditCard
include StripeErrorHandler
attr_reader :fingerprint, :payment_method_id, :last4, :visual, :number_length,
:expiry_month, :expiry_year, :zip_code, :card_type, :country,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_charge_radar_processor.rb | app/business/payments/charging/implementations/stripe/stripe_charge_radar_processor.rb | # frozen_string_literal: true
# Sample Stripe event:
# {
# "id": "evt_0O8n7L9e1RjUNIyY90W7gkV3",
# "object": "event",
# "api_version": "2020-08-27",
# "created": 1699116878,
# "data": {
# "object": {
# "id": "issfr_0O8n7K9e1RjUNIyYmTbvMMLa",
# "object": "radar.early_fraud_warning",
# "a... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_charge_intent.rb | app/business/payments/charging/implementations/stripe/stripe_charge_intent.rb | # frozen_string_literal: true
# Creates a ChargeIntent from Stripe::PaymentIntent
class StripeChargeIntent < ChargeIntent
delegate :id, :client_secret, to: :payment_intent
def initialize(payment_intent:, merchant_account: nil)
self.payment_intent = payment_intent
load_charge(payment_intent, merchant_acco... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_setup_intent.rb | app/business/payments/charging/implementations/stripe/stripe_setup_intent.rb | # frozen_string_literal: true
# Creates a SetupIntent from Stripe::SetupIntent
class StripeSetupIntent < SetupIntent
delegate :id, :client_secret, to: :setup_intent
def initialize(setup_intent)
self.setup_intent = setup_intent
validate_next_action
end
def succeeded?
setup_intent.status == StripeI... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_chargeable_payment_method.rb | app/business/payments/charging/implementations/stripe/stripe_chargeable_payment_method.rb | # frozen_string_literal: true
class StripeChargeablePaymentMethod
include StripeErrorHandler
attr_reader :payment_method_id, :stripe_setup_intent_id, :stripe_payment_intent_id
def initialize(payment_method_id, customer_id: nil,
stripe_setup_intent_id: nil,
stripe_payment_inten... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/stripe_charge.rb | app/business/payments/charging/implementations/stripe/stripe_charge.rb | # frozen_string_literal: true
class StripeCharge < BaseProcessorCharge
# Public: Create a BaseProcessorCharge from a Stripe::Charge and a Stripe::BalanceTransaction
def initialize(stripe_charge, stripe_charge_balance_transaction, stripe_application_fee_balance_transaction,
stripe_destination_payme... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/helpers/stripe_error_handler.rb | app/business/payments/charging/implementations/stripe/helpers/stripe_error_handler.rb | # frozen_string_literal: true
module StripeErrorHandler
private
def with_stripe_error_handler
yield
rescue Stripe::InvalidRequestError => e
raise ChargeProcessorInvalidRequestError.new(original_error: e)
rescue Stripe::APIConnectionError, Stripe::APIError => e
raise ChargeProcessorUnava... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/stripe/helpers/stripe_intent_status.rb | app/business/payments/charging/implementations/stripe/helpers/stripe_intent_status.rb | # frozen_string_literal: true
class StripeIntentStatus
SUCCESS = "succeeded"
REQUIRES_CONFIRMATION = "requires_confirmation"
REQUIRES_ACTION = "requires_action"
PROCESSING = "processing"
CANCELED = "canceled"
ACTION_TYPE_USE_SDK = "use_stripe_sdk"
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_approved_order_chargeable.rb | app/business/payments/charging/implementations/paypal/paypal_approved_order_chargeable.rb | # frozen_string_literal: true
class PaypalApprovedOrderChargeable
attr_reader :fingerprint, :last4, :number_length, :visual, :expiry_month,
:expiry_year, :zip_code, :card_type, :country, :funding_type, :email
def initialize(order_id, visual, country)
@fingerprint = order_id
@visual = visual
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_charge.rb | app/business/payments/charging/implementations/paypal/paypal_charge.rb | # frozen_string_literal: true
class PaypalCharge < BaseProcessorCharge
include CurrencyHelper
attr_accessor :paypal_payment_status, :card_visual
def initialize(paypal_transaction_id:, order_api_used:, payment_details: {})
self.charge_processor_id = PaypalChargeProcessor.charge_processor_id
self.id = pa... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_charge_processor.rb | app/business/payments/charging/implementations/paypal/paypal_charge_processor.rb | # frozen_string_literal: true
class PaypalChargeProcessor
extend PaypalApiResponse
extend CurrencyHelper
DISPLAY_NAME = "PayPal"
MAXIMUM_DESCRIPTOR_LENGTH = 22
MAXIMUM_ITEM_NAME_LENGTH = 127
PAYPAL_VALID_CHARACTERS_REGEX = /[^A-Z0-9. ]/i
private_constant :PAYPAL_VALID_CHARACTERS_REGEX
DISPUTE_OUTC... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_rest_api.rb | app/business/payments/charging/implementations/paypal/paypal_rest_api.rb | # frozen_string_literal: true
class PaypalRestApi
include CurrencyHelper
PAYPAL_INTENT_CAPTURE = "CAPTURE"
def initialize
paypal_environment = Rails.env.production? ?
PayPal::LiveEnvironment.new(PAYPAL_PARTNER_CLIENT_ID, PAYPAL_PARTNER_CLIENT_SECRET) :
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_order_refund.rb | app/business/payments/charging/implementations/paypal/paypal_order_refund.rb | # frozen_string_literal: true
class PaypalOrderRefund < ChargeRefund
def initialize(response, capture_id)
self.charge_processor_id = PaypalChargeProcessor.charge_processor_id
self.charge_id = capture_id
self.id = response.id
@refund = response
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_card_fingerprint.rb | app/business/payments/charging/implementations/paypal/paypal_card_fingerprint.rb | # frozen_string_literal: true
module PaypalCardFingerprint
PAYPAL_FINGERPRINT_PREFIX = "paypal_"
private_constant :PAYPAL_FINGERPRINT_PREFIX
def self.build_paypal_fingerprint(email)
return "#{PAYPAL_FINGERPRINT_PREFIX}#{email}" if email.present?
nil
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_chargeable.rb | app/business/payments/charging/implementations/paypal/paypal_chargeable.rb | # frozen_string_literal: true
class PaypalChargeable
attr_reader :billing_agreement_id, :fingerprint, :last4, :number_length, :visual, :expiry_month,
:expiry_year, :zip_code, :card_type, :country, :funding_type, :email, :payment_method_id
def initialize(billing_agreement_id, visual, country)
@bi... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_charge_refund.rb | app/business/payments/charging/implementations/paypal/paypal_charge_refund.rb | # frozen_string_literal: true
class PaypalChargeRefund < ChargeRefund
include CurrencyHelper
def initialize(paypal_refund_response, charge_id)
self.charge_processor_id = PaypalChargeProcessor.charge_processor_id
self.id = paypal_refund_response.RefundTransactionID
self.charge_id = charge_id
self.f... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/paypal_charge_intent.rb | app/business/payments/charging/implementations/paypal/paypal_charge_intent.rb | # frozen_string_literal: true
class PaypalChargeIntent < ChargeIntent
def initialize(charge: nil)
self.charge = charge
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/helpers/paypal_api_payment_status.rb | app/business/payments/charging/implementations/paypal/helpers/paypal_api_payment_status.rb | # frozen_string_literal: true
module PaypalApiPaymentStatus
REFUNDED = "Refunded"
COMPLETED = "Completed"
REVERSED = "Reversed"
PENDING = "Pending"
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/helpers/paypal_api_error_code_range.rb | app/business/payments/charging/implementations/paypal/helpers/paypal_api_error_code_range.rb | # frozen_string_literal: true
module PaypalApiErrorCodeRange
GENERAL_VALIDATION = (81_000..99_998)
UNAVAILABLE = (10_002..10_101)
CAPTURE_INTERNAL = (10_001..10_482)
PAYMENT_INSTRUMENT_FAILURE = (10_486..20_000)
REFUND_VALIDATION = (10_001..10_406)
REFUND_FAILURE = (10_414..13_751)
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/implementations/paypal/helpers/paypal_api_refund_type.rb | app/business/payments/charging/implementations/paypal/helpers/paypal_api_refund_type.rb | # frozen_string_literal: true
module PaypalApiRefundType
FULL = "Full"
PARTIAL = "Partial"
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/reports/deferred_refunds_reports.rb | app/business/payments/reports/deferred_refunds_reports.rb | # frozen_string_literal: true
module DeferredRefundsReports
def self.deferred_refunds_report(month, year)
json = { "Purchases" => [] }
range = DateTime.new(year, month)...DateTime.new(year, month).end_of_month
refunded_purchase_ids = Refund.where(created_at: range).pluck(:purchase_id)
deferred_refun... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/reports/funds_received_reports.rb | app/business/payments/reports/funds_received_reports.rb | # frozen_string_literal: true
module FundsReceivedReports
def self.funds_received_report(month, year)
json = {}
range = DateTime.new(year, month)...DateTime.new(year, month).end_of_month
successful_purchases = Purchase.successful.not_fully_refunded.not_chargedback_or_chargedback_reversed.where(created_a... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/reports/stripe_currency_balances_report.rb | app/business/payments/reports/stripe_currency_balances_report.rb | # frozen_string_literal: true
module StripeCurrencyBalancesReport
extend CurrencyHelper
def self.stripe_currency_balances_report
currency_balances = {}
stripe_balance = Stripe::Balance.retrieve
stripe_balance.available.sort_by { _1["currency"] }.each do |balance|
currency_balances[balance["cur... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/events/stripe/stripe_event_handler.rb | app/business/payments/events/stripe/stripe_event_handler.rb | # frozen_string_literal: true
class StripeEventHandler
attr_accessor :params
# See full list of events at https://stripe.com/docs/api/events/types
ALL_HANDLED_EVENTS = %w{account.application.deauthorized account.updated capability.updated payout. charge. capital. radar. payment_intent.payment_failed}.freeze
#... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/events/paypal/paypal_event_handler.rb | app/business/payments/events/paypal/paypal_event_handler.rb | # frozen_string_literal: true
class PaypalEventHandler
attr_accessor :paypal_event
IGNORED_TRANSACTION_TYPES = %w[express_checkout cart mp_signup mp_notification mp_cancel].freeze
private_constant :IGNORED_TRANSACTION_TYPES
def initialize(paypal_event)
self.paypal_event = paypal_event
end
def sched... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/events/paypal/paypal_event_type.rb | app/business/payments/events/paypal/paypal_event_type.rb | # frozen_string_literal: true
class PaypalEventType
CUSTOMER_DISPUTE_CREATED = "CUSTOMER.DISPUTE.CREATED"
CUSTOMER_DISPUTE_RESOLVED = "CUSTOMER.DISPUTE.RESOLVED"
PAYMENT_CAPTURE_COMPLETED = "PAYMENT.CAPTURE.COMPLETED"
PAYMENT_CAPTURE_DENIED = "PAYMENT.CAPTURE.DENIED"
PAYMENT_CAPTURE_REVERSED = "PAYMENT.CAPTU... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/transfers/stripe/stripe_transfer_affiliate_credits.rb | app/business/payments/transfers/stripe/stripe_transfer_affiliate_credits.rb | # frozen_string_literal: false
# Handles moving money around internally from Gumroad's Stripe
# account, into Stripe managed accounts. Transfers should be performed
# using the functions on this account rather than directly creating
# Stripe::Transfer objects, since transfers created here are logged to
# Slack rooms w... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/transfers/stripe/stripe_transfer_internally_to_creator.rb | app/business/payments/transfers/stripe/stripe_transfer_internally_to_creator.rb | # frozen_string_literal: true
# Handles moving money around internally from Gumroad's Stripe
# account, into Stripe managed accounts. Transfers should be performed
# using the functions on this account rather than directly creating
# Stripe::Transfer objects, since transfers created here are logged to
# Slack rooms wi... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/transfers/stripe/stripe_transfer_externally_to_gumroad.rb | app/business/payments/transfers/stripe/stripe_transfer_externally_to_gumroad.rb | # frozen_string_literal: true
# Handles moving money for the Gumroad main Stripe account.
# Provides information about how much money is in the Stripe
# balance, and functionality to move money from the Stripe balance
# to Gumroad's bank account.
module StripeTransferExternallyToGumroad
# Maximum amount Stripe is ab... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/utilities/stripe_url.rb | app/business/payments/utilities/stripe_url.rb | # frozen_string_literal: true
module StripeUrl
def self.dashboard_url(account_id: nil)
[base_url(account_id:), "dashboard"].join("/")
end
def self.event_url(event_id, account_id: nil)
[base_url(account_id:), "events", event_id].join("/")
end
def self.transfer_url(transfer_id, account_id: nil)
[... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/utilities/stripe_metadata.rb | app/business/payments/utilities/stripe_metadata.rb | # frozen_string_literal: false
module StripeMetadata
STRIPE_METADATA_VALUE_MAX_LENGTH = 500
STRIPE_METADATA_MAX_KEYS_LENGTH = 50
private_constant :STRIPE_METADATA_VALUE_MAX_LENGTH
# Public: Builds a hash to be included in Stripe metadata that lists the items passed in, separated by the
# separator and sp... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/utilities/braintree_exceptions.rb | app/business/payments/utilities/braintree_exceptions.rb | # frozen_string_literal: true
module BraintreeExceptions
UNAVAILABLE = [Braintree::ServiceUnavailableError, Braintree::SSLCertificateError,
Braintree::ServerError, Braintree::UnexpectedError, *INTERNET_EXCEPTIONS].freeze
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/sales_tax/sales_tax_calculation.rb | app/business/sales_tax/sales_tax_calculation.rb | # frozen_string_literal: true
class SalesTaxCalculation
attr_reader :price_cents, :tax_cents, :zip_tax_rate, :business_vat_status, :used_taxjar, :gumroad_is_mpf, :taxjar_info, :is_quebec
def initialize(price_cents:, tax_cents:, zip_tax_rate:, business_vat_status: nil, used_taxjar: false, gumroad_is_mpf: false, ta... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/sales_tax/sales_tax_calculator.rb | app/business/sales_tax/sales_tax_calculator.rb | # frozen_string_literal: true
require_relative "../../../lib/utilities/geo_ip"
class SalesTaxCalculator
attr_accessor :tax_rate, :product, :price_cents, :shipping_cents, :quantity, :buyer_location, :buyer_vat_id, :state, :is_us_taxable_state, :is_ca_taxable, :is_quebec
def initialize(product:, price_cents:, ship... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/sales_tax/errors/sales_tax_calculator_validation_error.rb | app/business/sales_tax/errors/sales_tax_calculator_validation_error.rb | # frozen_string_literal: true
class SalesTaxCalculatorValidationError < GumroadRuntimeError
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/sales_tax/taxjar/taxjar_errors.rb | app/business/sales_tax/taxjar/taxjar_errors.rb | # frozen_string_literal: true
module TaxjarErrors
CLIENT = [Taxjar::Error::BadRequest, Taxjar::Error::Unauthorized,
Taxjar::Error::Forbidden, Taxjar::Error::NotFound,
Taxjar::Error::MethodNotAllowed, Taxjar::Error::NotAcceptable,
Taxjar::Error::Gone, Taxjar::Error::UnprocessableEn... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/sales_tax/taxjar/taxjar_api.rb | app/business/sales_tax/taxjar/taxjar_api.rb | # frozen_string_literal: true
class TaxjarApi
def initialize
@client = Taxjar::Client.new(api_key: TAXJAR_API_KEY, headers: { "x-api-version" => "2022-01-24" }, api_url: TAXJAR_ENDPOINT)
@cache = Redis::Namespace.new(:taxjar_calculations, redis: $redis)
end
# Returns nil if there's an error calling TaxJ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/card_data_handling/card_data_handling_error.rb | app/business/card_data_handling/card_data_handling_error.rb | # frozen_string_literal: true
# CardDataHandlingError is an error from the front-end when the card data was being handled and failed for some reason.
class CardDataHandlingError
attr_reader :card_error_code, :error_message
# Public: Initialize the error with an error message and card error code. If the card error... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/card_data_handling/card_data_handling_mode.rb | app/business/card_data_handling/card_data_handling_mode.rb | # frozen_string_literal: true
module CardDataHandlingMode
TOKENIZE_VIA_STRIPEJS = "stripejs.0"
VALID_MODES = {
TOKENIZE_VIA_STRIPEJS => StripeChargeProcessor.charge_processor_id
}.freeze
module_function
def is_valid(card_data_handling_mode)
return false if card_data_handling_mode.nil?
card_dat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/activate_integrations_worker.rb | app/sidekiq/activate_integrations_worker.rb | # frozen_string_literal: true
class ActivateIntegrationsWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(purchase_id)
purchase = Purchase.find(purchase_id)
Integrations::CircleIntegrationService.new.activate(purchase)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/subtitle_file_size_worker.rb | app/sidekiq/subtitle_file_size_worker.rb | # frozen_string_literal: true
class SubtitleFileSizeWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(subtitle_file_id)
file = SubtitleFile.find_by(id: subtitle_file_id)
return if file.nil?
file.calculate_size
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/handle_helper_event_worker.rb | app/sidekiq/handle_helper_event_worker.rb | # frozen_string_literal: true
class HandleHelperEventWorker
include Sidekiq::Job
sidekiq_options retry: 3, queue: :default
RECENT_PURCHASE_PERIOD = 1.year
HELPER_EVENTS = %w[conversation.created]
def perform(event, payload)
return unless event.in?(HELPER_EVENTS)
conversation_id = payload["convers... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/charge_preorder_worker.rb | app/sidekiq/charge_preorder_worker.rb | # frozen_string_literal: true
class ChargePreorderWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
MAX_ATTEMPTS = 4
TIME_BETWEEN_RETRIES = 6.hours
PREORDER_AUTO_CANCEL_WAIT_TIME = 2.weeks
def perform(preorder_id, attempts = 1)
Rails.logger.info "ChargePreorder: attempting to char... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/rename_product_file_worker.rb | app/sidekiq/rename_product_file_worker.rb | # frozen_string_literal: true
class RenameProductFileWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(product_file_id)
file = ProductFile.find_by(id: product_file_id)
return if file.nil? || file.deleted_from_cdn?
file.rename_in_storage
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/fight_disputes_job.rb | app/sidekiq/fight_disputes_job.rb | # frozen_string_literal: true
class FightDisputesJob
include Sidekiq::Job
sidekiq_options retry: 3, queue: :default, lock: :until_executed
def perform
DisputeEvidence.not_resolved.find_each do |dispute_evidence|
next if dispute_evidence.hours_left_to_submit_evidence.positive?
FightDisputeJob.per... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/schedule_workflow_emails_worker.rb | app/sidekiq/schedule_workflow_emails_worker.rb | # frozen_string_literal: true
class ScheduleWorkflowEmailsWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(purchase_id)
purchase = Purchase.find(purchase_id)
purchase.schedule_all_workflows
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/remove_deleted_files_from_s3_job.rb | app/sidekiq/remove_deleted_files_from_s3_job.rb | # frozen_string_literal: true
class RemoveDeletedFilesFromS3Job
include Sidekiq::Job
sidekiq_options retry: 1, queue: :low
# There is no need to try to remove S3 objects from records that were marked as deleted years ago, and whose removal failed:
# those will need to be dealt with manually.
# Because this ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/low_balance_fraud_check_worker.rb | app/sidekiq/low_balance_fraud_check_worker.rb | # frozen_string_literal: true
class LowBalanceFraudCheckWorker
include Sidekiq::Job
sidekiq_options retry: 2, queue: :default
def perform(purchase_id)
creator = Purchase.find(purchase_id).seller
creator.check_for_low_balance_and_probate(purchase_id)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/free_trial_expiring_reminder_worker.rb | app/sidekiq/free_trial_expiring_reminder_worker.rb | # frozen_string_literal: true
class FreeTrialExpiringReminderWorker
include Sidekiq::Job
sidekiq_options retry: 3, queue: :default
def perform(subscription_id)
subscription = Subscription.find(subscription_id)
return unless subscription.alive?(include_pending_cancellation: false) &&
su... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/save_to_mongo_worker.rb | app/sidekiq/save_to_mongo_worker.rb | # frozen_string_literal: true
class SaveToMongoWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :mongo
def perform(collection, doc)
Mongoer.safe_write(collection, doc)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/delete_product_files_worker.rb | app/sidekiq/delete_product_files_worker.rb | # frozen_string_literal: true
class DeleteProductFilesWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(product_id)
product = Link.find(product_id)
return unless product.deleted? # user undid product deletion
return if product.has_successful_sales?
product.produc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/generate_canada_sales_report_job.rb | app/sidekiq/generate_canada_sales_report_job.rb | # frozen_string_literal: true
class GenerateCanadaSalesReportJob
include Sidekiq::Job
def perform(month, year)
raise ArgumentError, "Invalid month" unless month.in?(1..12)
raise ArgumentError, "Invalid year" unless year.in?(2014..3200)
begin
temp_file = Tempfile.new
temp_file.write(row_he... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/recurring_charge_worker.rb | app/sidekiq/recurring_charge_worker.rb | # frozen_string_literal: true
class RecurringChargeWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default, lock: :until_executed
def perform(subscription_id, ignore_consecutive_failures = false, _deprecated = nil)
ActiveRecord::Base.connection.stick_to_primary!
SuoSemaphore.recurring_char... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/find_expired_subscriptions_to_set_as_deactivated_worker.rb | app/sidekiq/find_expired_subscriptions_to_set_as_deactivated_worker.rb | # frozen_string_literal: true
class FindExpiredSubscriptionsToSetAsDeactivatedWorker
include Sidekiq::Job
sidekiq_options retry: 0, queue: :default
def perform
now = Time.current
relations = [
Subscription.where("cancelled_at < ? and deactivated_at is null", now).not_is_test_subscription.select(:i... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/send_payment_reminder_worker.rb | app/sidekiq/send_payment_reminder_worker.rb | # frozen_string_literal: true
class SendPaymentReminderWorker
include Sidekiq::Job
sidekiq_options retry: 1, queue: :default
def perform
User.payment_reminder_risk_state.announcement_notification_enabled
.where(payment_address: nil).holding_balance_more_than(1000)
.find_each do |user|
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/delete_old_unused_events_worker.rb | app/sidekiq/delete_old_unused_events_worker.rb | # frozen_string_literal: true
class DeleteOldUnusedEventsWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :low
DELETION_BATCH_SIZE = 100
# Deletes non-permitted events within the default time window of:
# (2 months and 2 days ago) .. (2 months ago)
#
# Params:
# - `to` allows us to keep t... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/log_resend_event_job.rb | app/sidekiq/log_resend_event_job.rb | # frozen_string_literal: true
class LogResendEventJob
include Sidekiq::Job
sidekiq_options retry: 5, queue: :mongo
def perform(event_json)
resend_event_info = ResendEventInfo.new(event_json)
return if resend_event_info.invalid?
return unless resend_event_info.type.in?([ResendEventInfo::EVENT_OPENED,... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/recalculate_recent_wishlist_follower_count_job.rb | app/sidekiq/recalculate_recent_wishlist_follower_count_job.rb | # frozen_string_literal: true
class RecalculateRecentWishlistFollowerCountJob
include Sidekiq::Job
def perform
Wishlist.find_in_batches do |batch|
follower_counts = WishlistFollower.alive
.where(wishlist_id: batch.map(&:id))
.where("created_at > ?", 30.days.ago)
.group(:wishlist_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/generate_financial_reports_for_previous_quarter_job.rb | app/sidekiq/generate_financial_reports_for_previous_quarter_job.rb | # frozen_string_literal: true
class GenerateFinancialReportsForPreviousQuarterJob
include Sidekiq::Job
sidekiq_options retry: 1, queue: :default, lock: :until_executed, on_conflict: :replace
def perform
return unless Rails.env.production?
quarter_start_date = Date.current.prev_quarter.beginning_of_quar... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/generate_username_job.rb | app/sidekiq/generate_username_job.rb | # frozen_string_literal: true
class GenerateUsernameJob
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(user_id)
user = User.find(user_id)
return if user.read_attribute(:username).present?
username = UsernameGeneratorService.new(user).username
return if username.nil?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/transfer_dropbox_file_to_s3_worker.rb | app/sidekiq/transfer_dropbox_file_to_s3_worker.rb | # frozen_string_literal: true
class TransferDropboxFileToS3Worker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(dropbox_file_id)
dropbox_file = DropboxFile.find(dropbox_file_id)
dropbox_file.transfer_to_s3
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/handle_grmc_callback_job.rb | app/sidekiq/handle_grmc_callback_job.rb | # frozen_string_literal: true
class HandleGrmcCallbackJob
include Sidekiq::Job
sidekiq_options retry: 2, queue: :default
def perform(notification)
ActiveRecord::Base.connection.stick_to_primary!
transcoded_video_from_job = TranscodedVideo.processing.find_by(job_id: notification["job_id"])
return if... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/publish_scheduled_post_job.rb | app/sidekiq/publish_scheduled_post_job.rb | # frozen_string_literal: true
class PublishScheduledPostJob
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(post_id, version)
post = Installment.find(post_id)
post.with_lock do
return unless post.alive? # post may have been deleted
return if post.published? # no n... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/delete_product_files_archives_worker.rb | app/sidekiq/delete_product_files_archives_worker.rb | # frozen_string_literal: true
class DeleteProductFilesArchivesWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(product_id = nil, variant_id = nil)
return if product_id.nil? && variant_id.nil?
variant = BaseVariant.find(variant_id) if variant_id.present?
product = pr... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/score_product_worker.rb | app/sidekiq/score_product_worker.rb | # frozen_string_literal: true
class ScoreProductWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :low
def perform(product_id)
return unless Rails.env.production?
sqs = Aws::SQS::Client.new
queue_url = sqs.get_queue_url(queue_name: "risk_queue").queue_url
sqs.send_message(queue_url:, ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/expiring_credit_card_message_worker.rb | app/sidekiq/expiring_credit_card_message_worker.rb | # frozen_string_literal: true
class ExpiringCreditCardMessageWorker
include Sidekiq::Job
sidekiq_options retry: 1, queue: :default
# Selects all the credit cards that expire next month and notifies the customers to update them.
# There are 2 types of emails that we send to users:
# - emails that specify the... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/send_purchase_receipt_job.rb | app/sidekiq/send_purchase_receipt_job.rb | # frozen_string_literal: true
# Generates custom PDFs and sends a receipt
# We want to make sure the receipt is sent after all the PDFs have been stamped
# Exception: a receipt is not sent for bundle product pruchases, as they are dummy purchases
# If there are PDFs that need to be stamped, the caller must enqueue thi... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/renew_custom_domain_ssl_certificates.rb | app/sidekiq/renew_custom_domain_ssl_certificates.rb | # frozen_string_literal: true
class RenewCustomDomainSslCertificates
include Sidekiq::Job
sidekiq_options retry: 0, queue: :low
def perform
if SslCertificates::Renew.supported_environment?
SslCertificates::Renew.new.process
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/update_sales_related_products_infos_job.rb | app/sidekiq/update_sales_related_products_infos_job.rb | # frozen_string_literal: true
class UpdateSalesRelatedProductsInfosJob
include Sidekiq::Job
sidekiq_options retry: 3, queue: :low
def perform(purchase_id, increment = true)
return if Feature.inactive?(:update_sales_related_products_infos)
purchase = Purchase.find(purchase_id)
product_id = purchase... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/update_taxonomy_stats_job.rb | app/sidekiq/update_taxonomy_stats_job.rb | # frozen_string_literal: true
class UpdateTaxonomyStatsJob
include Sidekiq::Job
sidekiq_options retry: 3, queue: :low
def perform
taxonomies = Taxonomy.roots
taxonomies.each do |taxonomy|
descendant_ids = taxonomy.descendant_ids
stat = TaxonomyStat.find_or_create_by!(taxonomy:)
shared... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/delete_product_rich_content_worker.rb | app/sidekiq/delete_product_rich_content_worker.rb | # frozen_string_literal: true
class DeleteProductRichContentWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(product_id, variant_id = nil)
product = Link.find(product_id)
if variant_id.present?
variant = BaseVariant.find(variant_id)
delete_rich_content(produ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/find_subscriptions_with_missing_charge_worker.rb | app/sidekiq/find_subscriptions_with_missing_charge_worker.rb | # frozen_string_literal: true
class FindSubscriptionsWithMissingChargeWorker
include Sidekiq::Job
sidekiq_options retry: 0, queue: :low
BATCHES_SCHEDULE_MARGIN_IN_MINUTES = 20
def perform(batch_number = nil)
if batch_number.nil?
10.times { |i| self.class.perform_in(i * BATCHES_SCHEDULE_MARGIN_IN_MIN... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/send_last_post_job.rb | app/sidekiq/send_last_post_job.rb | # frozen_string_literal: true
class SendLastPostJob
include Sidekiq::Job
sidekiq_options retry: 5, queue: :low
def perform(purchase_id)
purchase = Purchase.find(purchase_id)
subscription = purchase.subscription
posts = Installment.emailable_posts_for_purchase(purchase:).order(published_at: :desc)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/deactivate_integrations_worker.rb | app/sidekiq/deactivate_integrations_worker.rb | # frozen_string_literal: true
class DeactivateIntegrationsWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(purchase_id)
purchase = Purchase.find(purchase_id)
purchases_to_process(purchase).each { deactivate_integrations(_1) }
end
private
def purchases_to_proces... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/annual_tax_summary_export_worker.rb | app/sidekiq/annual_tax_summary_export_worker.rb | # frozen_string_literal: true
class AnnualTaxSummaryExportWorker
include Sidekiq::Job
sidekiq_options queue: :low
def perform(year, start = nil, finish = nil)
csv_url = nil
WithMaxExecutionTime.timeout_queries(seconds: 4.hour) do
csv_url = Exports::TaxSummary::Annual.new(year:, start:, finish:).p... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/seller_update_worker.rb | app/sidekiq/seller_update_worker.rb | # frozen_string_literal: true
class SellerUpdateWorker
include Sidekiq::Job
sidekiq_options retry: 0, queue: :default
def perform(user_id)
user = User.find(user_id)
ContactingCreatorMailer.seller_update(user.id).deliver_later(queue: "critical") if user.form_email && user.announcement_notification_enable... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/update_seller_refund_eligibility_job.rb | app/sidekiq/update_seller_refund_eligibility_job.rb | # frozen_string_literal: true
class UpdateSellerRefundEligibilityJob
include Sidekiq::Job
sidekiq_options retry: 2, queue: :default
def perform(user_id)
user = User.find(user_id)
unpaid_balance_cents = user.unpaid_balance_cents
if unpaid_balance_cents > 0 && user.refunds_disabled?
user.enable... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/update_purchase_email_to_match_account_worker.rb | app/sidekiq/update_purchase_email_to_match_account_worker.rb | # frozen_string_literal: true
class UpdatePurchaseEmailToMatchAccountWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(user_id)
user = User.find(user_id)
user.purchases.find_each do |purchase|
purchase.update!(email: user.email)
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/utm_link_sale_attribution_job.rb | app/sidekiq/utm_link_sale_attribution_job.rb | # frozen_string_literal: true
class UtmLinkSaleAttributionJob
include Sidekiq::Job
ATTRIBUTION_WINDOW = 7.days
sidekiq_options queue: :low, lock: :until_executed, retry: 3
def perform(order_id, browser_guid)
purchases_by_seller = Order.find(order_id).purchases.successful.group_by(&:seller_id)
# Fet... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/update_large_sellers_sales_count_job.rb | app/sidekiq/update_large_sellers_sales_count_job.rb | # frozen_string_literal: true
class UpdateLargeSellersSalesCountJob
include Sidekiq::Job
sidekiq_options retry: 1, queue: :low
def perform
LargeSeller.find_each(batch_size: 100) do |large_seller|
next unless large_seller.user
current_sales_count = large_seller.user.sales.count
if current... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/generate_fees_by_creator_location_report_job.rb | app/sidekiq/generate_fees_by_creator_location_report_job.rb | # frozen_string_literal: true
class GenerateFeesByCreatorLocationReportJob
include Sidekiq::Job
sidekiq_options retry: 1, queue: :default, lock: :until_executed
def perform(month, year)
raise ArgumentError, "Invalid month" unless month.in?(1..12)
raise ArgumentError, "Invalid year" unless year.in?(2014.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/send_rental_expires_soon_email_worker.rb | app/sidekiq/send_rental_expires_soon_email_worker.rb | # frozen_string_literal: true
class SendRentalExpiresSoonEmailWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(purchase_id, time_till_rental_expiration_in_seconds)
purchase = Purchase.find(purchase_id)
url_redirect = purchase.url_redirect
return if !url_redirect.is_r... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/charge_declined_reminder_worker.rb | app/sidekiq/charge_declined_reminder_worker.rb | # frozen_string_literal: true
class ChargeDeclinedReminderWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(subscription_id)
subscription = Subscription.find(subscription_id)
return if !subscription.alive?(include_pending_cancellation: false) ||
subscription... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/recover_aus_backtaxes_from_stripe_accounts_job.rb | app/sidekiq/recover_aus_backtaxes_from_stripe_accounts_job.rb | # frozen_string_literal: true
class RecoverAusBacktaxesFromStripeAccountsJob
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform
BacktaxAgreement
.not_collected
.where(jurisdiction: BacktaxAgreement::Jurisdictions::AUSTRALIA)
.pluck(:user_id)
.uniq
.each ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/delete_wishlist_products_job.rb | app/sidekiq/delete_wishlist_products_job.rb | # frozen_string_literal: true
class DeleteWishlistProductsJob
include Sidekiq::Job
sidekiq_options queue: :low
def perform(product_id)
product = Link.find(product_id)
return unless product.deleted? # user undid product deletion
product.wishlist_products.alive.find_each(&:mark_deleted!)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/custom_domains_verification_worker.rb | app/sidekiq/custom_domains_verification_worker.rb | # frozen_string_literal: true
class CustomDomainsVerificationWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :low
MAX_DURATION_TO_VERIFY_ALL_DOMAINS = 1.hour
def perform
CustomDomain.alive.find_each.with_index do |custom_domain, index|
next if custom_domain.exceeding_max_failed_verific... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/process_purchase_early_fraud_warning_job.rb | app/sidekiq/process_purchase_early_fraud_warning_job.rb | # frozen_string_literal: true
# Before removing this file, make sure there are no more enqueued jobs in production using the class name
ProcessPurchaseEarlyFraudWarningJob = ProcessEarlyFraudWarningJob
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/stripe_transfer_gumroads_available_balances_to_gumroads_bank_account_worker.rb | app/sidekiq/stripe_transfer_gumroads_available_balances_to_gumroads_bank_account_worker.rb | # frozen_string_literal: true
class StripeTransferGumroadsAvailableBalancesToGumroadsBankAccountWorker
include Sidekiq::Job
sidekiq_options retry: 0, queue: :default
BALANCE_BUFFER_CENTS = 1_000_000_00
private_constant :BALANCE_BUFFER_CENTS
def perform
return unless Rails.env.production? || Rails.env.s... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/send_reminders_for_outstanding_user_compliance_info_requests_worker.rb | app/sidekiq/send_reminders_for_outstanding_user_compliance_info_requests_worker.rb | # frozen_string_literal: true
class SendRemindersForOutstandingUserComplianceInfoRequestsWorker
include Sidekiq::Job
sidekiq_options retry: 0, queue: :default
TIME_UNTIL_REQUEST_NEEDS_REMINDER = 2.days
MAX_NUMBER_OF_REMINDERS = 2
private_constant :MAX_NUMBER_OF_REMINDERS, :TIME_UNTIL_REQUEST_NEEDS_REMINDER... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/delete_stripe_apple_pay_domain_worker.rb | app/sidekiq/delete_stripe_apple_pay_domain_worker.rb | # frozen_string_literal: true
class DeleteStripeApplePayDomainWorker
include Sidekiq::Job
sidekiq_options retry: 3, queue: :low
def perform(user_id, domain)
record = StripeApplePayDomain.find_by(user_id:, domain:)
return unless record
response = Stripe::ApplePayDomain.delete(record.stripe_id)
re... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/refund_purchase_worker.rb | app/sidekiq/refund_purchase_worker.rb | # frozen_string_literal: true
class RefundPurchaseWorker
include Sidekiq::Job
sidekiq_options retry: 5, queue: :default
def perform(purchase_id, admin_user_id, reason = nil)
purchase = Purchase.find(purchase_id)
if reason == Refund::FRAUD
purchase.refund_for_fraud_and_block_buyer!(admin_user_id)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/sidekiq/update_user_balance_stats_cache_worker.rb | app/sidekiq/update_user_balance_stats_cache_worker.rb | # frozen_string_literal: true
class UpdateUserBalanceStatsCacheWorker
include Sidekiq::Job
sidekiq_options retry: 1, queue: :low, lock: :until_executed
def perform(user_id)
user = User.find(user_id)
WithMaxExecutionTime.timeout_queries(seconds: 1.hour) do
UserBalanceStatsService.new(user:).write_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.