Skip to content

Commit 4d724d4

Browse files
committed
create order price spec
1 parent 4ca8973 commit 4d724d4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

spec/integration/orders_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,32 @@
4747
expect(create_order_response.data.patch_fee_cents_usd).not_to be_empty
4848
end
4949

50+
it 'supports create with a total price' do
51+
retrieve_project_response = Patch::Project.retrieve_project(
52+
Constants::BIOMASS_TEST_PROJECT_ID
53+
)
54+
55+
project_id = retrieve_project_response.data.id
56+
total_price_cents_usd = 5_00
57+
58+
create_order_response = Patch::Order.create_order(
59+
total_price_cents_usd: total_price_cents_usd,
60+
project_id: project_id
61+
)
62+
63+
expect(create_order_response.success).to eq true
64+
65+
order = create_order_response.data
66+
67+
expect(order.id).not_to be_nil
68+
expect(order.mass_g).to eq(1_250_000)
69+
expect(order.price_cents_usd.to_i).to eq(125)
70+
expect(order.patch_fee_cents_usd.to_i).to eq(375)
71+
expect(
72+
order.price_cents_usd.to_i + order.patch_fee_cents_usd.to_i
73+
).to eq(total_price_cents_usd)
74+
end
75+
5076
it 'supports create with metadata' do
5177
metadata = { user: 'john doe' }
5278

0 commit comments

Comments
 (0)