|
@@ -60,6 +60,50 @@ describe('支付回调API集成测试 - 多租户版本', () => {
|
|
|
});
|
|
});
|
|
|
await userRepository.save(testUser);
|
|
await userRepository.save(testUser);
|
|
|
|
|
|
|
|
|
|
+ // 创建商户记录
|
|
|
|
|
+ const merchantRepository = dataSource.getRepository(MerchantMt);
|
|
|
|
|
+ const testMerchant = merchantRepository.create({
|
|
|
|
|
+ tenantId: 1,
|
|
|
|
|
+ name: '测试商户',
|
|
|
|
|
+ username: `m${Date.now()}`.slice(-19), // 确保不超过20字符
|
|
|
|
|
+ password: 'test_password',
|
|
|
|
|
+ state: 1,
|
|
|
|
|
+ createdBy: testUser.id,
|
|
|
|
|
+ updatedBy: testUser.id
|
|
|
|
|
+ });
|
|
|
|
|
+ await merchantRepository.save(testMerchant);
|
|
|
|
|
+
|
|
|
|
|
+ // 创建供货商记录
|
|
|
|
|
+ const supplierRepository = dataSource.getRepository(SupplierMt);
|
|
|
|
|
+ const testSupplier = supplierRepository.create({
|
|
|
|
|
+ tenantId: 1,
|
|
|
|
|
+ name: '测试供货商',
|
|
|
|
|
+ username: `s${Date.now()}`.slice(-49), // 确保不超过50字符
|
|
|
|
|
+ password: 'test_password',
|
|
|
|
|
+ state: 1,
|
|
|
|
|
+ createdBy: testUser.id,
|
|
|
|
|
+ updatedBy: testUser.id
|
|
|
|
|
+ });
|
|
|
|
|
+ await supplierRepository.save(testSupplier);
|
|
|
|
|
+
|
|
|
|
|
+ // 创建配送地址记录
|
|
|
|
|
+ const addressRepository = dataSource.getRepository(DeliveryAddressMt);
|
|
|
|
|
+ const testAddress = addressRepository.create({
|
|
|
|
|
+ tenantId: 1,
|
|
|
|
|
+ userId: testUser.id,
|
|
|
|
|
+ name: '测试收货人',
|
|
|
|
|
+ mobile: '13800138000',
|
|
|
|
|
+ province: 110000,
|
|
|
|
|
+ city: 110100,
|
|
|
|
|
+ district: 110101,
|
|
|
|
|
+ town: 110101001,
|
|
|
|
|
+ address: '测试地址',
|
|
|
|
|
+ isDefault: 1,
|
|
|
|
|
+ createdBy: testUser.id,
|
|
|
|
|
+ updatedBy: testUser.id
|
|
|
|
|
+ });
|
|
|
|
|
+ await addressRepository.save(testAddress);
|
|
|
|
|
+
|
|
|
// 创建测试订单
|
|
// 创建测试订单
|
|
|
const orderRepository = dataSource.getRepository(OrderMt);
|
|
const orderRepository = dataSource.getRepository(OrderMt);
|
|
|
testOrder = orderRepository.create({
|
|
testOrder = orderRepository.create({
|
|
@@ -73,9 +117,9 @@ describe('支付回调API集成测试 - 多租户版本', () => {
|
|
|
payType: 2,
|
|
payType: 2,
|
|
|
payState: 0, // 未支付
|
|
payState: 0, // 未支付
|
|
|
state: 0,
|
|
state: 0,
|
|
|
- addressId: 0,
|
|
|
|
|
- merchantId: 0,
|
|
|
|
|
- supplierId: 0,
|
|
|
|
|
|
|
+ addressId: testAddress.id,
|
|
|
|
|
+ merchantId: testMerchant.id,
|
|
|
|
|
+ supplierId: testSupplier.id,
|
|
|
createdBy: testUser.id,
|
|
createdBy: testUser.id,
|
|
|
updatedBy: testUser.id
|
|
updatedBy: testUser.id
|
|
|
});
|
|
});
|
|
@@ -254,6 +298,50 @@ describe('支付回调API集成测试 - 多租户版本', () => {
|
|
|
});
|
|
});
|
|
|
await userRepository.save(testUser2);
|
|
await userRepository.save(testUser2);
|
|
|
|
|
|
|
|
|
|
+ // 创建第二个租户的商户记录
|
|
|
|
|
+ const merchantRepository = dataSource.getRepository(MerchantMt);
|
|
|
|
|
+ const testMerchant2 = merchantRepository.create({
|
|
|
|
|
+ tenantId: 2,
|
|
|
|
|
+ name: '测试商户2',
|
|
|
|
|
+ username: `test_merchant2_${Date.now()}`,
|
|
|
|
|
+ password: 'test_password',
|
|
|
|
|
+ state: 1,
|
|
|
|
|
+ createdBy: testUser2.id,
|
|
|
|
|
+ updatedBy: testUser2.id
|
|
|
|
|
+ });
|
|
|
|
|
+ await merchantRepository.save(testMerchant2);
|
|
|
|
|
+
|
|
|
|
|
+ // 创建第二个租户的供货商记录
|
|
|
|
|
+ const supplierRepository = dataSource.getRepository(SupplierMt);
|
|
|
|
|
+ const testSupplier2 = supplierRepository.create({
|
|
|
|
|
+ tenantId: 2,
|
|
|
|
|
+ name: '测试供货商2',
|
|
|
|
|
+ username: `test_supplier2_${Date.now()}`,
|
|
|
|
|
+ password: 'test_password',
|
|
|
|
|
+ state: 1,
|
|
|
|
|
+ createdBy: testUser2.id,
|
|
|
|
|
+ updatedBy: testUser2.id
|
|
|
|
|
+ });
|
|
|
|
|
+ await supplierRepository.save(testSupplier2);
|
|
|
|
|
+
|
|
|
|
|
+ // 创建第二个租户的配送地址记录
|
|
|
|
|
+ const addressRepository = dataSource.getRepository(DeliveryAddressMt);
|
|
|
|
|
+ const testAddress2 = addressRepository.create({
|
|
|
|
|
+ tenantId: 2,
|
|
|
|
|
+ userId: testUser2.id,
|
|
|
|
|
+ name: '测试收货人2',
|
|
|
|
|
+ mobile: '13800138001',
|
|
|
|
|
+ province: 110000,
|
|
|
|
|
+ city: 110100,
|
|
|
|
|
+ district: 110101,
|
|
|
|
|
+ town: 110101001,
|
|
|
|
|
+ address: '测试地址2',
|
|
|
|
|
+ isDefault: 1,
|
|
|
|
|
+ createdBy: testUser2.id,
|
|
|
|
|
+ updatedBy: testUser2.id
|
|
|
|
|
+ });
|
|
|
|
|
+ await addressRepository.save(testAddress2);
|
|
|
|
|
+
|
|
|
const orderRepository = dataSource.getRepository(OrderMt);
|
|
const orderRepository = dataSource.getRepository(OrderMt);
|
|
|
const testOrder2 = orderRepository.create({
|
|
const testOrder2 = orderRepository.create({
|
|
|
tenantId: 2,
|
|
tenantId: 2,
|
|
@@ -266,9 +354,9 @@ describe('支付回调API集成测试 - 多租户版本', () => {
|
|
|
payType: 2,
|
|
payType: 2,
|
|
|
payState: 0,
|
|
payState: 0,
|
|
|
state: 0,
|
|
state: 0,
|
|
|
- addressId: 0,
|
|
|
|
|
- merchantId: 0,
|
|
|
|
|
- supplierId: 0,
|
|
|
|
|
|
|
+ addressId: testAddress2.id,
|
|
|
|
|
+ merchantId: testMerchant2.id,
|
|
|
|
|
+ supplierId: testSupplier2.id,
|
|
|
createdBy: testUser2.id,
|
|
createdBy: testUser2.id,
|
|
|
updatedBy: testUser2.id
|
|
updatedBy: testUser2.id
|
|
|
});
|
|
});
|