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/modules/immutable.rb
app/modules/immutable.rb
# frozen_string_literal: true # An immutable ActiveRecord. # Any model this module is included into will be immutable, except for # any fields specified using `attr_mutable`. # # If you need to change an Immutable you should call `dup_and_save` or `dup_and_save!`. module Immutable extend ActiveSupport::Concern in...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/s3_retrievable.rb
app/modules/s3_retrievable.rb
# frozen_string_literal: true module S3Retrievable extend ActiveSupport::Concern GUID_LENGTH = 32 # Use the guid if it can be found, otherwise use self.url # Assumes guid is a 32-character alphanumeric sequence preceding "/original/" in the url def unique_url_identifier identifier = s3_url.split("/orig...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/base_price/recurrence.rb
app/modules/base_price/recurrence.rb
# frozen_string_literal: true module BasePrice::Recurrence MONTHLY = "monthly" QUARTERLY = "quarterly" BIANNUALLY = "biannually" YEARLY = "yearly" EVERY_TWO_YEARS = "every_two_years" DEFAULT_TIERED_MEMBERSHIP_RECURRENCE = MONTHLY ALLOWED_RECURRENCES = [ MONTHLY, QUARTERLY, BIANNUALLY, Y...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/base_price/shared.rb
app/modules/base_price/shared.rb
# frozen_string_literal: true module BasePrice::Shared def clean_price(price_string) clean = price_string.to_s unless single_unit_currency? clean = clean.gsub(/[^-0-9.,]/, "") # allow commas for now if clean.rindex(/,/) == clean.length - 3 # euro style! clean = clean.delete(".") # re...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/colombia_bank_account/account_type.rb
app/modules/colombia_bank_account/account_type.rb
# frozen_string_literal: true module ColombiaBankAccount::AccountType CHECKING = "checking" SAVINGS = "savings" def self.all [ CHECKING, SAVINGS ] end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/review_stat.rb
app/modules/product/review_stat.rb
# frozen_string_literal: true module Product::ReviewStat delegate :average_rating, :rating_counts, :reviews_count, :rating_percentages, to: :review_stat_proxy def rating_stats { count: reviews_count, average: average_rating, percentages: rating_percentages.values, } end def update_r...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/prices.rb
app/modules/product/prices.rb
# frozen_string_literal: true module Product::Prices include BasePrice::Shared # Public: Alias for default_price_cents in order to hide the price_cents column, which isn't used anymore in favor of the Price model. def price_cents default_price_cents end # Public: Returns a single price for the product ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/creation_limit.rb
app/modules/product/creation_limit.rb
# frozen_string_literal: true module Product::CreationLimit extend ActiveSupport::Concern included do validate :validate_daily_product_creation_limit, on: :create end class_methods do def bypass_product_creation_limit previous = product_creation_limit_bypassed? self.product_creation_limit...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/shipping.rb
app/modules/product/shipping.rb
# frozen_string_literal: true module Product::Shipping # constant referring to all other countries ELSEWHERE = "ELSEWHERE" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/searchable.rb
app/modules/product/searchable.rb
# frozen_string_literal: true module Product::Searchable extend ActiveSupport::Concern # we want to show 9 tags, but this is used as an array indexing which starts at 0 MAX_NUMBER_OF_TAGS = 8 RECOMMENDED_PRODUCTS_PER_PAGE = 9 MAX_NUMBER_OF_FILETYPES = 8 MAX_OFFER_CODES_IN_INDEX = 300 ATTRIBUTE_TO_SEARC...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/utils.rb
app/modules/product/utils.rb
# frozen_string_literal: true module Product::Utils extend ActiveSupport::Concern class_methods do # Helper for when debugging in console. # # Fetches a product uniquely identified by `id_or_permalink` (ID, unique or custom permalink) # and optionally scoped by `user_id` if more than one product c...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/preview.rb
app/modules/product/preview.rb
# frozen_string_literal: true module Product::Preview extend ActiveSupport::Concern MAX_PREVIEW_COUNT = 8 # If the preview height is not defined or too small we will default to this value, this makes sure we display a large enough preview # image in the users library DEFAULT_MOBILE_PREVIEW_HEIGHT = 204 ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/stats.rb
app/modules/product/stats.rb
# frozen_string_literal: true module Product::Stats extend ActiveSupport::Concern class_methods do # Essentially returns a sum of "active customers" (for each product) # because we're considering each subscription as one sale, # and excluding deactivated subscription. def successful_sales_count(pr...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/validations.rb
app/modules/product/validations.rb
# frozen_string_literal: true module Product::Validations include ActionView::Helpers::TextHelper MAX_VIEW_CONTENT_BUTTON_TEXT_LENGTH = 26 MAX_CUSTOM_RECEIPT_TEXT_LENGTH = 500 private def max_purchase_count_is_greater_than_or_equal_to_inventory_sold return unless max_purchase_count_changed? r...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/recommendations.rb
app/modules/product/recommendations.rb
# frozen_string_literal: true module Product::Recommendations def recommendable? recommendable_reasons.values.all? end alias_method :recommendable, :recommendable? # All of the factors(values/records/etc.) which influence the return value of this method should be watched. # Whenever any of those factors...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/product/caching.rb
app/modules/product/caching.rb
# frozen_string_literal: true module Product::Caching def scoped_cache_key(locale, fragmented = false, displayed_switch_ids = [], prefetched_cache_key_prefix = nil, request_host = nil) displayed_switch_ids = displayed_switch_ids.sort displayed_switch_ids = displayed_switch_ids.join("_") prefix = prefetch...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/australian_backtaxes.rb
app/modules/user/australian_backtaxes.rb
# frozen_string_literal: true ## # A collection of methods to help with backtax calculations ## class User module AustralianBacktaxes def opted_in_to_australia_backtaxes? australia_backtax_agreement.present? end def au_backtax_agreement_date australia_backtax_agreement&.created_at end ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/posts.rb
app/modules/user/posts.rb
# frozen_string_literal: true module User::Posts def visible_posts_for(pundit_user:, shown_on_profile: true) # The condition below doesn't take into consideration logged-in user's role for logged-in seller # This is a non-issue at this moment as all roles have "read" access to posts. # To have a more gra...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/social_twitter.rb
app/modules/user/social_twitter.rb
# frozen_string_literal: true module User::SocialTwitter TWITTER_PROPERTIES = %w[twitter_user_id twitter_handle twitter_oauth_token twitter_oauth_secret].freeze def self.included(base) base.extend(TwitterClassMethods) end def twitter_picture_url twitter_user = $twitter.user(twitter_user_id.to_i) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/social_facebook.rb
app/modules/user/social_facebook.rb
# frozen_string_literal: true module User::SocialFacebook def self.included(base) base.extend(FacebookClassMethods) end def renew_facebook_access_token oauth = Koala::Facebook::OAuth.new(FACEBOOK_APP_ID, FACEBOOK_APP_SECRET) new_token = oauth.exchange_access_token(facebook_access_token) self.fac...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/stats.rb
app/modules/user/stats.rb
# frozen_string_literal: true # Mixin contains stats helpers for use on Users. # # See the User::PaymentStats module for internal stats that are not displayed to the Seller. module User::Stats include CurrencyHelper extend ActiveSupport::Concern included do attr_accessor :sales_total scope :by_sales_re...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/risk.rb
app/modules/user/risk.rb
# frozen_string_literal: true module User::Risk extend ActiveSupport::Concern IFFY_ENDPOINT = "http://internal-production-iffy-live-internal-1668548970.us-east-1.elb.amazonaws.com" PAYMENT_REMINDER_RISK_STATES = %w[flagged_for_tos_violation not_reviewed compliant].freeze INCREMENTAL_ENQUEUE_BALANCE = 100_00 ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/validations.rb
app/modules/user/validations.rb
# frozen_string_literal: true module User::Validations ALLOWED_AVATAR_EXTENSIONS = ["png", "jpg", "jpeg"] MINIMUM_AVATAR_DIMENSION = 200 MAXIMUM_AVATAR_FILE_SIZE = 10.megabytes GA_REGEX = %r{G-[a-zA-Z0-9]+} # Regex for Google Analytics 4 Measurement ID. private def google_analytics_id_valid return...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/payment_stats.rb
app/modules/user/payment_stats.rb
# frozen_string_literal: true # Mixin contains stats helpers for use on Users, relevant to the internal payments team at Gumroad. # The numbers in this stats module should unlikely be displayed to the Creator. For example, most # stats within relate to transaction total values and not the values received or earned by ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/recommendations.rb
app/modules/user/recommendations.rb
# frozen_string_literal: true module User::Recommendations def recommendable? recommendable_reasons.values.all? end # All of the factors(values/records/etc.) which influence the return value of this method should be watched. # Whenever any of those factors change, a `SendToElasticsearchWorker` job must be...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/compliance.rb
app/modules/user/compliance.rb
# frozen_string_literal: true module User::Compliance # https://stripe.com/global lists all countries supported by Stripe. # https://stripe.com/connect/pricing lists default currencies for the supported countries. # This list contains supported countries which have euros listed as default currency. EUROPEAN_CO...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/feature_status.rb
app/modules/user/feature_status.rb
# frozen_string_literal: true ## # A collections of methods that determines user's status with certain features. ## class User module FeatureStatus def merchant_migration_enabled? check_merchant_account_is_linked || (Feature.active?(:merchant_migration, self) && StripeMerchantAccountManager::COU...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/money_balance.rb
app/modules/user/money_balance.rb
# frozen_string_literal: true class User module MoneyBalance def unpaid_balance_cents(via: :sql) if via == :elasticsearch begin Balance.amount_cents_sum_for(self) rescue => e Bugsnag.notify(e) unpaid_balance_cents(via: :sql) end else balan...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/payout_info.rb
app/modules/user/payout_info.rb
# frozen_string_literal: true module User::PayoutInfo include CurrencyHelper def payout_info @payout_info ||= { active_bank_account: active_bank_account&.as_json(only: %i[type account_holder_full_name], methods: %i[formatted_account]), payment_address:, payouts_paused_by_source:, payou...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/tier.rb
app/modules/user/tier.rb
# frozen_string_literal: true module User::Tier # Earning tiers TIER_0 = 0 TIER_1 = 1_000 TIER_2 = 10_000 TIER_3 = 100_000 TIER_4 = 1_000_000 TIER_RANGES = { 0...1_000_00 => TIER_0, 1_000_00...10_000_00 => TIER_1, 10_000_00...100_000_00 => TIER_2, 100_000_00...1_000_000_00 => TIER_3, ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/payout_schedule.rb
app/modules/user/payout_schedule.rb
# frozen_string_literal: true module User::PayoutSchedule PAYOUT_STARTING_DATE = Date.new(2012, 12, 21) PAYOUT_RECURRENCE_DAYS = 7 PAYOUT_DELAY_DAYS = 7 WEEKLY = "weekly" MONTHLY = "monthly" QUARTERLY = "quarterly" DAILY = "daily" include CurrencyHelper def next_payout_date return nil if unpai...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/ping_notification.rb
app/modules/user/ping_notification.rb
# frozen_string_literal: true module User::PingNotification def send_test_ping(url) latest_sale = sales.last return nil if latest_sale.blank? URI.parse(url) # TestPingsController.create catches URI::InvalidURIError ping_params = latest_sale.payload_for_ping_notification.merge(test: true) ping_p...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/async_devise_notification.rb
app/modules/user/async_devise_notification.rb
# frozen_string_literal: true # This module is responsible for sending Devise email notifications via ActiveJob. # See https://github.com/heartcombo/devise/blob/098345aace53d4ddf88e04f1eb2680e2676e8c28/lib/devise/models/authenticatable.rb#L133-L194. module User::AsyncDeviseNotification extend ActiveSupport::Concern...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user/devise_internal.rb
app/modules/user/devise_internal.rb
# frozen_string_literal: true ## # A collection of methods used internally in devise gem. ## class User module DeviseInternal def active_for_authentication? true end def confirmation_required? email_required? && !confirmed? && email.present? end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/follower/from.rb
app/modules/follower/from.rb
# frozen_string_literal: true module Follower::From FOLLOW_PAGE = "follow_page" PROFILE_PAGE = "profile_page" CSV_IMPORT = "csv_import" EMBED_FORM = "embed_form" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/ach_account/account_type.rb
app/modules/ach_account/account_type.rb
# frozen_string_literal: true module AchAccount::AccountType CHECKING = "checking" SAVINGS = "savings" def self.all [ CHECKING, SAVINGS ] end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/recurring_service/tiers.rb
app/modules/recurring_service/tiers.rb
# frozen_string_literal: true module RecurringService::Tiers include ActionView::Helpers::NumberHelper def monthly_tier_amount(customer_count) case customer_count when 0..999 10 when 1000..1999 25 when 2000..4999 50 when 5000..9999 75 when 10_000..14_999 100 ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/recurring_service/recurrence.rb
app/modules/recurring_service/recurrence.rb
# frozen_string_literal: true module RecurringService::Recurrence def recurrence_indicator { monthly: " a month", yearly: " a year" }[recurrence.to_sym] end def recurrence_duration { monthly: 1.month, yearly: 1.year }[recurrence.to_sym] end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/media_location/unit.rb
app/modules/media_location/unit.rb
# frozen_string_literal: true module MediaLocation::Unit PAGE_NUMBER = "page_number" SECONDS = "seconds" PERCENTAGE = "percentage" def self.all [ PAGE_NUMBER, SECONDS, PERCENTAGE ] end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/shipping_destination/destinations.rb
app/modules/shipping_destination/destinations.rb
# frozen_string_literal: true module ShippingDestination::Destinations # constant referring to all other countries ELSEWHERE = "ELSEWHERE" # constants for virtual countries EUROPE = "EUROPE" ASIA = "ASIA" NORTH_AMERICA = "NORTH AMERICA" VIRTUAL_COUNTRY_CODES = [EUROPE, ASIA, NORTH_AMERICA].freeze def ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/subscription/ping_notification.rb
app/modules/subscription/ping_notification.rb
# frozen_string_literal: true module Subscription::PingNotification def payload_for_ping_notification(resource_name: nil, additional_params: {}) payload = { subscription_id: external_id, product_id: link.external_id, product_name: link.name, user_id: user.try(:external_id), user_ema...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/payment/stats.rb
app/modules/payment/stats.rb
# frozen_string_literal: true module Payment::Stats def revenue_by_link # First calculate the revenue per product (i.e. purchase price - affiliate commission - fee) # based on all the sales in this payout period # including refunded and charged-back sales. revenue_by_link = successful_sale_amounts ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/targeting.rb
app/modules/purchase/targeting.rb
# frozen_string_literal: true module Purchase::Targeting extend ActiveSupport::Concern included do scope :by_variant, lambda { |variant_id| if variant_id.present? joins("INNER JOIN base_variants_purchases ON base_variants_purchases.purchase_id = purchases.id") .where("base_variants_pur...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/risk.rb
app/modules/purchase/risk.rb
# frozen_string_literal: true module Purchase::Risk IP_PROXY_THRESHOLD = 2 CHECK_FOR_FRAUD_TIMEOUT_SECONDS = 4 def check_for_fraud Timeout.timeout(CHECK_FOR_FRAUD_TIMEOUT_SECONDS) do check_for_past_blocked_email_domains return if errors.present? check_for_past_blocked_guids return i...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/card_country_source.rb
app/modules/purchase/card_country_source.rb
# frozen_string_literal: true module Purchase::CardCountrySource STRIPE = "stripe" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/refundable.rb
app/modules/purchase/refundable.rb
# frozen_string_literal: true class Purchase module Refundable # * amount - the amount to refund (out of `Purchase#price_cents`, VAT-exclusive). VAT will be refunded proportinally to this amount. def refund!(refunding_user_id:, amount: nil) if amount.blank? refund_and_save!(refunding_user_id) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/reviews.rb
app/modules/purchase/reviews.rb
# frozen_string_literal: true module Purchase::Reviews extend ActiveSupport::Concern included do COUNTS_REVIEWS_STATES = %w[successful gift_receiver_purchase_successful not_charged] has_one :product_review after_save :update_product_review_stat # Important: The logic needs to be the same as the ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/ping_notification.rb
app/modules/purchase/ping_notification.rb
# frozen_string_literal: true module Purchase::PingNotification def payload_for_ping_notification(url_parameters: nil, resource_name: nil) # general_permalink was being sent as "permalink' which is wrong because it's not a full url unlike the name suggests. # Consider it deprecated; it's removed from the pin...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/completion_handler.rb
app/modules/purchase/completion_handler.rb
# frozen_string_literal: true module Purchase::CompletionHandler # Makes sure that a block of code that creates an in_progress purchase eventually transitions # that purchase to a completing state, otherwise this method marks the purchase as failed. def ensure_completion yield ensure mark_failed! if pe...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/purchase/accounting.rb
app/modules/purchase/accounting.rb
# frozen_string_literal: true ## # A collection of methods to help with accounting calculations ## class Purchase module Accounting # returns price in USD. 0.15 means 15 cents def price_dollars convert_cents_to_dollars(price_cents) end def variant_extra_cost_dollars convert_cents_to_dol...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/variant/prices.rb
app/modules/variant/prices.rb
# frozen_string_literal: true module Variant::Prices include BasePrice::Shared delegate :price_currency_type, :single_unit_currency?, :enqueue_index_update_for, to: :link def save_recurring_prices!(recurrence_price_values) ActiveRecord::Base.transaction do super(recurrence_price...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/chile_bank_account/account_type.rb
app/modules/chile_bank_account/account_type.rb
# frozen_string_literal: true module ChileBankAccount::AccountType CHECKING = "checking" SAVINGS = "savings" def self.all [ CHECKING, SAVINGS ] end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/post/caching.rb
app/modules/post/caching.rb
# frozen_string_literal: true module Post::Caching def key_for_cache(key) "#{key}_for_installment_#{id}" end def invalidate_cache(key) Rails.cache.delete(key_for_cache(key)) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/modules/user_compliance_info/business_types.rb
app/modules/user_compliance_info/business_types.rb
# frozen_string_literal: true module UserComplianceInfo::BusinessTypes LLC = "llc" PARTNERSHIP = "partnership" NON_PROFIT = "profit" REGISTERED_CHARITY = "registered_charity" SOLE_PROPRIETORSHIP = "sole_proprietorship" CORPORATION = "corporation" def self.all [ LLC, PARTNERSHIP, NO...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/currency.rb
app/business/payments/currency.rb
# frozen_string_literal: true module Currency # These currencies can be used as account's default currency and to set product prices, # along with creating Stripe Connect accounts and making payouts. CURRENCY_CHOICES.each do |currency_type, _currency_hash| const_set(currency_type.upcase, currency_type.downca...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/payouts/payouts.rb
app/business/payments/payouts/payouts.rb
# frozen_string_literal: true class Payouts extend ActionView::Helpers::NumberHelper MIN_AMOUNT_CENTS = 10_00 PAYOUT_TYPE_STANDARD = "standard" PAYOUT_TYPE_INSTANT = "instant" def self.is_user_payable(user, date, processor_type: nil, add_comment: false, from_admin: false, payout_type: Payouts::PAYOUT_TYPE_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/payouts/payout_processor_type.rb
app/business/payments/payouts/payout_processor_type.rb
# frozen_string_literal: true module PayoutProcessorType PAYPAL = "PAYPAL" ACH = "ACH" # Retired. Kept because we still have payments in the database for this processor. ZENGIN = "ZENGIN" # Retired. Kept because we still have payments in the database for this processor, and validations for them. STRIPE = "STRI...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/payouts/payout_estimates.rb
app/business/payments/payouts/payout_estimates.rb
# frozen_string_literal: true module PayoutEstimates def self.estimate_held_amount_cents(date, processor_type) payment_estimates = estimate_payments_for_balances_up_to_date_for_users(date, processor_type, User.holding_balance) holder_of_funds_amount_cents = Hash.new(0) payment_estimates.each do |payment_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/payouts/processor/stripe/stripe_payout_processor.rb
app/business/payments/payouts/processor/stripe/stripe_payout_processor.rb
# frozen_string_literal: true class StripePayoutProcessor extend CurrencyHelper DEBIT_CARD_PAYOUT_MAX = 300_000 INSTANT_PAYOUT_FEE_PERCENT = 3 MINIMUM_INSTANT_PAYOUT_AMOUNT_CENTS = 10_00 MAXIMUM_INSTANT_PAYOUT_AMOUNT_CENTS = 9_999_00 # Public: Determines if it's possible for this processor to payout # ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/payouts/processor/paypal/paypal_payout_processor.rb
app/business/payments/payouts/processor/paypal/paypal_payout_processor.rb
# frozen_string_literal: true class PaypalPayoutProcessor # We would split up the payment into chunks of at most this size, only when necessary, in order to get around the MassPay API limitations. # See perform_payment_in_split_mode. This is a hack that should be replaced with a proper split payout mechanism that ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/integrations/paypal_integration_rest_api.rb
app/business/payments/integrations/paypal_integration_rest_api.rb
# frozen_string_literal: true class PaypalIntegrationRestApi include HTTParty base_uri PAYPAL_REST_ENDPOINT attr_reader :merchant, :response, :options def initialize(merchant, options = {}) @merchant = merchant @options = options end # Create a partner (Gumroad) referral for the given merchant...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/integrations/paypal_partner_rest_credentials.rb
app/business/payments/integrations/paypal_partner_rest_credentials.rb
# frozen_string_literal: true class PaypalPartnerRestCredentials REDIS_KEY_STORAGE_NS = Redis::Namespace.new(:paypal_partner_rest_auth_token, redis: $redis) TOKEN_KEY = "token_header" API_RETRY_TIMEOUT_IN_SECONDS = 2 # Number of seconds before the API request is retried on failure API_MAX_TRIES ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/merchant_registration/user_compliance_info_field_property.rb
app/business/payments/merchant_registration/user_compliance_info_field_property.rb
# frozen_string_literal: true # Information about the fields stored in UserComplianceInfo, such as min/max lengths, etc. module UserComplianceInfoFieldProperty LENGTH = "length" FILTER = "filter" PROPERTIES = { Compliance::Countries::USA.alpha2 => { UserComplianceInfoFields::Individual::TAX_ID => { LE...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/merchant_registration/user_compliance_info_fields.rb
app/business/payments/merchant_registration/user_compliance_info_fields.rb
# frozen_string_literal: true # Fields that can be requested in a UserComplianceInfoRequest. # Some fields map onto the UserComplianceInfo model, while others do not. module UserComplianceInfoFields # The following fields are attributes of UserComplianceInfo and can be referenced # in requests for user compliance ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/merchant_registration/errors/merchant_registration_user_not_ready_error.rb
app/business/payments/merchant_registration/errors/merchant_registration_user_not_ready_error.rb
# frozen_string_literal: true class MerchantRegistrationUserNotReadyError < GumroadRuntimeError def initialize(user_id, message_why_not_ready) super("User #{user_id} #{message_why_not_ready}.") end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/merchant_registration/errors/merchant_registration_user_already_has_account_error.rb
app/business/payments/merchant_registration/errors/merchant_registration_user_already_has_account_error.rb
# frozen_string_literal: true class MerchantRegistrationUserAlreadyHasAccountError < GumroadRuntimeError def initialize(user_id, charge_processor_id) super("User #{user_id} already has a merchant account for charge processor #{charge_processor_id}.") end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/merchant_registration/implementations/stripe/stripe_user_compliance_info_field_map.rb
app/business/payments/merchant_registration/implementations/stripe/stripe_user_compliance_info_field_map.rb
# frozen_string_literal: true module StripeUserComplianceInfoFieldMap MAP_STRIPE_FIELD_TO_INTERNAL_FIELD = { "business_type" => UserComplianceInfoFields::IS_BUSINESS, "individual.first_name" => UserComplianceInfoFields::Individual::FIRST_NAME, "individual.last_name" => UserComplianceInfoFields::Individu...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/merchant_registration/implementations/stripe/stripe_merchant_account_manager.rb
app/business/payments/merchant_registration/implementations/stripe/stripe_merchant_account_manager.rb
# frozen_string_literal: true module StripeMerchantAccountManager REQUESTED_CAPABILITIES = %w(card_payments transfers) CROSS_BORDER_PAYOUTS_ONLY_CAPABILITIES = %w(transfers) COUNTRIES_SUPPORTED_BY_STRIPE_CONNECT = ["Australia", "Austria", "Belgium", "Brazil", "Bulgaria", "Canada", "Croatia", ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
true
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/merchant_registration/implementations/paypal/paypal_merchant_account_manager.rb
app/business/payments/merchant_registration/implementations/paypal/paypal_merchant_account_manager.rb
# frozen_string_literal: true class PaypalMerchantAccountManager attr_reader :response # Ref: https://developer.paypal.com/docs/api/reference/country-codes/#paypal-commerce-platform-availability COUNTRY_CODES_NOT_SUPPORTED_BY_PCP = [ Compliance::Countries::DZA, Compliance::Countries::BRA, Compliance...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/charge_refund.rb
app/business/payments/charging/charge_refund.rb
# frozen_string_literal: true class ChargeRefund attr_accessor :charge_processor_id, :id, :charge_id, :flow_of_funds attr_reader :refund end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/chargeable_funding_type.rb
app/business/payments/charging/chargeable_funding_type.rb
# frozen_string_literal: true class ChargeableFundingType CREDIT = "credit" DEBIT = "debit" PREPAID = "prepaid" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/setup_intent.rb
app/business/payments/charging/setup_intent.rb
# frozen_string_literal: true class SetupIntent attr_accessor :id, :setup_intent, :client_secret def succeeded? true end def requires_action? false end def canceled? false 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/in_app_purchase_details.rb
app/business/payments/charging/in_app_purchase_details.rb
# frozen_string_literal: true InAppPurchaseDetails = Data.define(:product_id, :price_cents, :price_currency_type, :fee_per_thousand)
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/charge_processor.rb
app/business/payments/charging/charge_processor.rb
# frozen_string_literal: true module ChargeProcessor # Time user has to complete Strong Customer Authentication (enter an OTP, confirm purchase via bank app, etc). Sensible default, not dictated by a payment processor. TIME_TO_COMPLETE_SCA = 15.minutes NOTIFICATION_CHARGE_EVENT = "charge_event.charge_processor....
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/chargeable_visual.rb
app/business/payments/charging/chargeable_visual.rb
# frozen_string_literal: true module ChargeableVisual module_function DEFAULT_FORMAT = "**** **** **** %s" LENGTH_TO_FORMAT = Hash.new(DEFAULT_FORMAT).merge( 16 => DEFAULT_FORMAT, 15 => "**** ****** *%s", 14 => "**** ****** %s" ) def is_cc_visual(visual) !(visual =~ /^[*\s\d]+$/).nil? end...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/holder_of_funds.rb
app/business/payments/charging/holder_of_funds.rb
# frozen_string_literal: true # Describe where funds collected by creating a charge at a charge processor # are held until they are paid out to the creator. module HolderOfFunds GUMROAD = "gumroad" STRIPE = "stripe" CREATOR = "creator" end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/charge_event.rb
app/business/payments/charging/charge_event.rb
# frozen_string_literal: true class ChargeEvent # An informational event that requires no action from a financial point of view. TYPE_INFORMATIONAL = :info # A dispute has been formalized and has financial consequences, funds have been withdrawn to cover the dispute. TYPE_DISPUTE_FORMALIZED = :dispute_formaliz...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/chargeable.rb
app/business/payments/charging/chargeable.rb
# frozen_string_literal: true # Public: A chargeable contains multiple internal chargeables that are mapped to charge processor implementations. # Externally to the charging module the application interacts with the Chargeable only but internally to the individual # chargeables associated with each charge processor ar...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/base_processor_charge.rb
app/business/payments/charging/base_processor_charge.rb
# frozen_string_literal: true class BaseProcessorCharge attr_accessor :charge_processor_id, :id, :status, :refunded, :disputed, :fee, :fee_currency, :card_fingerprint, :card_instance_id, :card_last4, :card_number_length, :card_expiry_month, :card_expiry_year, :card_zip_code, ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/flow_of_funds.rb
app/business/payments/charging/flow_of_funds.rb
# frozen_string_literal: true class FlowOfFunds class Amount attr_accessor :currency, :cents def initialize(currency:, cents:) @currency = currency @cents = cents end def to_h { currenty: currency, cents: } end end attr_accessor :issued_amount, :sett...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/charge_intent.rb
app/business/payments/charging/charge_intent.rb
# frozen_string_literal: true # Represents the user's intent to pay. The intent may succeed immediately (resulting in a charge) # or require additional confirmation from the user (such as 3D Secure). # # This is mainly a wrapper around Stripe's PaymentIntent API: https://stripe.com/docs/payments/payment-intents # # Fo...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_unsupported_payment_type_error.rb
app/business/payments/charging/errors/charge_processor_unsupported_payment_type_error.rb
# frozen_string_literal: true class ChargeProcessorUnsupportedPaymentTypeError < ChargeProcessorCardError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_unsupported_payment_account_error.rb
app/business/payments/charging/errors/charge_processor_unsupported_payment_account_error.rb
# frozen_string_literal: true class ChargeProcessorUnsupportedPaymentAccountError < ChargeProcessorCardError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_insufficient_funds_error.rb
app/business/payments/charging/errors/charge_processor_insufficient_funds_error.rb
# frozen_string_literal: true class ChargeProcessorInsufficientFundsError < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_payment_declined_by_payer_account_error.rb
app/business/payments/charging/errors/charge_processor_payment_declined_by_payer_account_error.rb
# frozen_string_literal: true class ChargeProcessorPaymentDeclinedByPayerAccountError < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_error.rb
app/business/payments/charging/errors/charge_processor_error.rb
# frozen_string_literal: true class ChargeProcessorError < GumroadRuntimeError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_payer_cancelled_billing_agreement_error.rb
app/business/payments/charging/errors/charge_processor_payer_cancelled_billing_agreement_error.rb
# frozen_string_literal: true class ChargeProcessorPayerCancelledBillingAgreementError < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_error_generic.rb
app/business/payments/charging/errors/charge_processor_error_generic.rb
# frozen_string_literal: true class ChargeProcessorErrorGeneric < ChargeProcessorError attr_reader :error_code def initialize(error_code, message: nil, original_error: nil) @error_code = error_code super(message, original_error:) 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/errors/charge_processor_invalid_request_error.rb
app/business/payments/charging/errors/charge_processor_invalid_request_error.rb
# frozen_string_literal: true class ChargeProcessorInvalidRequestError < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_unavailable_error.rb
app/business/payments/charging/errors/charge_processor_unavailable_error.rb
# frozen_string_literal: true class ChargeProcessorUnavailableError < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_error_rate_limit.rb
app/business/payments/charging/errors/charge_processor_error_rate_limit.rb
# frozen_string_literal: true class ChargeProcessorErrorRateLimit < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_not_supported_error.rb
app/business/payments/charging/errors/charge_processor_not_supported_error.rb
# frozen_string_literal: true class ChargeProcessorNotSupportedError < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_card_error.rb
app/business/payments/charging/errors/charge_processor_card_error.rb
# frozen_string_literal: true class ChargeProcessorCardError < ChargeProcessorError attr_reader :error_code, :charge_id def initialize(error_code, message = nil, original_error: nil, charge_id: nil) @error_code = error_code @charge_id = charge_id super(message, original_error:) 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/errors/charge_processor_payee_account_restricted_error.rb
app/business/payments/charging/errors/charge_processor_payee_account_restricted_error.rb
# frozen_string_literal: true class ChargeProcessorPayeeAccountRestrictedError < ChargeProcessorError end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/business/payments/charging/errors/charge_processor_already_refunded_error.rb
app/business/payments/charging/errors/charge_processor_already_refunded_error.rb
# frozen_string_literal: true class ChargeProcessorAlreadyRefundedError < ChargeProcessorError 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_transient_customer.rb
app/business/payments/charging/implementations/braintree/braintree_chargeable_transient_customer.rb
# frozen_string_literal: true class BraintreeChargeableTransientCustomer < BraintreeChargeableBase TRANSIENT_CLIENT_TOKEN_VALIDITY_DURATION = 5.minutes attr_accessor :customer_id, :transient_customer_store_key def initialize(customer_id, transient_customer_store_key) @customer_id = customer_id @transie...
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_processor.rb
app/business/payments/charging/implementations/braintree/braintree_charge_processor.rb
# frozen_string_literal: true class BraintreeChargeProcessor DISPLAY_NAME = "Braintree" MAXIMUM_DESCRIPTOR_LENGTH = 18 PROCESSOR_UNSUPPORTED_PAYMENT_ACCOUNT_ERROR_CODE = "2071" PROCESSOR_UNSUPPORTED_PAYMENT_INSTRUMENT_ERROR_CODE = "2074" private_constant :MAXIMUM_DESCRIPTOR_LENGTH, :PROCESSOR_UNSUPPORTED...
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_nonce.rb
app/business/payments/charging/implementations/braintree/braintree_chargeable_nonce.rb
# frozen_string_literal: true class BraintreeChargeableNonce < BraintreeChargeableBase def initialize(nonce, zip_code) @nonce = nonce @zip_code = zip_code end def prepare! unless @paypal || @card @customer = Braintree::Customer.create!( credit_card: { payment_method_nonce: @n...
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_credit_card.rb
app/business/payments/charging/implementations/braintree/braintree_chargeable_credit_card.rb
# frozen_string_literal: true # Public: Chargeable representing a card stored at Braintree. class BraintreeChargeableCreditCard attr_reader :fingerprint, :last4, :number_length, :visual, :expiry_month, :expiry_year, :zip_code, :card_type, :country attr_reader :braintree_customer_id def initialize(reusable_token...
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_refund.rb
app/business/payments/charging/implementations/braintree/braintree_charge_refund.rb
# frozen_string_literal: true class BraintreeChargeRefund < ChargeRefund def initialize(braintree_transaction) self.charge_processor_id = BraintreeChargeProcessor.charge_processor_id self.id = braintree_transaction.id self.charge_id = braintree_transaction.refunded_transaction_id currency = Currency...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false