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 |
|---|---|---|---|---|---|---|---|---|
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/fake_processor/subscription.rb | app/models/pay/fake_processor/subscription.rb | module Pay
module FakeProcessor
class Subscription < Pay::Subscription
def self.sync(processor_id, **options)
# Bypass sync operation for FakeProcessor
end
def api_record(**options)
self
end
# With trial, sets end to trial end (mimicking Stripe)
# Without tria... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/fake_processor/customer.rb | app/models/pay/fake_processor/customer.rb | module Pay
module FakeProcessor
class Customer < Pay::Customer
has_many :charges, dependent: :destroy, class_name: "Pay::FakeProcessor::Charge"
has_many :subscriptions, dependent: :destroy, class_name: "Pay::FakeProcessor::Subscription"
has_many :payment_methods, dependent: :destroy, class_name:... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/fake_processor/merchant.rb | app/models/pay/fake_processor/merchant.rb | module Pay
module FakeProcessor
class Merchant < Pay::Merchant
def create_account(**options)
fake_account = Struct.new(:id).new("fake_account_id")
update(processor_id: fake_account.id)
fake_account
end
def account_link(refresh_url:, return_url:, type: "account_onboarding... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/fake_processor/payment_method.rb | app/models/pay/fake_processor/payment_method.rb | module Pay
module FakeProcessor
class PaymentMethod < Pay::PaymentMethod
def make_default!
return if default?
customer.payment_methods.update_all(default: false)
update!(default: true)
end
def detach
end
end
end
end
ActiveSupport.run_load_hooks :pay_fake_pr... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/fake_processor/charge.rb | app/models/pay/fake_processor/charge.rb | module Pay
module FakeProcessor
class Charge < Pay::Charge
def self.sync(processor_id)
true
end
def api_record
self
end
def refund!(amount_to_refund = nil)
update(amount_refunded: amount_to_refund || amount)
end
end
end
end
ActiveSupport.run_loa... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/braintree/subscription.rb | app/models/pay/braintree/subscription.rb | module Pay
module Braintree
class Subscription < Pay::Subscription
def self.sync(subscription_id, object: nil, name: nil, try: 0, retries: 1)
object ||= Pay.braintree_gateway.subscription.find(subscription_id)
# Retrieve Pay::Customer
payment_method = Pay.braintree_gateway.payment_m... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/braintree/customer.rb | app/models/pay/braintree/customer.rb | module Pay
module Braintree
class Customer < Pay::Customer
has_many :charges, dependent: :destroy, class_name: "Pay::Braintree::Charge"
has_many :subscriptions, dependent: :destroy, class_name: "Pay::Braintree::Subscription"
has_many :payment_methods, dependent: :destroy, class_name: "Pay::Brain... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/braintree/payment_method.rb | app/models/pay/braintree/payment_method.rb | module Pay
module Braintree
class PaymentMethod < Pay::PaymentMethod
def self.sync(id, object: nil, try: 0, retries: 1)
object ||= Pay.braintree_gateway.payment_method.find(id)
pay_customer = Pay::Braintree::Customer.find_by(processor_id: object.customer_id)
return unless pay_custom... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/braintree/charge.rb | app/models/pay/braintree/charge.rb | module Pay
module Braintree
class Charge < Pay::Charge
def self.sync(charge_id, object: nil, try: 0, retries: 1)
object ||= Pay.braintree_gateway.transaction.find(charge_id)
pay_customer = Pay::Customer.find_by(processor: :braintree, processor_id: object.customer_details.id)
return ... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/lemon_squeezy/subscription.rb | app/models/pay/lemon_squeezy/subscription.rb | module Pay
module LemonSqueezy
class Subscription < Pay::Subscription
def self.sync(subscription_id, object: nil, name: Pay.default_product_name)
object ||= ::LemonSqueezy::Subscription.retrieve(id: subscription_id)
pay_customer = Pay::Customer.find_by(processor: :lemon_squeezy, processor_i... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/lemon_squeezy/customer.rb | app/models/pay/lemon_squeezy/customer.rb | module Pay
module LemonSqueezy
class Customer < Pay::Customer
include Pay::Routing
has_many :charges, dependent: :destroy, class_name: "Pay::LemonSqueezy::Charge"
has_many :subscriptions, dependent: :destroy, class_name: "Pay::LemonSqueezy::Subscription"
has_many :payment_methods, depende... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/lemon_squeezy/payment_method.rb | app/models/pay/lemon_squeezy/payment_method.rb | module Pay
module LemonSqueezy
class PaymentMethod < Pay::PaymentMethod
def self.sync(pay_customer:, attributes:)
return unless pay_customer.subscription
payment_method = pay_customer.default_payment_method || pay_customer.build_default_payment_method
payment_method.processor_id ||=... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/lemon_squeezy/charge.rb | app/models/pay/lemon_squeezy/charge.rb | module Pay
module LemonSqueezy
class Charge < Pay::Charge
# LemonSqueezy uses Order for one-time payments and Order + Subscription + SubscriptionInvoice for subscriptions
def self.sync_order(order_id, object: nil, try: 0, retries: 1)
object ||= ::LemonSqueezy::Order.retrieve(id: order_id)
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/stripe/subscription.rb | app/models/pay/stripe/subscription.rb | module Pay
module Stripe
class Subscription < Pay::Subscription
attr_writer :api_record
def self.sync_from_checkout_session(session_id, stripe_account: nil)
checkout_session = ::Stripe::Checkout::Session.retrieve({id: session_id}, {stripe_account: stripe_account}.compact)
sync(checkou... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/stripe/customer.rb | app/models/pay/stripe/customer.rb | module Pay
module Stripe
class Customer < Pay::Customer
include Pay::Routing
has_many :charges, dependent: :destroy, class_name: "Pay::Stripe::Charge"
has_many :subscriptions, dependent: :destroy, class_name: "Pay::Stripe::Subscription"
has_many :payment_methods, dependent: :destroy, clas... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/stripe/merchant.rb | app/models/pay/stripe/merchant.rb | module Pay
module Stripe
class Merchant < Pay::Merchant
def create_account(**options)
stripe_account = ::Stripe::Account.create(options)
update(processor_id: stripe_account.id)
stripe_account
rescue ::Stripe::StripeError => e
raise Pay::Stripe::Error, e
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/stripe/payment_method.rb | app/models/pay/stripe/payment_method.rb | module Pay
module Stripe
class PaymentMethod < Pay::PaymentMethod
# Syncs a PaymentIntent's payment method to the database
def self.sync_payment_intent(id, stripe_account: nil)
payment_intent = ::Stripe::PaymentIntent.retrieve({id: id, expand: ["payment_method"]}, {stripe_account: stripe_accou... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/stripe/charge.rb | app/models/pay/stripe/charge.rb | module Pay
module Stripe
class Charge < Pay::Charge
EXPAND = ["balance_transaction", "payment_intent", "refunds.data.balance_transaction"]
delegate :amount_captured, :payment_intent, to: :stripe_object, allow_nil: true
store_accessor :data, :stripe_invoice
store_accessor :data, :stripe_r... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_billing/subscription.rb | app/models/pay/paddle_billing/subscription.rb | module Pay
module PaddleBilling
class Subscription < Pay::Subscription
store_accessor :data, :paddle_update_url
store_accessor :data, :paddle_cancel_url
def self.sync_from_transaction(transaction_id)
transaction = ::Paddle::Transaction.retrieve(id: transaction_id)
sync(transacti... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_billing/customer.rb | app/models/pay/paddle_billing/customer.rb | module Pay
module PaddleBilling
class Customer < Pay::Customer
has_many :charges, dependent: :destroy, class_name: "Pay::PaddleBilling::Charge"
has_many :subscriptions, dependent: :destroy, class_name: "Pay::PaddleBilling::Subscription"
has_many :payment_methods, dependent: :destroy, class_name:... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_billing/payment_method.rb | app/models/pay/paddle_billing/payment_method.rb | module Pay
module PaddleBilling
class PaymentMethod < Pay::PaymentMethod
def self.sync_from_transaction(pay_customer:, transaction:)
transaction = ::Paddle::Transaction.retrieve(id: transaction)
return unless transaction.status == "completed"
return if transaction.payments.empty?
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_billing/charge.rb | app/models/pay/paddle_billing/charge.rb | module Pay
module PaddleBilling
class Charge < Pay::Charge
store_accessor :data, :paddle_receipt_url
def self.sync(charge_id, object: nil, try: 0, retries: 1)
# Skip loading the latest charge details from the API if we already have it
object ||= ::Paddle::Transaction.retrieve(id: char... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_classic/subscription.rb | app/models/pay/paddle_classic/subscription.rb | module Pay
module PaddleClassic
class Subscription < Pay::Subscription
store_accessor :data, :paddle_update_url
store_accessor :data, :paddle_cancel_url
def self.sync(subscription_id, object: nil, name: Pay.default_product_name)
# Passthrough is not return from this API, so we can't use... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_classic/customer.rb | app/models/pay/paddle_classic/customer.rb | module Pay
module PaddleClassic
class Customer < Pay::Customer
has_many :charges, dependent: :destroy, class_name: "Pay::PaddleClassic::Charge"
has_many :subscriptions, dependent: :destroy, class_name: "Pay::PaddleClassic::Subscription"
has_many :payment_methods, dependent: :destroy, class_name:... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_classic/payment_method.rb | app/models/pay/paddle_classic/payment_method.rb | module Pay
module PaddleClassic
class PaymentMethod < Pay::PaymentMethod
# Paddle doesn't provide PaymentMethod IDs, so we have to lookup via the Customer
def self.sync(pay_customer:, attributes: nil)
return unless pay_customer.subscription
payment_method = pay_customer.default_paymen... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/paddle_classic/charge.rb | app/models/pay/paddle_classic/charge.rb | module Pay
module PaddleClassic
class Charge < Pay::Charge
store_accessor :data, :paddle_receipt_url
def api_record
return unless customer.subscription
payments = PaddleClassic.client.payments.list(subscription_id: customer.subscription.processor_id)
charges = payments.data.s... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/mailers/pay/application_mailer.rb | app/mailers/pay/application_mailer.rb | module Pay
class ApplicationMailer < ActionMailer::Base
def self.default_from_address
Pay.support_email || ::ApplicationMailer.default_params[:from]
end
default from: default_from_address
layout "mailer"
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/mailers/pay/user_mailer.rb | app/mailers/pay/user_mailer.rb | module Pay
class UserMailer < Pay.parent_mailer.constantize
def receipt
if params[:pay_charge].respond_to? :receipt
attachments[params[:pay_charge].filename] = params[:pay_charge].receipt
end
mail mail_arguments
end
def refund
mail mail_arguments
end
def subscrip... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/db/migrate/20250415151129_add_object_to_pay_models.rb | db/migrate/20250415151129_add_object_to_pay_models.rb | class AddObjectToPayModels < ActiveRecord::Migration[6.0]
def change
add_column :pay_charges, :object, Pay::Adapter.json_column_type
add_column :pay_customers, :object, Pay::Adapter.json_column_type
add_column :pay_subscriptions, :object, Pay::Adapter.json_column_type
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/db/migrate/2_add_pay_sti_columns.rb | db/migrate/2_add_pay_sti_columns.rb | class AddPayStiColumns < ActiveRecord::Migration[6.0]
def change
add_column :pay_customers, :type, :string
add_column :pay_charges, :type, :string
add_column :pay_subscriptions, :type, :string
rename_column :pay_payment_methods, :type, :payment_method_type
add_column :pay_payment_methods, :type, ... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/db/migrate/1_create_pay_tables.rb | db/migrate/1_create_pay_tables.rb | class CreatePayTables < ActiveRecord::Migration[6.0]
def change
primary_key_type, foreign_key_type = primary_and_foreign_key_types
create_table :pay_customers, id: primary_key_type do |t|
t.belongs_to :owner, polymorphic: true, index: false, type: foreign_key_type
t.string :processor, null: false... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay_test.rb | test/pay_test.rb | require "test_helper"
class Pay::Test < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Pay
end
test "default automount_routes is true" do
assert Pay.automount_routes, true
end
test "default routes_path is /pay" do
assert Pay.routes_path, "/pay"
end
test "can set business na... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/test_helper.rb | test/test_helper.rb | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
# Configure all the payment providers for testing
ENV["STRIPE_PRIVATE_KEY"] ||= "sk_test_fake"
ENV["STRIPE_SIGNING_SECRET"] ||= "whsec_x"
# Paddle Classic configuration
require "openssl"
require "base64"
paddle_public_key = OpenSSL::PKey::RSA.new(File.read("test... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/jobs/pay/customer_sync_job_test.rb | test/jobs/pay/customer_sync_job_test.rb | require "test_helper"
module Pay
class CustomerSyncJobTest < ActiveJob::TestCase
test "sync customer with stripe" do
::Stripe::Customer.expects(:update)
Pay::CustomerSyncJob.perform_now(pay_customers(:stripe).id)
end
test "sync customer with braintree" do
::Braintree::CustomerGateway.a... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/support/vcr.rb | test/support/vcr.rb | require "webmock/minitest"
VCR.configure do |c|
c.cassette_library_dir = "test/vcr_cassettes"
c.hook_into :webmock
c.allow_http_connections_when_no_cassette = true
c.filter_sensitive_data("<VENDOR_ID>") { ENV["PADDLE_CLASSIC_VENDOR_ID"] }
c.filter_sensitive_data("<VENDOR_AUTH_CODE>") { ENV["PADDLE_CLASSIC_VE... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/support/braintree.rb | test/support/braintree.rb | # Braintree configuration
Pay.braintree_gateway = Braintree::Gateway.new(
environment: :sandbox,
merchant_id: "zyfwpztymjqdcc5g",
public_key: "5r59rrxhn89npc9n",
private_key: "00f0df79303e1270881e5feda7788927"
)
logger = Logger.new(File::NULL)
logger.level = Logger::INFO
Pay.braintree_gateway.config.logger = l... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/support/stripe.rb | test/support/stripe.rb | class ActiveSupport::TestCase
private
def fake_stripe_payment_method(**values)
values.reverse_merge!(
id: "pm_123",
object: "payment_method",
billing_details: {
address: {
city: nil,
country: nil,
line1: nil,
line2: nil,
postal_code: "... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/support/payment_method_tests.rb | test/support/payment_method_tests.rb | module PaymentMethodTests
extend ActiveSupport::Concern
included do
test "make_default! syncs database" do
# Create a default payment method
pm1 = @pay_customer.payment_methods.create!(
processor_id: "pm_default",
payment_method_type: "card",
default: true
)
# C... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/controllers/pay/webhooks/paddle_billing_controller_test.rb | test/controllers/pay/webhooks/paddle_billing_controller_test.rb | require "test_helper"
module Pay
class PaddleBillingControllerTest < ActionDispatch::IntegrationTest
include Engine.routes.url_helpers
setup do
@routes = Engine.routes
end
test "should handle post requests" do
post webhooks_paddle_billing_path
assert_response :bad_request
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/controllers/pay/webhooks/lemon_squeezy_controller_test.rb | test/controllers/pay/webhooks/lemon_squeezy_controller_test.rb | require "test_helper"
module Pay
class LemonSqueezyControllerTest < ActionDispatch::IntegrationTest
include Engine.routes.url_helpers
setup do
@routes = Engine.routes
end
test "should handle post requests" do
post webhooks_lemon_squeezy_path
assert_response :bad_request
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/controllers/pay/webhooks/paddle_classic_controller_test.rb | test/controllers/pay/webhooks/paddle_classic_controller_test.rb | require "test_helper"
module Pay
class PaddleClassicControllerTest < ActionDispatch::IntegrationTest
include Engine.routes.url_helpers
setup do
@routes = Engine.routes
end
test "should handle post requests" do
post webhooks_paddle_classic_path
assert_response :bad_request
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/controllers/pay/webhooks/stripe_controller_test.rb | test/controllers/pay/webhooks/stripe_controller_test.rb | require "test_helper"
module Pay
class StripeWebhooksControllerTest < ActionDispatch::IntegrationTest
include Engine.routes.url_helpers
setup do
@routes = Engine.routes
end
test "should handle stripe post requests" do
post webhooks_stripe_path
assert_response :bad_request
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/controllers/pay/webhooks/braintree_controller_test.rb | test/controllers/pay/webhooks/braintree_controller_test.rb | require "test_helper"
module Pay
class BraintreeWebhooksControllerTest < ActionDispatch::IntegrationTest
include Engine.routes.url_helpers
setup do
@routes = Engine.routes
end
test "should handle post requests" do
post webhooks_braintree_path
assert_response :bad_request
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/attributes_test.rb | test/pay/attributes_test.rb | require "test_helper"
class Pay::AttributesTest < ActiveSupport::TestCase
test "set payment processor" do
user = users(:none)
refute user.payment_processor
assert_difference "Pay::Customer.count" do
user.set_payment_processor :stripe
end
assert user.payment_processor
end
test "set pa... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/currency_test.rb | test/pay/currency_test.rb | require "test_helper"
class Pay::Currency::Test < ActiveSupport::TestCase
test "formats amounts in different currencies" do
assert_equal "$15.39", Pay::Currency.format(15_39, currency: :usd)
assert_equal "1 539 Ft", Pay::Currency.format(15_39, currency: :huf)
assert_equal "€15,39", Pay::Currency.format(1... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/adapter_test.rb | test/pay/adapter_test.rb | require "test_helper"
class Pay::Adapter::Test < ActiveSupport::TestCase
test "current_adapter returns adapter as string" do
assert_includes %w[postgresql mysql2 sqlite3], Pay::Adapter.current_adapter
end
test "jsonb for postgres" do
Pay::Adapter.stub(:current_adapter, "postgresql") do
assert_equa... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/customer_test.rb | test/pay/customer_test.rb | require "test_helper"
class Pay::CustomerTest < ActiveSupport::TestCase
setup do
@user = users(:fake)
end
test "customer name" do
assert_equal "Fake User", @user.payment_processor.customer_name
end
test "customer with a pay_customer_name" do
@user.define_singleton_method(:pay_customer_name) { "... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/payment_test.rb | test/pay/payment_test.rb | require "test_helper"
class Pay::Payment::Test < ActiveSupport::TestCase
test "amount_with_currency" do
fake_payment_intent = ActiveSupport::InheritableOptions.new(amount: 12_34, currency: "usd")
assert_equal "$12.34", Pay::Payment.new(fake_payment_intent).amount_with_currency
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/fake_processor/payment_method_test.rb | test/pay/fake_processor/payment_method_test.rb | require "test_helper"
class Pay::FakeProcessor::PaymentMethodTest < ActiveSupport::TestCase
include PaymentMethodTests
setup do
@pay_customer = pay_customers(:fake)
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/fake_processor/charge_test.rb | test/pay/fake_processor/charge_test.rb | require "test_helper"
class Pay::FakeProcessor::Charge::Test < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:fake)
@charge = @pay_customer.charge(10_00)
end
test "fake processor api_record" do
assert_equal @charge, @charge.api_record
assert_equal "card", @charge.payment_method_... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/fake_processor/customer_test.rb | test/pay/fake_processor/customer_test.rb | require "test_helper"
class Pay::FakeProcessor::CustomerTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:fake)
end
test "doesn't allow fake processor by default" do
assert_raises Pay::Error do
users(:none).set_payment_processor :fake_processor
end
end
test "allows fa... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/fake_processor/subscription_test.rb | test/pay/fake_processor/subscription_test.rb | require "test_helper"
class Pay::FakeProcessor::Subscription::Test < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:fake)
@subscription = @pay_customer.subscribe
end
test "fake processor subscription" do
assert_equal @subscription, @subscription.api_record
end
test "fake proces... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/billable/sync_customer_test.rb | test/pay/billable/sync_customer_test.rb | require "test_helper"
class Pay::Billable::SyncCustomer::Test < ActiveSupport::TestCase
include ActiveJob::TestHelper
test "customer sync only on updating customer email" do
assert_no_enqueued_jobs do
User.create(email: "test@example.com")
end
assert_enqueued_with(job: Pay::CustomerSyncJob, arg... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/error_test.rb | test/pay/braintree/error_test.rb | require "test_helper"
class Pay::Braintree::ErrorTest < ActiveSupport::TestCase
test "raising braintree failures keep the same message" do
pay_customer = pay_customers(:braintree)
pay_customer.update(processor_id: nil)
exception = assert_raises(Pay::Braintree::Error) { pay_customer.charge(0) }
assert... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/payment_method_test.rb | test/pay/braintree/payment_method_test.rb | require "test_helper"
class Pay::Braintree::PaymentMethodTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:braintree)
end
test "make_default! updates Braintree and syncs database" do
# Create a default payment method
pm1 = @pay_customer.payment_methods.create!(
processor_i... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/charge_test.rb | test/pay/braintree/charge_test.rb | require "test_helper"
require "minitest/mock"
class Pay::Braintree::Charge::Test < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:braintree)
@pay_customer.update(processor_id: nil)
@pay_customer.charges.delete_all
@pay_customer.payment_methods.delete_all
@pay_customer.subscriptio... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/customer_test.rb | test/pay/braintree/customer_test.rb | require "test_helper"
require "minitest/mock"
class Pay::Braintree::CustomerTest < ActiveSupport::TestCase
setup do
@pay_customer = Pay::Braintree::Customer.create!(processor: :braintree, owner: users(:none))
end
test "braintree customer" do
braintree_customer = @pay_customer.api_record
assert brain... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/subscription_test.rb | test/pay/braintree/subscription_test.rb | require "test_helper"
class Pay::Braintree::SubscriptionTest < ActiveSupport::TestCase
setup do
@pay_customer = Pay::Braintree::Customer.create!(processor: :braintree, owner: users(:none))
@pay_customer.update_payment_method "fake-valid-visa-nonce"
end
test "braintree cancel" do
travel_to(VCR.curren... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/webhooks/subscription_canceled_test.rb | test/pay/braintree/webhooks/subscription_canceled_test.rb | require "test_helper"
class Pay::Braintree::Webhooks::SubscriptionCanceledTest < ActiveSupport::TestCase
setup do
@event = braintree_event "subscription_cancelled"
end
test "braintree syncs subscription on cancelled webhook" do
Pay::Braintree::Subscription.expects(:sync)
Pay::Braintree::Webhooks::Su... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/webhooks/subscription_charged_successfully_test.rb | test/pay/braintree/webhooks/subscription_charged_successfully_test.rb | require "test_helper"
class Pay::Braintree::Webhooks::SubscriptionChargedSuccessfullyTest < ActiveSupport::TestCase
setup do
@event = braintree_event "subscription_charged_successfully"
end
test "it sets ends_at on the subscription" do
pay_customer = pay_customers(:braintree)
pay_customer.update(pro... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/braintree/webhooks/subscription_trial_ended_test.rb | test/pay/braintree/webhooks/subscription_trial_ended_test.rb | require "test_helper"
class Pay::Braintree::Webhooks::SubscriptionTrialEndedTest < ActiveSupport::TestCase
setup do
@event = braintree_event "subscription_trial_ended"
end
test "braintree syncs subscription on trial ended webhook" do
Pay::Braintree::Subscription.expects(:sync)
Pay::Braintree::Webhoo... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/lemon_squeezy/error_test.rb | test/pay/lemon_squeezy/error_test.rb | require "test_helper"
class Pay::LemonSqueezy::ErrorTest < ActiveSupport::TestCase
test "re-raised lemon squeezy exceptions keep the same message" do
exception = assert_raises {
begin
raise ::LemonSqueezy::Error, "The connection failed"
rescue
raise ::Pay::LemonSqueezy::Error
en... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/lemon_squeezy/payment_method_test.rb | test/pay/lemon_squeezy/payment_method_test.rb | require "test_helper"
class Pay::LemonSqueezy::PaymentMethodTest < ActiveSupport::TestCase
include PaymentMethodTests
setup do
@pay_customer = pay_customers(:lemon_squeezy)
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/lemon_squeezy/webhooks_test.rb | test/pay/lemon_squeezy/webhooks_test.rb | require "test_helper"
class Pay::LemonSqueezy::WebhooksTest < ActiveSupport::TestCase
test "lemon squeezy webhook metadata" do
fixture = json_fixture("lemon_squeezy/order_created")
object = Pay::LemonSqueezy.construct_from_webhook_event fixture
assert_equal ::LemonSqueezy::Order, object.class
assert_... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/lemon_squeezy/customer_test.rb | test/pay/lemon_squeezy/customer_test.rb | require "test_helper"
class Pay::LemonSqueezy::CustomerTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:lemon_squeezy)
end
test "lemon squeezy cannot create a charge" do
assert_raises(Pay::Error) { @pay_customer.charge(1000) }
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/lemon_squeezy/subscription_test.rb | test/pay/lemon_squeezy/subscription_test.rb | require "test_helper"
class Pay::LemonSqueezy::Subscription::Test < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:lemon_squeezy)
end
test "lemon squeezy api_record" do
assert_equal @pay_customer.subscription.api_record.class, ::LemonSqueezy::Subscription
assert_equal "active", @pay... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/error_test.rb | test/pay/stripe/error_test.rb | require "test_helper"
class Pay::Stripe::ErrorTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:stripe)
@pay_customer.update(processor_id: nil)
@pay_customer.payment_methods.destroy_all
end
test "re-raised stripe exceptions keep the same message" do
exception = assert_raises... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/payment_method_test.rb | test/pay/stripe/payment_method_test.rb | require "test_helper"
class Pay::Stripe::PaymentMethodTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:stripe)
end
test "Stripe sync returns Pay::PaymentMethod" do
::Stripe::Customer.stubs(:retrieve).returns(::Stripe::Customer.construct_from(invoice_settings: {default_payment_metho... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/charge_test.rb | test/pay/stripe/charge_test.rb | require "test_helper"
class Pay::Stripe::ChargeTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:stripe)
end
test "sync returns Pay::Charge" do
::Stripe::InvoicePayment.stubs(:list).returns([])
pay_charge = Pay::Stripe::Charge.sync("123", object: fake_stripe_charge)
assert p... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/processor_test.rb | test/pay/stripe/processor_test.rb | require "test_helper"
class Pay::Stripe::ProcessorTest < ActiveSupport::TestCase
test "finds API keys from env" do
old_env = ENV.to_hash
ENV.update(
"STRIPE_PUBLIC_KEY" => "public",
"STRIPE_PRIVATE_KEY" => "private",
"STRIPE_SIGNING_SECRET" => "secret",
"STRIPE_WEBHOOK_RECEIVE_TEST_EV... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/merchant_test.rb | test/pay/stripe/merchant_test.rb | require "test_helper"
class Pay::Stripe::ConnectTest < ActiveSupport::TestCase
setup do
@stripe_account_id = "acct_1ISuLNQK2ZHS99Rk"
@user = User.create!(email: "gob@bluth.com")
@pay_customer = @user.set_payment_processor :stripe, stripe_account: @stripe_account_id
@pay_customer.update_payment_method... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/customer_test.rb | test/pay/stripe/customer_test.rb | require "test_helper"
class Pay::Stripe::CustomerTest < ActiveSupport::TestCase
setup do
@user = users(:stripe)
@pay_customer = @user.payment_processor
@pay_customer.update(processor_id: nil)
end
test "stripe creates customer and assigns processor_id" do
assert_nil @pay_customer.processor_id
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/checkout_test.rb | test/pay/stripe/checkout_test.rb | require "test_helper"
class Pay::Stripe::CheckoutTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:stripe)
@pay_customer.update(processor_id: nil)
end
test "checkout success_url includes session_id" do
session = @pay_customer.checkout(mode: "setup")
assert_equal "http://loca... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/subscription_test.rb | test/pay/stripe/subscription_test.rb | require "test_helper"
class Pay::Stripe::SubscriptionTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:stripe)
end
test "stripe sync skips subscription without customer" do
@pay_customer.update!(processor_id: nil)
pay_subscription = Pay::Stripe::Subscription.sync("123", object: ... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/payment_method_detached_test.rb | test/pay/stripe/webhooks/payment_method_detached_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::PaymentMethodDetachedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("payment_method.detached")
end
test "payment_method.detached removes payment method from database" do
assert_difference "Pay::PaymentMethod.count", -1 do
Pay::Strip... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/charge_refunded_test.rb | test/pay/stripe/webhooks/charge_refunded_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::ChargeRefundedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("charge.refunded")
pay_charges(:stripe).update(id: @event.data.object.id)
pay_customers(:stripe).update(processor_id: @event.data.object.customer)
end
test "a charge is upda... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/subscription_renewing_test.rb | test/pay/stripe/webhooks/subscription_renewing_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::SubscriptionRenewingTest < ActiveSupport::TestCase
setup do
@event = stripe_event("invoice.upcoming")
@invoice = @event.data.object
@pay_customer = pay_customers(:stripe)
@pay_customer.update(processor_id: @event.data.object.customer)
end
test "... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/payment_failed_test.rb | test/pay/stripe/webhooks/payment_failed_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::PaymentFailedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("invoice.payment_failed")
@pay_customer = pay_customers(:stripe)
@pay_customer.update(processor_id: @event.data.object.customer)
end
test "customer should receive payment fai... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/account_updated_test.rb | test/pay/stripe/webhooks/account_updated_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::AccountUpdatedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("account.updated")
end
test "an account is authorized" do
account = Account.create!
account.set_merchant_processor :stripe
account.merchant_processor.update processor_id... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/payment_method_updated_test.rb | test/pay/stripe/webhooks/payment_method_updated_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::PaymentMethodUpdatedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("payment_method.updated")
end
test "updates payment method in database" do
payment_method = pay_payment_methods(:one)
# Spoof Stripe PaymentMethod lookup
fake_pay... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/subscription_updated_test.rb | test/pay/stripe/webhooks/subscription_updated_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::SubscriptionUpdatedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("subscription.updated")
@pay_customer = pay_customers(:stripe)
@pay_customer.update(processor_id: @event.data.object.customer)
end
test "nothing happens if a owner can'... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/customer_updated_test.rb | test/pay/stripe/webhooks/customer_updated_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::CustomerUpdatedTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:stripe)
end
test "removes default payment method if default payment method set to null" do
event = stripe_event("customer.updated")
Pay::Stripe::Customer.any_insta... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/subscription_deleted_test.rb | test/pay/stripe/webhooks/subscription_deleted_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::SubscriptionDeletedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("subscription.deleted")
end
test "syncs subscription" do
Pay::Stripe::Subscription.expects(:sync)
Pay::Stripe::Webhooks::SubscriptionDeleted.new.call(@event)
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/charge_updated_test.rb | test/pay/stripe/webhooks/charge_updated_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::ChargeUpdatedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("charge.updated")
end
test "a charge is created" do
pay_customers(:stripe).update(processor_id: @event.data.object.customer)
::Stripe::Charge.expects(:retrieve).returns(@eve... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/checkout_session_completed_test.rb | test/pay/stripe/webhooks/checkout_session_completed_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::CheckoutSessionCompletedTest < ActiveSupport::TestCase
test "creates Pay::Customer if client_reference_id present and valid" do
client_reference_id = Pay::Stripe.to_client_reference_id(users(:none))
event = stripe_event("checkout.session.completed", override... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/payment_action_required_test.rb | test/pay/stripe/webhooks/payment_action_required_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::PaymentActionRequiredTest < ActiveSupport::TestCase
setup do
@event = stripe_event("invoice.payment_action_required")
# Create user and subscription
pay_customers(:stripe).update!(processor_id: @event.data.object.customer)
end
test "it sends an ema... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/subscription_created_test.rb | test/pay/stripe/webhooks/subscription_created_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::SubscriptionCreatedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("subscription.created")
end
test "subscription is created" do
Pay::Stripe::Subscription.expects(:sync)
Pay::Stripe::Webhooks::SubscriptionCreated.new.call(@event)
end... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/customer_deleted_test.rb | test/pay/stripe/webhooks/customer_deleted_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::CustomerDeletedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("customer.deleted")
end
test "stripe customer delete marks pay customer deleted" do
pay_customer = pay_customers(:stripe)
pay_customer.update!(processor_id: @event.data.obj... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/charge_succeeded_test.rb | test/pay/stripe/webhooks/charge_succeeded_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::ChargeSucceededTest < ActiveSupport::TestCase
setup do
@event = stripe_event("charge.succeeded")
end
test "a charge is created" do
pay_customers(:stripe).update(processor_id: @event.data.object.customer)
::Stripe::Charge.expects(:retrieve).returns(... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/payment_method_attached_test.rb | test/pay/stripe/webhooks/payment_method_attached_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::PaymentMethodAttachedTest < ActiveSupport::TestCase
setup do
@event = stripe_event("payment_method.attached")
end
test "payment_method.attached removes payment method from database" do
::Stripe::PaymentMethod.expects(:retrieve).returns(@event.data.objec... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/stripe/webhooks/subscription_trial_will_end_test.rb | test/pay/stripe/webhooks/subscription_trial_will_end_test.rb | require "test_helper"
class Pay::Stripe::Webhooks::SubscriptionTrialWillEndTest < ActiveSupport::TestCase
setup do
@trial_will_end_event = stripe_event("subscription.trial_will_end")
@trial_ended_event = stripe_event("subscription.trial_ended")
@pay_customer = pay_customers(:stripe)
@pay_customer.upd... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/webhooks/delegator_test.rb | test/pay/webhooks/delegator_test.rb | require "test_helper"
class Pay::WebhookDelegatorTest < ActiveSupport::TestCase
class TestEventProcessor
attr_accessor :success
def call(event)
@success = true
end
end
setup do
@delegator = Pay::Webhooks::Delegator.new
end
test "pay has a default delegator" do
assert_not_nil Pay:... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_billing/error_test.rb | test/pay/paddle_billing/error_test.rb | require "test_helper"
class Pay::PaddleBilling::ErrorTest < ActiveSupport::TestCase
test "re-raised paddle classic exceptions keep the same message" do
exception = assert_raises {
begin
raise ::Paddle::Error, "The connection failed"
rescue
raise ::Pay::PaddleBilling::Error
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_billing/payment_method_test.rb | test/pay/paddle_billing/payment_method_test.rb | require "test_helper"
class Pay::PaddleBilling::PaymentMethodTest < ActiveSupport::TestCase
include PaymentMethodTests
setup do
@pay_customer = pay_customers(:paddle_billing)
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_billing/customer_test.rb | test/pay/paddle_billing/customer_test.rb | require "test_helper"
class Pay::PaddleBilling::CustomerTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:paddle_billing)
end
test "paddle cannot create a charge without options" do
assert_raises(Paddle::Errors::ForbiddenError) { @pay_customer.charge(1000) }
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_billing/subscription_test.rb | test/pay/paddle_billing/subscription_test.rb | require "test_helper"
class Pay::PaddleBilling::Subscription::Test < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:paddle_billing)
end
test "paddle billing processor subscription" do
assert_equal @pay_customer.subscription.api_record.class, ::Paddle::Subscription
assert_equal "acti... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_classic/error_test.rb | test/pay/paddle_classic/error_test.rb | require "test_helper"
class Pay::PaddleClassic::ErrorTest < ActiveSupport::TestCase
test "re-raised paddle classic exceptions keep the same message" do
exception = assert_raises {
begin
raise ::Paddle::Error, "The connection failed"
rescue
raise ::Pay::PaddleClassic::Error
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_classic/payment_method_test.rb | test/pay/paddle_classic/payment_method_test.rb | require "test_helper"
class Pay::PaddleClassic::PaymentMethodTest < ActiveSupport::TestCase
include PaymentMethodTests
setup do
@pay_customer = pay_customers(:paddle_classic)
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_classic/charge_test.rb | test/pay/paddle_classic/charge_test.rb | require "test_helper"
class Pay::PaddleClassic::Charge::Test < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:paddle_classic)
end
test "paddle classic can get paddle charge" do
charge = @pay_customer.charges.create!(
processor_id: "11018517",
amount: 119,
payment_metho... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/test/pay/paddle_classic/customer_test.rb | test/pay/paddle_classic/customer_test.rb | require "test_helper"
class Pay::PaddleClassic::CustomerTest < ActiveSupport::TestCase
setup do
@pay_customer = pay_customers(:paddle_classic)
end
test "paddle classic can create a charge" do
charge = @pay_customer.charge(1000, {charge_name: "Test"})
assert_equal Pay::PaddleClassic::Charge, charge.c... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.