feat(M08-C): 补管理员验券与经营统计
This commit is contained in:
@@ -62,6 +62,9 @@ const token = signAccessToken({
|
||||
tid: '7', aid: '9', rv: 1
|
||||
}, secret, 900);
|
||||
let redeemInput;
|
||||
let managerRedeemInput;
|
||||
let manualRedeemInput;
|
||||
let recordsInput;
|
||||
let notifyInput;
|
||||
const routeApp = await buildApp({
|
||||
thirdParty: {
|
||||
@@ -94,9 +97,14 @@ const routeApp = await buildApp({
|
||||
redeemInput = input;
|
||||
return { redemptionId: '51', status: 'SUCCEEDED' };
|
||||
},
|
||||
async redeemVoucherManually() {
|
||||
async redeemVoucherManually(input) {
|
||||
manualRedeemInput = input;
|
||||
return { redemptionId: '52', status: 'SUCCEEDED' };
|
||||
},
|
||||
async redeemVoucherAsManager(input) {
|
||||
managerRedeemInput = input;
|
||||
return { redemptionId: '53', status: 'SUCCEEDED', voucherMasked: '12******90' };
|
||||
},
|
||||
async receiveDirectBooking(input) {
|
||||
notifyInput = input;
|
||||
return { bookingId: '61', status: 'PENDING_MAPPING' };
|
||||
@@ -104,7 +112,8 @@ const routeApp = await buildApp({
|
||||
async claimDirectBooking() {
|
||||
return { bookingId: '61', orderId: '71' };
|
||||
},
|
||||
async listRecords() {
|
||||
async listRecords(input) {
|
||||
recordsInput = input;
|
||||
return { bookings: [], redemptions: [] };
|
||||
},
|
||||
async saveConfig() {
|
||||
@@ -131,6 +140,43 @@ const redeemed = await routeApp.inject({
|
||||
assert.equal(redeemed.statusCode, 200);
|
||||
assert.equal(redeemInput.userId, '21');
|
||||
|
||||
const managerRedeemed = await routeApp.inject({
|
||||
method: 'POST',
|
||||
url: '/app-api/management/group-vouchers/redeem',
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: {
|
||||
provider: 'DOUYIN', voucherCode: '9876543210', orderId: '31',
|
||||
clientRequestId: 'manager-redeem-request-001'
|
||||
}
|
||||
});
|
||||
assert.equal(managerRedeemed.statusCode, 200);
|
||||
assert.equal(managerRedeemInput.actorId, '21');
|
||||
assert.equal(managerRedeemInput.provider, 'DOUYIN');
|
||||
|
||||
const manualRedeemed = await routeApp.inject({
|
||||
method: 'POST',
|
||||
url: '/app-api/management/group-vouchers/redeem-manual',
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
payload: {
|
||||
provider: 'MEITUAN', voucherCode: '1234567890', orderId: '31',
|
||||
amountCents: 3600, note: 'merchant confirmed',
|
||||
clientRequestId: 'manager-manual-request-001'
|
||||
}
|
||||
});
|
||||
assert.equal(manualRedeemed.statusCode, 200);
|
||||
assert.equal(manualRedeemInput.actorId, '21');
|
||||
assert.equal(manualRedeemInput.amountCents, 3600);
|
||||
|
||||
const records = await routeApp.inject({
|
||||
method: 'GET',
|
||||
url: '/app-api/management/third-party/records?storeId=11&provider=MEITUAN&status=SUCCEEDED',
|
||||
headers: { authorization: `Bearer ${token}` }
|
||||
});
|
||||
assert.equal(records.statusCode, 200);
|
||||
assert.equal(recordsInput.storeId, '11');
|
||||
assert.equal(recordsInput.provider, 'MEITUAN');
|
||||
assert.equal(recordsInput.status, 'SUCCEEDED');
|
||||
|
||||
const bookingPayload = {
|
||||
eventId: 'event-001',
|
||||
externalBookingNo: 'booking-001',
|
||||
|
||||
Reference in New Issue
Block a user