source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/rwanda_bank_account.rb | Ruby | mit | 8,966 | main | 1,132 | # frozen_string_literal: true
class RwandaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "RW"
BANK_CODE_FORMAT_REGEX = /^[A-Za-z0-9]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9]{1,15}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :ba... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/upsell_purchase.rb | Ruby | mit | 8,966 | main | 1,121 | # frozen_string_literal: true
class UpsellPurchase < ApplicationRecord
belongs_to :purchase
belongs_to :upsell
belongs_to :selected_product, class_name: "Link", optional: true
belongs_to :upsell_variant, optional: true
validates :purchase, presence: true, uniqueness: true
validates_presence_of :upsell
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/kazakhstan_bank_account.rb | Ruby | mit | 8,966 | main | 1,040 | # frozen_string_literal: true
class KazakhstanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KZ"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number
def routing... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/country.rb | Ruby | mit | 8,966 | main | 16,278 | # frozen_string_literal: true
class Country
include CurrencyHelper
CROSS_BORDER_PAYOUTS_COUNTRIES = [
Compliance::Countries::THA,
Compliance::Countries::KOR,
Compliance::Countries::ISR,
Compliance::Countries::TTO,
Compliance::Countries::PHL,
Compliance::Countries::MEX,
Compliance::Coun... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/gumroad_daily_analytic.rb | Ruby | mit | 8,966 | main | 866 | # frozen_string_literal: true
class GumroadDailyAnalytic < ApplicationRecord
validates :period_ended_at, :gumroad_price_cents, :gumroad_fee_cents, :creators_with_sales, :gumroad_discover_price_cents, presence: true
def self.import(date)
date_range = date.all_day
analytic = GumroadDailyAnalytic.find_or_ini... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/discord_integration.rb | Ruby | mit | 8,966 | main | 1,175 | # frozen_string_literal: true
class DiscordIntegration < Integration
INTEGRATION_DETAILS = %w[username server_id server_name]
INTEGRATION_DETAILS.each { |detail| attr_json_data_accessor detail }
def self.discord_user_id_for(purchase)
integration = purchase.find_enabled_integration(Integration::DISCORD)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/collaborator.rb | Ruby | mit | 8,966 | main | 2,450 | # frozen_string_literal: true
class Collaborator < Affiliate
MIN_PERCENT_COMMISSION = 1
MAX_PERCENT_COMMISSION = 50
belongs_to :seller, class_name: "User"
has_one :collaborator_invitation, dependent: :destroy
validates :seller_id, uniqueness: { scope: [:affiliate_user_id, :deleted_at] }, unless: :deleted?... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/stamped_pdf.rb | Ruby | mit | 8,966 | main | 388 | # frozen_string_literal: true
class StampedPdf < ApplicationRecord
include S3Retrievable, Deletable, CdnDeletable
has_s3_fields :url
belongs_to :url_redirect, optional: true
belongs_to :product_file, optional: true
validates_presence_of :url_redirect, :product_file, :url
def user
product_file.try(:l... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/customer_email_info.rb | Ruby | mit | 8,966 | main | 951 | # frozen_string_literal: true
class CustomerEmailInfo < EmailInfo
EMAIL_INFO_TYPE = "customer"
def self.find_or_initialize_for_charge(charge_id:, email_name:)
# Queries `email_info_charges` first to leverage the index since there is no `purchase_id` on the associated
# `email_infos` record (`email_infos` ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/macao_bank_account.rb | Ruby | mit | 8,966 | main | 1,128 | # frozen_string_literal: true
class MacaoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MO"
BANK_CODE_FORMAT_REGEX = /^[A-Za-z0-9]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,19}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_n... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/taiwan_bank_account.rb | Ruby | mit | 8,966 | main | 1,177 | # frozen_string_literal: true
class TaiwanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TW"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{10,14}\z/
private_constant :ACCOUNT_NUMBER_FO... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/subtitle_file.rb | Ruby | mit | 8,966 | main | 1,117 | # frozen_string_literal: true
class SubtitleFile < ApplicationRecord
include S3Retrievable, ExternalId, JsonData, Deletable, CdnDeletable
VALID_FILE_TYPE_REGEX = /\A.+\.(srt|sub|sbv|vtt)\z/
has_paper_trail
belongs_to :product_file, optional: true
validates_presence_of :product_file, :url
validate :ens... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/brunei_bank_account.rb | Ruby | mit | 8,966 | main | 1,132 | # frozen_string_literal: true
class BruneiBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BN"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9]{1,13}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :ba... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/call.rb | Ruby | mit | 8,966 | main | 3,527 | # frozen_string_literal: true
class Call < ApplicationRecord
include ExternalId
belongs_to :purchase
delegate :link, to: :purchase
attr_readonly :start_time, :end_time
normalizes :start_time, :end_time, with: -> { _1.change(sec: 0) }
validates_presence_of :start_time, :end_time
validate :start_time_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/scheduled_payout.rb | Ruby | mit | 8,966 | main | 4,439 | # frozen_string_literal: true
class ScheduledPayout < ApplicationRecord
include ExternalId
ACTIONS = %w[refund payout hold].freeze
STATUSES = %w[pending executed cancelled flagged held].freeze
IN_PROGRESS_STATUSES = %w[pending flagged held].freeze
AUTO_PAYOUT_THRESHOLD_CENTS = 100_000
belongs_to :user
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/cart.rb | Ruby | mit | 8,966 | main | 2,226 | # frozen_string_literal: true
class Cart < ApplicationRecord
include SecureExternalId
include Deletable
DISCOUNT_CODES_SCHEMA = {
"$schema": "http://json-schema.org/draft-06/schema#",
type: "array",
items: { "$ref": "#/$defs/discount_code" },
"$defs": {
discount_code: {
type: "obje... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bundle_product.rb | Ruby | mit | 8,966 | main | 2,995 | # frozen_string_literal: true
class BundleProduct < ApplicationRecord
include Deletable, ExternalId
has_paper_trail
belongs_to :bundle, class_name: "Link"
belongs_to :product, class_name: "Link"
belongs_to :variant, class_name: "BaseVariant", optional: true
validate :product_belongs_to_bundle_seller
v... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/user_tax_form.rb | Ruby | mit | 8,966 | main | 638 | # frozen_string_literal: true
class UserTaxForm < ApplicationRecord
include JsonData
TAX_FORM_TYPES = ["us_1099_k", "us_1099_misc"].freeze
MIN_TAX_YEAR = 2020
belongs_to :user
attr_json_data_accessor :stripe_account_id
attr_json_data_accessor :filed_at
validates :tax_year, presence: true, numericalit... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/payment_option.rb | Ruby | mit | 8,966 | main | 905 | # frozen_string_literal: true
class PaymentOption < ApplicationRecord
include Deletable
belongs_to :subscription
belongs_to :price
belongs_to :installment_plan,
foreign_key: :product_installment_plan_id, class_name: "ProductInstallmentPlan",
optional: true
has_one :installment_plan... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/niger_bank_account.rb | Ruby | mit | 8,966 | main | 685 | # frozen_string_literal: true
class NigerBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NE"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::NER.alpha2
end
def currency
Currency::XOF
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/recurring_service.rb | Ruby | mit | 8,966 | main | 757 | # frozen_string_literal: true
class RecurringService < ApplicationRecord
include ExternalId
include JsonData
include DiscountCode
include RecurringService::Recurrence
include RecurringService::Tiers
belongs_to :user, optional: true
has_many :charges, class_name: "ServiceCharge"
has_one :latest_charge,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sri_lanka_bank_account.rb | Ruby | mit | 8,966 | main | 1,378 | # frozen_string_literal: true
class SriLankaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LK"
BANK_CODE_FORMAT_REGEX = /^[a-z0-9A-Z]{11}$/
BRANCH_CODE_FORMAT_REGEX = /^\d{7}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{10,18}$/
private_constant :BANK_CODE_FORMAT_REGEX, :BRANCH_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FO... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/media_location.rb | Ruby | mit | 8,966 | main | 1,386 | # frozen_string_literal: true
class MediaLocation < ApplicationRecord
include MediaLocation::Unit
include Platform
include TimestampScopes
belongs_to :product_file, optional: true
belongs_to :purchase, optional: true
scope :max_consumed_at_by_file, lambda { |purchase_id:|
subquery = MediaLocation.sel... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/guyana_bank_account.rb | Ruby | mit | 8,966 | main | 1,138 | # frozen_string_literal: true
class GuyanaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GY"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9a-zA-Z]{1,32}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_cod... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_affiliate.rb | Ruby | mit | 8,966 | main | 2,461 | # frozen_string_literal: true
class ProductAffiliate < ApplicationRecord
include FlagShihTzu
self.table_name = "affiliates_links"
belongs_to :affiliate
belongs_to :product, class_name: "Link", foreign_key: :link_id
validates :affiliate, uniqueness: { scope: :product }
validates :affiliate_basis_points, ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/egypt_bank_account.rb | Ruby | mit | 8,966 | main | 1,067 | # frozen_string_literal: true
class EgyptBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "EG"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :va... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/refund.rb | Ruby | mit | 8,966 | main | 1,023 | # frozen_string_literal: true
class Refund < ApplicationRecord
FRAUD = "fraud"
include JsonData, FlagShihTzu
belongs_to :user, foreign_key: :refunding_user_id, optional: true
belongs_to :purchase
belongs_to :product, class_name: "Link", foreign_key: :link_id
belongs_to :seller, class_name: "User"
has_m... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/cambodia_bank_account.rb | Ruby | mit | 8,966 | main | 1,121 | # frozen_string_literal: true
class CambodiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KH"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9a-zA-Z]{5,15}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bolivia_bank_account.rb | Ruby | mit | 8,966 | main | 1,102 | # frozen_string_literal: true
class BoliviaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BO"
BANK_CODE_FORMAT_REGEX = /^\d{1,3}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{10,15}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validat... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/mozambique_bank_account.rb | Ruby | mit | 8,966 | main | 1,144 | # frozen_string_literal: true
class MozambiqueBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MZ"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9a-zA-Z]){21}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :ba... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/global_affiliate.rb | Ruby | mit | 8,966 | main | 1,004 | # frozen_string_literal: true
class GlobalAffiliate < Affiliate
AFFILIATE_COOKIE_LIFETIME_DAYS = 7
AFFILIATE_BASIS_POINTS = 1000
validates :affiliate_user_id, uniqueness: true
validates :affiliate_basis_points, presence: true
before_validation :set_affiliate_basis_points, unless: :persisted?
def self.co... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/taxonomy.rb | Ruby | mit | 8,966 | main | 266 | # frozen_string_literal: true
class Taxonomy < ApplicationRecord
has_closure_tree name_column: :slug
has_many :products, class_name: "Link"
has_one :taxonomy_stat, dependent: :destroy
validates :slug, presence: true, uniqueness: { scope: :parent_id }
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/canadian_bank_account.rb | Ruby | mit | 8,966 | main | 1,116 | # frozen_string_literal: true
class CanadianBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CANADIAN"
INSTITUTION_NUMBER_FORMAT_REGEX = /^\d{3}$/
TRANSIT_NUMBER_FORMAT_REGEX = /^\d{5}$/
private_constant :INSTITUTION_NUMBER_FORMAT_REGEX, :TRANSIT_NUMBER_FORMAT_REGEX
alias_attribute :institution_number, :ba... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/pakistan_bank_account.rb | Ruby | mit | 8,966 | main | 1,070 | # frozen_string_literal: true
class PakistanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PK"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/recommended_purchase_info.rb | Ruby | mit | 8,966 | main | 725 | # frozen_string_literal: true
class RecommendedPurchaseInfo < ApplicationRecord
include FlagShihTzu
belongs_to :purchase, optional: true
belongs_to :recommended_link, class_name: "Link", optional: true
belongs_to :recommended_by_link, class_name: "Link", optional: true
validates_inclusion_of :recommender_m... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/computed_sales_analytics_day.rb | Ruby | mit | 8,966 | main | 756 | # frozen_string_literal: true
class ComputedSalesAnalyticsDay < ApplicationRecord
def self.read_data_from_keys(keys)
with_empty_values = keys.zip([nil]).to_h
with_existing_values = where(key: keys).order(:key).pluck(:key, :data).to_h do |(key, data)|
[key, JSON.parse(data)]
end
with_empty_value... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/event.rb | Ruby | mit | 8,966 | main | 2,400 | # frozen_string_literal: true
class Event < ApplicationRecord
include TimestampScopes
include FlagShihTzu
# Events with names listed below are created and kept forever.
# We also create events that aren't in this list if they have a user_id (see Events#created_event),
# but they're automatically deleted aft... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/installment_rule.rb | Ruby | mit | 8,966 | main | 2,666 | # frozen_string_literal: true
class InstallmentRule < ApplicationRecord
has_paper_trail version: :paper_trail_version
include Deletable
belongs_to :installment, optional: true
# To show the proper time period to a user, we need to store this.
# To a user, they should see "1 week" instead of "7 days."
HO... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/swiss_bank_account.rb | Ruby | mit | 8,966 | main | 808 | # frozen_string_literal: true
class SwissBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CH"
ACCOUNT_NUMBER_FORMAT_REGEX = /\ACH[0-9]{7}[A-Za-z0-9]{12}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sent_email_info.rb | Ruby | mit | 8,966 | main | 878 | # frozen_string_literal: true
class SentEmailInfo < ApplicationRecord
validates_presence_of :key
def self.key_exists?(key)
unscoped.where(key:).exists?
end
def self.set_key!(key)
record = new
record.key = key
begin
record.save!
rescue ActiveRecord::RecordNotUnique
nil
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/call_availability.rb | Ruby | mit | 8,966 | main | 725 | # frozen_string_literal: true
class CallAvailability < ApplicationRecord
include ExternalId
belongs_to :call, class_name: "Link"
normalizes :start_time, :end_time, with: -> { _1.change(sec: 0) }
validates_presence_of :call, :start_time, :end_time
validate :start_time_is_before_end_time
scope :upcoming... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/argentina_bank_account.rb | Ruby | mit | 8,966 | main | 752 | # frozen_string_literal: true
class ArgentinaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AR"
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{22}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Cou... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/peru_bank_account.rb | Ruby | mit | 8,966 | main | 747 | # frozen_string_literal: true
class PeruBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PE"
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{20}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countrie... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/creator_email_click_event.rb | Ruby | mit | 8,966 | main | 603 | # frozen_string_literal: true
class CreatorEmailClickEvent
include Mongoid::Document
include Mongoid::Timestamps
# This is a key that represents the link by which to view attached files on an installment
VIEW_ATTACHMENTS_URL = "view_attachments_url"
index({ installment_id: 1, mailer_method: 1, mailer_args:... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/user.rb | Ruby | mit | 8,966 | main | 48,093 | # frozen_string_literal: true
class User < ApplicationRecord
devise :database_authenticatable, :registerable, :confirmable, :omniauthable,
:recoverable, :rememberable, :trackable, :pwned_password
has_paper_trail
has_one_time_password
include Flipper::Identifier, FlagShihTzu, CurrencyHelper, JsonData,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/invite.rb | Ruby | mit | 8,966 | main | 879 | # frozen_string_literal: true
class Invite < ApplicationRecord
belongs_to :user, foreign_key: "sender_id", optional: true
# invite state machine
#
# invitation_sent → → → → signed_up
#
state_machine :invite_state, initial: :invitation_sent do
after_transition invitation_sent: :signed_up, do: :notify_s... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/seller_profile_section.rb | Ruby | mit | 8,966 | main | 1,381 | # frozen_string_literal: true
class SellerProfileSection < ApplicationRecord
include ExternalId, FlagShihTzu
belongs_to :seller, class_name: "User"
belongs_to :product, class_name: "Link", optional: true
validate :validate_json_data
attribute :json_data, default: {}
scope :on_profile, -> { where(product_i... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/refund_policy.rb | Ruby | mit | 8,966 | main | 999 | # frozen_string_literal: true
class RefundPolicy < ApplicationRecord
include ExternalId
has_paper_trail
ALLOWED_REFUND_PERIODS_IN_DAYS = {
0 => "No refunds allowed",
7 => "7-day money back guarantee",
14 => "14-day money back guarantee",
30 => "30-day money back guarantee",
183 => "6-month ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/panama_bank_account.rb | Ruby | mit | 8,966 | main | 1,111 | # frozen_string_literal: true
class PanamaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PA"
BANK_CODE_FORMAT_REGEX = /^[A-Z]{4}PAPA[A-Z0-9]{3}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,18}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
val... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/wishlist_product.rb | Ruby | mit | 8,966 | main | 2,127 | # frozen_string_literal: true
class WishlistProduct < ApplicationRecord
include ExternalId
include Deletable
WISHLIST_PRODUCT_LIMIT = 100
belongs_to :wishlist
belongs_to :product, class_name: "Link"
belongs_to :variant, class_name: "BaseVariant", optional: true
scope :available_to_buy, -> { joins(prod... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/south_africa_bank_account.rb | Ruby | mit | 8,966 | main | 1,187 | # frozen_string_literal: true
class SouthAfricaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "ZA"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9a-zA-Z]{1,16}\z/
private_constant :ACCOUNT... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bank_account.rb | Ruby | mit | 8,966 | main | 3,214 | # frozen_string_literal: true
class BankAccount < ApplicationRecord
include ExternalId
include Deletable
belongs_to :user, optional: true
has_many :payments
belongs_to :credit_card, optional: true
encrypt_with_public_key :account_number,
symmetric: :never,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/seller_profile_rich_text_section.rb | Ruby | mit | 8,966 | main | 242 | # frozen_string_literal: true
class SellerProfileRichTextSection < SellerProfileSection
validate :limit_text_size
private
def limit_text_size
errors.add(:base, "Text is too large") if text.to_json.length > 500_000
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/ethiopia_bank_account.rb | Ruby | mit | 8,966 | main | 1,141 | # frozen_string_literal: true
class EthiopiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "ET"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9a-zA-Z]{13,16}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/email_event_info.rb | Ruby | mit | 8,966 | main | 4,288 | # frozen_string_literal: true
class EmailEventInfo
RECEIPT_MAILER_METHOD = "receipt"
PREORDER_RECEIPT_MAILER_METHOD = "preorder_receipt"
PURCHASE_INSTALLMENT_MAILER_METHOD = "purchase_installment"
FOLLOWER_INSTALLMENT_MAILER_METHOD = "follower_installment"
DIRECT_AFFILIATE_INSTALLMENT_MAILER_METHOD = "direct... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/cart_product.rb | Ruby | mit | 8,966 | main | 1,481 | # frozen_string_literal: true
class CartProduct < ApplicationRecord
include ExternalId
include Deletable
URL_PARAMETERS_JSON_SCHEMA = { type: "object", additionalProperties: { type: "string" } }.freeze
ACCEPTED_OFFER_DETAILS_JSON_SCHEMA = {
type: "object",
properties: {
original_product_id: { ty... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/credit.rb | Ruby | mit | 8,966 | main | 18,779 | # frozen_string_literal: true
class Credit < ApplicationRecord
include CurrencyHelper, JsonData
belongs_to :user, optional: true
belongs_to :merchant_account, optional: true
belongs_to :crediting_user, class_name: "User", optional: true
belongs_to :balance, optional: true
belongs_to :chargebacked_purchase... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_sort_key.rb | Ruby | mit | 8,966 | main | 714 | # frozen_string_literal: true
class ProductSortKey
FEATURED = "featured"
BEST_SELLERS = "best_sellers"
CURATED = "curated"
NEWEST = "newest"
PRICE_ASCENDING = "price_asc"
PRICE_DESCENDING = "price_desc"
AVAILABLE_PRICE_ASCENDING = "available_price_asc"
AVAILABLE_PRICE_DESCENDING = "available_price_desc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/utm_link_visit.rb | Ruby | mit | 8,966 | main | 344 | # frozen_string_literal: true
class UtmLinkVisit < ApplicationRecord
has_paper_trail
belongs_to :utm_link
belongs_to :user, optional: true
has_many :utm_link_driven_sales, dependent: :destroy
has_many :purchases, through: :utm_link_driven_sales
validates :ip_address, presence: true
validates :browser_g... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/albania_bank_account.rb | Ruby | mit | 8,966 | main | 1,073 | # frozen_string_literal: true
class AlbaniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AL"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number, if: -> { Rails.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/purchase_integration.rb | Ruby | mit | 8,966 | main | 1,117 | # frozen_string_literal: true
class PurchaseIntegration < ApplicationRecord
include Deletable
belongs_to :purchase, optional: true
belongs_to :integration, optional: true
validates :purchase_id, presence: true
validates :integration_id, presence: true
validates :integration_id, uniqueness: { scope: %i[pu... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/nigeria_bank_account.rb | Ruby | mit | 8,966 | main | 1,174 | # frozen_string_literal: true
class NigeriaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NG"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{10}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_folder.rb | Ruby | mit | 8,966 | main | 339 | # frozen_string_literal: true
class ProductFolder < ApplicationRecord
include ExternalId
include Deletable
scope :in_order, -> { order(position: :asc) }
belongs_to :link, foreign_key: "product_id", optional: true
validates_presence_of :name
def as_json(options = {})
{
id: external_id,
nam... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/dispute_evidence.rb | Ruby | mit | 8,966 | main | 3,517 | # frozen_string_literal: true
class DisputeEvidence < ApplicationRecord
def self.create_from_dispute!(dispute)
DisputeEvidence::CreateFromDisputeService.new(dispute).perform!
end
has_paper_trail
include ExternalId, TimestampStateFields
delegate :disputable, to: :dispute
stripped_fields \
:custo... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/shipping_destination.rb | Ruby | mit | 8,966 | main | 3,622 | # frozen_string_literal: true
class ShippingDestination < ApplicationRecord
include CurrencyHelper
include ShippingDestination::Destinations
include FlagShihTzu
belongs_to :purchase, optional: true
belongs_to :user, optional: true
belongs_to :link, optional: true
has_flags 1 => :is_virtual_country,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sales_export_chunk.rb | Ruby | mit | 8,966 | main | 285 | # frozen_string_literal: true
class SalesExportChunk < ApplicationRecord
belongs_to :export, class_name: "SalesExport"
serialize :purchase_ids, type: Array, coder: YAML
serialize :custom_fields, type: Array, coder: YAML
serialize :purchases_data, type: Array, coder: YAML
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/wishlist_follower.rb | Ruby | mit | 8,966 | main | 942 | # frozen_string_literal: true
class WishlistFollower < ApplicationRecord
include ExternalId
include Deletable
belongs_to :wishlist
belongs_to :follower_user, class_name: "User"
validates :follower_user, uniqueness: { scope: [:wishlist_id, :deleted_at], message: "is already following this wishlist." }
val... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/service_charge.rb | Ruby | mit | 8,966 | main | 4,952 | # frozen_string_literal: true
class ServiceCharge < ApplicationRecord
include CurrencyHelper
include ActionView::Helpers::DateHelper
include PurchaseErrorCode
include DiscountCode
include ExternalId
include JsonData
include TimestampScopes
include Purchase::CardCountrySource
include Rails.application... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/url_redirect.rb | Ruby | mit | 8,966 | main | 14,717 | # frozen_string_literal: true
class UrlRedirect < ApplicationRecord
include ExternalId
include SignedUrlHelper
include FlagShihTzu
# Note: SendPostBlastEmailsJob bypasses all validations and callbacks when creating records.
before_validation :set_token
validates :token, uniqueness: { case_sensitive: true ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/romania_bank_account.rb | Ruby | mit | 8,966 | main | 688 | # frozen_string_literal: true
class RomaniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "RO"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::ROU.alpha2
end
def currency
Currency::RON
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/custom_domain.rb | Ruby | mit | 8,966 | main | 4,633 | # frozen_string_literal: true
require "ipaddr"
class CustomDomain < ApplicationRecord
WWW_PREFIX = "www"
MAX_FAILED_VERIFICATION_ATTEMPTS_COUNT = 3
include Deletable
stripped_fields :domain, transform: -> { _1.downcase }
belongs_to :user, optional: true
belongs_to :product, class_name: "Link", optional... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/norway_bank_account.rb | Ruby | mit | 8,966 | main | 677 | # frozen_string_literal: true
class NorwayBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NO"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::NOR.alpha2
end
def currency
Currency::NOK
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/trinidad_and_tobago_bank_account.rb | Ruby | mit | 8,966 | main | 1,428 | # frozen_string_literal: true
class TrinidadAndTobagoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TT"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{5}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/community_chat_message.rb | Ruby | mit | 8,966 | main | 370 | # frozen_string_literal: true
class CommunityChatMessage < ApplicationRecord
include Deletable
include ExternalId
belongs_to :community
belongs_to :user
has_many :last_read_community_chat_messages, dependent: :destroy
validates :content, presence: true, length: { minimum: 1, maximum: 20_000 }
scope :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_integration.rb | Ruby | mit | 8,966 | main | 350 | # frozen_string_literal: true
class ProductIntegration < ApplicationRecord
include Deletable
belongs_to :product, class_name: "Link", optional: true
belongs_to :integration, optional: true
validates_presence_of :product_id, :integration_id
validates_uniqueness_of :integration_id, scope: %i[product_id delet... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/variant_price.rb | Ruby | mit | 8,966 | main | 1,182 | # frozen_string_literal: true
class VariantPrice < BasePrice
belongs_to :variant, optional: true
validates :variant, presence: true
validate :recurrence_validation
validate :price_cents_validation
delegate :link, to: :variant
def price_formatted_without_symbol
return "" if price_cents.blank?
di... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/merchant_account.rb | Ruby | mit | 8,966 | main | 4,813 | # frozen_string_literal: true
class MerchantAccount < ApplicationRecord
include Deletable
include ExternalId
include JsonData
include ChargeProcessable
belongs_to :user, optional: true
has_many :purchases
has_many :credits
has_many :balances
has_many :balance_transactions
has_many :charges
attr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/confirmed_follower_event.rb | Ruby | mit | 8,966 | main | 1,550 | # frozen_string_literal: true
class ConfirmedFollowerEvent
include Elasticsearch::Model
index_name "confirmed_follower_events"
settings(
number_of_shards: 1,
number_of_replicas: 0,
sort: { field: :timestamp, order: :asc }
)
mapping dynamic: :strict do
indexes :name, type: :keyword
index... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/preorder.rb | Ruby | mit | 8,966 | main | 10,122 | # frozen_string_literal: true
class Preorder < ApplicationRecord
include ExternalId
include AfterCommitEverywhere
belongs_to :preorder_link, optional: true
belongs_to :seller, class_name: "User", optional: true
belongs_to :purchaser, class_name: "User", optional: true
has_many :purchases
has_one :url_re... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sent_post_email.rb | Ruby | mit | 8,966 | main | 923 | # frozen_string_literal: true
class SentPostEmail < ApplicationRecord
belongs_to :post, class_name: "Installment", optional: true
before_validation :downcase_email
validates_presence_of :email
def downcase_email
return if email.blank?
self.email = email.downcase
end
def self.missing_emails(post:,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/uzbekistan_bank_account.rb | Ruby | mit | 8,966 | main | 1,262 | # frozen_string_literal: true
class UzbekistanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "UZ"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z0-9]){8,11}$/
BRANCH_CODE_FORMAT_REGEX = /^([0-9]){5}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{5,20}$/
private_constant :BANK_CODE_FORMAT_REGEX, :BRANCH_CODE_FORMAT_REGEX, :ACCOUNT... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/zoom_integration.rb | Ruby | mit | 8,966 | main | 502 | # frozen_string_literal: true
class ZoomIntegration < Integration
INTEGRATION_DETAILS = %w[user_id email access_token refresh_token]
INTEGRATION_DETAILS.each { |detail| attr_json_data_accessor detail }
def self.is_enabled_for(purchase)
purchase.find_enabled_integration(Integration::ZOOM).present?
end
d... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bahrain_bank_account.rb | Ruby | mit | 8,966 | main | 1,073 | # frozen_string_literal: true
class BahrainBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BH"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number, if: -> { Rails.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/azerbaijan_bank_account.rb | Ruby | mit | 8,966 | main | 1,348 | # frozen_string_literal: true
class AzerbaijanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AZ"
BANK_CODE_FORMAT_REGEX = /^\d{6}$/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /^\d{6}$/
private_constant :BRANCH_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validat... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/payment.rb | Ruby | mit | 8,966 | main | 14,252 | # frozen_string_literal: true
class Payment < ApplicationRecord
include ExternalId, Payment::Stats, JsonData, FlagShihTzu, TimestampScopes, Payment::FailureReason
CREATING = "creating"
PROCESSING = "processing"
UNCLAIMED = "unclaimed"
COMPLETED = "completed"
FAILED = "failed"
CANCELLED = "cancelled"
R... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/direct_affiliate.rb | Ruby | mit | 8,966 | main | 5,989 | # frozen_string_literal: true
class DirectAffiliate < Affiliate
include Affiliate::BasisPointsValidations
include Affiliate::DestinationUrlValidations
include Affiliate::Sorting
AFFILIATE_COOKIE_LIFETIME_DAYS = 30
attr_accessor :prevent_sending_invitation_email, :prevent_sending_invitation_email_to_seller
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/variant_category.rb | Ruby | mit | 8,966 | main | 1,211 | # frozen_string_literal: true
class VariantCategory < ApplicationRecord
include ExternalId
include Deletable
include FlagShihTzu
has_many :variants
has_many :alive_variants, -> { alive }, class_name: "Variant"
belongs_to :link, optional: true
# For tiered membership products, variants are "tiers"
has... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/last_read_community_chat_message.rb | Ruby | mit | 8,966 | main | 1,155 | # frozen_string_literal: true
class LastReadCommunityChatMessage < ApplicationRecord
include ExternalId
belongs_to :user
belongs_to :community
belongs_to :community_chat_message
validates :user_id, uniqueness: { scope: :community_id }
def self.set!(user_id:, community_id:, community_chat_message_id:)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/ghana_bank_account.rb | Ruby | mit | 8,966 | main | 1,121 | # frozen_string_literal: true
class GhanaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GH"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{6}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{8,20}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_num... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/qatar_bank_account.rb | Ruby | mit | 8,966 | main | 1,155 | # frozen_string_literal: true
class QatarBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "QA"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{29}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
valid... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/installment_event.rb | Ruby | mit | 8,966 | main | 385 | # frozen_string_literal: true
class InstallmentEvent < ApplicationRecord
belongs_to :event, optional: true
belongs_to :installment, optional: true
after_commit :update_installment_events_cache_count, on: [:create, :destroy]
private
def update_installment_events_cache_count
UpdateInstallmentEventsCo... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/public_file.rb | Ruby | mit | 8,966 | main | 2,199 | # frozen_string_literal: true
class PublicFile < ApplicationRecord
include Deletable
DELETE_UNUSED_FILES_AFTER_DAYS = 10
belongs_to :seller, optional: true, class_name: "User"
belongs_to :resource, polymorphic: true
has_one_attached :file
validates :public_id, presence: true, format: { with: /\A[a-z0-9... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/hong_kong_bank_account.rb | Ruby | mit | 8,966 | main | 1,456 | # frozen_string_literal: true
class HongKongBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "HK"
CLEARING_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :CLEARING_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/early_fraud_warning.rb | Ruby | mit | 8,966 | main | 4,079 | # frozen_string_literal: true
class EarlyFraudWarning < ApplicationRecord
self.table_name = "purchase_early_fraud_warnings"
has_paper_trail
include TimestampStateFields
belongs_to :purchase, optional: true
belongs_to :charge, optional: true
belongs_to :dispute, optional: true
belongs_to :refund, optio... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/vietnam_bank_account.rb | Ruby | mit | 8,966 | main | 1,128 | # frozen_string_literal: true
class VietnamBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "VN"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{8}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{1,17}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_n... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/resend_event_info.rb | Ruby | mit | 8,966 | main | 3,116 | # frozen_string_literal: true
class ResendEventInfo < EmailEventInfo
attr_reader \
:charge_id, :click_url, :email, :event_json, :installment_id,
:mailer_class, :mailer_method, :mailer_args, :purchase_id, :workflow_ids, :type, :created_at
# Sample payload
# event_json = HashWithIndifferentAccess.new({
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/kenya_bank_account.rb | Ruby | mit | 8,966 | main | 1,181 | # frozen_string_literal: true
class KenyaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KE"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9a-zA-Z]{1,32}\z/
private_constant :ACCOUNT_NUMBE... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/resource_subscription.rb | Ruby | mit | 8,966 | main | 1,801 | # frozen_string_literal: true
class ResourceSubscription < ApplicationRecord
include ExternalId
include Deletable
SALE_RESOURCE_NAME = "sale"
CANCELLED_RESOURCE_NAME = "cancellation"
SUBSCRIPTION_ENDED_RESOURCE_NAME = "subscription_ended"
SUBSCRIPTION_RESTARTED_RESOURCE_NAME = "subscription_restarted"
S... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/madagascar_bank_account.rb | Ruby | mit | 8,966 | main | 1,180 | # frozen_string_literal: true
class MadagascarBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MG"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^MG([0-9]){25}$/
private_constant :ACCOUNT_NUMBER... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/mexico_bank_account.rb | Ruby | mit | 8,966 | main | 749 | # frozen_string_literal: true
class MexicoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MX"
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{18}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.