6772312ea7
The primary license of the project is changing to: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later with some specific files to be licensed under the one of two licenses: CC0-1.0 LGPL-3.0-or-later This commit is one of the many steps to relicense the entire codebase. Documentation granting permission for this relicensing (from all past contributors who hold copyrights) is on file with Software Freedom Conservancy, Inc.
43 lines
1.7 KiB
Ruby
43 lines
1.7 KiB
Ruby
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
|
require 'rails_helper'
|
|
|
|
describe InsertDisputes, :pending => true do
|
|
before(:all) do
|
|
#@data = PsqlFixtures.init
|
|
end
|
|
|
|
describe '.create_record' do
|
|
before(:all) do
|
|
# @ch = @data['recurring_donation']['charge']
|
|
# @payment = @data['recurring_donation']['payment']
|
|
# @dispute_id = SecureRandom.uuid
|
|
# @result = InsertDisputes.create_record(@ch['stripe_charge_id'], @dispute_id)
|
|
end
|
|
|
|
it 'raises an error when the stripe charge id not found' do
|
|
expect{InsertDisputes.create_record('x', 'y')}.to raise_exception(ArgumentError)
|
|
fail
|
|
end
|
|
|
|
it 'creates a valid payment record' do
|
|
expect(@result[:payment]['fee_total']).to eq(-(@payment['fee_total']) - 1500)
|
|
expect(@result[:payment]['supporter_id']).to eq(@ch['supporter_id'])
|
|
expect(@result[:payment]['kind']).to eq('Dispute')
|
|
expect(@result[:payment]['nonprofit_id']).to eq(@ch['nonprofit_id'])
|
|
expect(@result[:payment]['gross_amount']).to eq(-@ch['amount'])
|
|
expect(@result[:payment]['net_amount']).to eq(-(@payment['gross_amount']) - @payment['fee_total'] - 1500)
|
|
expect(@result[:payment]['donation_id']).to be_present
|
|
fail
|
|
end
|
|
|
|
it 'creates a valid dispute record' do
|
|
expect(@result[:dispute]['gross_amount']).to eq(@payment['gross_amount'])
|
|
expect(@result[:dispute]['status']).to eq('needs_response')
|
|
expect(@result[:dispute]['charge_id']).to be_present
|
|
expect(@result[:dispute]['payment_id']).to eq(@result[:payment]['id'])
|
|
expect(@result[:dispute]['reason']).to eq('unrecognized')
|
|
expect(@result[:dispute]['stripe_dispute_id']).to eq(@dispute_id)
|
|
fail
|
|
end
|
|
end
|
|
end
|