|
Lines 248-254
subtest 'get() tests' => sub {
Link Here
|
| 248 |
|
248 |
|
| 249 |
subtest 'add() tests' => sub { |
249 |
subtest 'add() tests' => sub { |
| 250 |
|
250 |
|
| 251 |
plan tests => 17; |
251 |
plan tests => 27; |
| 252 |
|
252 |
|
| 253 |
$schema->storage->txn_begin; |
253 |
$schema->storage->txn_begin; |
| 254 |
|
254 |
|
|
Lines 330-335
subtest 'add() tests' => sub {
Link Here
|
| 330 |
->json_like( '/conflict' => qr/(aqorders\.)?PRIMARY/ ); } |
330 |
->json_like( '/conflict' => qr/(aqorders\.)?PRIMARY/ ); } |
| 331 |
qr/DBD::mysql::st execute failed: Duplicate entry '(.*)' for key '(aqorders\.)?PRIMARY'/; |
331 |
qr/DBD::mysql::st execute failed: Duplicate entry '(.*)' for key '(aqorders\.)?PRIMARY'/; |
| 332 |
|
332 |
|
|
|
333 |
# Check that prices are correctly populated |
| 334 |
my $order_without_prices = { |
| 335 |
basket_id => $order->{basket_id}, |
| 336 |
biblio_id => $order->{biblio_id}, |
| 337 |
fund_id => $order->{fund_id}, |
| 338 |
quantity => 1, |
| 339 |
tax_rate_on_ordering => '0.5', |
| 340 |
tax_rate_on_receiving => '0.5', |
| 341 |
unit_price => 4.20, |
| 342 |
rrp => 4.20, |
| 343 |
discount_rate => 0.10, |
| 344 |
}; |
| 345 |
|
| 346 |
$order_obj->basket->bookseller->listincgst(0)->invoiceincgst(0)->store(); |
| 347 |
$t->post_ok("//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order_without_prices) |
| 348 |
->status_is(201) |
| 349 |
->json_is('/tax_value_on_ordering', '2.1') |
| 350 |
->json_is('/tax_value_on_receiving', '2.1') |
| 351 |
->json_is('/rrp_tax_included', '6.3') |
| 352 |
->json_is('/rrp_tax_excluded', '4.2') |
| 353 |
->json_is('/unit_price_tax_included', '6.3') |
| 354 |
->json_is('/unit_price_tax_excluded', '4.2') |
| 355 |
->json_is('/ecost_tax_included', '5.67') |
| 356 |
->json_is('/ecost_tax_excluded', '3.78'); |
| 357 |
|
| 333 |
$schema->storage->txn_rollback; |
358 |
$schema->storage->txn_rollback; |
| 334 |
}; |
359 |
}; |
| 335 |
|
360 |
|
| 336 |
- |
|
|