|
Lines 272-278
subtest 'get() tests' => sub {
Link Here
|
| 272 |
|
272 |
|
| 273 |
subtest 'add() tests' => sub { |
273 |
subtest 'add() tests' => sub { |
| 274 |
|
274 |
|
| 275 |
plan tests => 17; |
275 |
plan tests => 27; |
| 276 |
|
276 |
|
| 277 |
$schema->storage->txn_begin; |
277 |
$schema->storage->txn_begin; |
| 278 |
|
278 |
|
|
Lines 354-359
subtest 'add() tests' => sub {
Link Here
|
| 354 |
->json_like( '/conflict' => qr/(aqorders\.)?PRIMARY/ ); } |
354 |
->json_like( '/conflict' => qr/(aqorders\.)?PRIMARY/ ); } |
| 355 |
qr/DBD::mysql::st execute failed: Duplicate entry '(.*)' for key '(aqorders\.)?PRIMARY'/; |
355 |
qr/DBD::mysql::st execute failed: Duplicate entry '(.*)' for key '(aqorders\.)?PRIMARY'/; |
| 356 |
|
356 |
|
|
|
357 |
# Check that prices are correctly populated |
| 358 |
my $order_without_prices = { |
| 359 |
basket_id => $order->{basket_id}, |
| 360 |
biblio_id => $order->{biblio_id}, |
| 361 |
fund_id => $order->{fund_id}, |
| 362 |
quantity => 1, |
| 363 |
tax_rate_on_ordering => '0.5', |
| 364 |
tax_rate_on_receiving => '0.5', |
| 365 |
unit_price => 4.20, |
| 366 |
rrp => 4.20, |
| 367 |
discount_rate => 0.10, |
| 368 |
}; |
| 369 |
|
| 370 |
$order_obj->basket->bookseller->listincgst(0)->invoiceincgst(0)->store(); |
| 371 |
$t->post_ok("//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order_without_prices) |
| 372 |
->status_is(201) |
| 373 |
->json_is('/tax_value_on_ordering', '2.1') |
| 374 |
->json_is('/tax_value_on_receiving', '2.1') |
| 375 |
->json_is('/rrp_tax_included', '6.3') |
| 376 |
->json_is('/rrp_tax_excluded', '4.2') |
| 377 |
->json_is('/unit_price_tax_included', '6.3') |
| 378 |
->json_is('/unit_price_tax_excluded', '4.2') |
| 379 |
->json_is('/ecost_tax_included', '5.67') |
| 380 |
->json_is('/ecost_tax_excluded', '3.78'); |
| 381 |
|
| 357 |
$schema->storage->txn_rollback; |
382 |
$schema->storage->txn_rollback; |
| 358 |
}; |
383 |
}; |
| 359 |
|
384 |
|
| 360 |
- |
|
|