remove payments

This commit is contained in:
Rimian Perkins 2019-11-07 15:19:48 +11:00
parent bdb5883d6a
commit 098b58c60c
4 changed files with 0 additions and 38 deletions

View File

@ -31,15 +31,6 @@ module DiscoursePatrons
metadata: { user_id: user_id } metadata: { user_id: user_id }
) )
# Payment.create(
# user_id: response[:metadata][:user_id],
# payment_intent_id: response[:id],
# receipt_email: response[:receipt_email],
# url: response[:charges][:url],
# amount: response[:amount],
# currency: response[:currency]
# )
rescue ::Stripe::InvalidRequestError => e rescue ::Stripe::InvalidRequestError => e
response = { error: e } response = { error: e }
rescue ::Stripe::CardError => e rescue ::Stripe::CardError => e

View File

@ -1,4 +0,0 @@
# frozen_string_literal: true
class Payment < ActiveRecord::Base
end

View File

@ -1,17 +0,0 @@
# frozen_string_literal: true
class CreatePaymentsTable < ActiveRecord::Migration[5.2]
def change
create_table :payments do |t|
t.string :payment_intent_id, null: false
t.string :receipt_email, null: false
t.string :currency, null: false
t.string :url, null: false
t.integer :amount, null: false
t.references :user, foreign_key: true
t.timestamps
end
add_index :payments, :payment_intent_id, unique: true
end
end

View File

@ -53,14 +53,6 @@ module DiscoursePatrons
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
xit 'creates a payment' do
::Stripe::PaymentIntent.expects(:create).returns(payment)
expect {
post :create, params: { receipt_email: 'hello@example.com', amount: '20.00' }, format: :json
}.to change { Payment.count }
end
it 'has no user' do it 'has no user' do
controller.stubs(:current_user).returns(nil) controller.stubs(:current_user).returns(nil)
::Stripe::PaymentIntent.expects(:create).returns(payment) ::Stripe::PaymentIntent.expects(:create).returns(payment)