remove payments
This commit is contained in:
parent
bdb5883d6a
commit
098b58c60c
|
@ -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
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Payment < ActiveRecord::Base
|
|
||||||
end
|
|
|
@ -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
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue