test: align review evidence fixtures and verify stale request rejection
This commit is contained in:
+3
@@ -19,6 +19,7 @@ class DispatchReviewAttachmentsPersistenceTest {
|
||||
@Test void attachmentsSurviveRejectionAndEditsUntilResubmission() throws Exception {
|
||||
var f=new DispatchAggregatePersistenceTest.Fixture();
|
||||
var created=f.tx.execute(s->f.service.create(f.actor,f.configured("review-evidence",List.of(f.source(1,"101",501,"ONT8",3)))));
|
||||
f.prepareAppointmentNumbers(created.dispatchNo());
|
||||
var submitted=f.tx.execute(s->f.service.submitReview(f.actor,created.dispatchNo(),new DispatchCommands.SubmitReview(created.recordVersion(),"submit",null)));
|
||||
var before=f.repository.find(created.dispatchNo()).getResourcesJson();
|
||||
var first=new DispatchContracts.ReviewAttachments(List.of(91L),List.of(92L),List.of(93L));
|
||||
@@ -50,6 +51,7 @@ class DispatchReviewAttachmentsPersistenceTest {
|
||||
@Test void rejectsForeignKindOrMasterLicenseAndKeepsOriginalVersion() throws Exception {
|
||||
var f=new DispatchAggregatePersistenceTest.Fixture();
|
||||
var created=f.tx.execute(s->f.service.create(f.actor,f.configured("verify-evidence",List.of(f.source(1,"101",501,"ONT8",3)))));
|
||||
f.prepareAppointmentNumbers(created.dispatchNo());
|
||||
var submitted=f.tx.execute(s->f.service.submitReview(f.actor,created.dispatchNo(),new DispatchCommands.SubmitReview(created.recordVersion(),"submit",null)));
|
||||
var gateway=(DispatchEvidenceGateway)ReflectionTestUtils.getField(f.service,"evidence");
|
||||
long id=f.repository.find(created.dispatchNo()).getId();
|
||||
@@ -69,6 +71,7 @@ class DispatchReviewAttachmentsPersistenceTest {
|
||||
try {
|
||||
var f=new DispatchAggregatePersistenceTest.Fixture();
|
||||
var created=f.tx.execute(s->f.service.create(f.actor,f.configured("upload-evidence",List.of(f.source(1,"101",501,"ONT8",3)))));
|
||||
f.prepareAppointmentNumbers(created.dispatchNo());
|
||||
var file=new MockMultipartFile("file","driver.png","image/png",new byte[]{1});
|
||||
var kind=DispatchEvidenceGateway.Kind.DRIVER_PHOTO;
|
||||
security.setAuthentication(new TestingAuthenticationToken("operator","","platform:fleet:trip:dispatch-review"));
|
||||
|
||||
@@ -288,6 +288,11 @@ async function runWithSession(context, merchantToken) {
|
||||
await reject('签收同键异载荷返回冲突', conflict, () => context.request('POST', `${PDA_RECEIPTS}/confirm`, {
|
||||
...firstBody, trackingNo: `TRACK-${suffix}-CHANGED`,
|
||||
}, picker.token, {}))
|
||||
await reject('签收成功后旧实收快照换新键仍拒绝且不重复入账',
|
||||
response => conflict(response) && response.body?.message?.includes('退货单实收数量已变化'),
|
||||
() => context.request('POST', `${PDA_RECEIPTS}/confirm`, {
|
||||
...firstBody, idempotencyKey: key(context, 'STALE-RECEIPT-NEW-KEY'),
|
||||
}, picker.token, {}))
|
||||
|
||||
await reject('超收被拒绝且不得生成费用批次', conflict, async () => {
|
||||
const body = {
|
||||
@@ -461,6 +466,11 @@ async function runWithSession(context, merchantToken) {
|
||||
success(mergeReplay.response) && nonBlank(merged.data?.cartonMark)
|
||||
&& id(mergeReplay.data?.cartonMark) === id(merged.data?.cartonMark), trace(mergeReplay.response), OPTIONS)
|
||||
await reject('合箱同键异载荷返回冲突', conflict, () => context.request('POST', '/api/pda/v1/last-leg/return-inventory/cartons/merge-boxes', { ...mergeBody, weight: 3 }, picker.token, {}))
|
||||
await reject('部分合箱成功后旧库存快照换新键仍拒绝且不重复扣减',
|
||||
response => conflict(response) && response.body?.message?.includes('来源箱库存已变化'),
|
||||
() => context.request('POST', '/api/pda/v1/last-leg/return-inventory/cartons/merge-boxes', {
|
||||
...mergeBody, idempotencyKey: key(context, 'STALE-MERGE-NEW-KEY'),
|
||||
}, picker.token, {}))
|
||||
|
||||
const beforeInvalid = await overseas(context, merchantToken, 'GET', '冻结合箱异常检查前库存快照',
|
||||
query(`${RETURN_INVENTORY}/cartons`, { page: 1, size: 200, returnNo }))
|
||||
|
||||
Reference in New Issue
Block a user