This commit is contained in:
2026-10-22 11:56:47 +08:00
parent 5d71af1ac9
commit de96e47d74
71 changed files with 1296 additions and 332 deletions
@@ -1,4 +1,6 @@
const MODULE = 'procurement-sample-fulfillment'
// Peak cash requirement: 1.00 purchase settled plus 2.00 freight frozen.
export const PROCUREMENT_REQUIRED_AVAILABLE_BALANCE = '3.00'
const PLATFORM = '/api/platform/v1/last-leg/overseas-procurements'
const MERCHANT = '/api/merchant/v1/last-leg/overseas-procurements'
const clone = value => value == null ? value : structuredClone(value)
@@ -67,7 +69,7 @@ export async function verifyProcurementSample(context, inputs) {
}
try {
proof.walletBefore = clone(await inputs.readWallet())
await check('客户现金余额足以完成独立样本', cents(proof.walletBefore.availableBalance) >= 500n)
await check('客户现金余额足以完成独立样本', cents(proof.walletBefore.availableBalance) >= cents(PROCUREMENT_REQUIRED_AVAILABLE_BALANCE))
const recipient = { name: '采购样品验收', phone: '13800000002', address: '广东省深圳市南山区科技园测试路1号' }
const create = { customerName: inputs.customerName, purchaseCategory: 'SAMPLE', productName: `${context.marker} sample`, productSpecification: 'one-spec', purchaseQuantity: 2, budgetUnitPrice: '1.00', currency: 'CNY', receivingAddress: recipient.address, contactName: recipient.name, contactPhone: recipient.phone, idempotencyKey: key('create') }
const created = await request('POST', MERCHANT, create, '客户创建样品订单', inputs.customerToken)