1
0
forked from erp-dev/erp

fix: business cancel service merged

This commit is contained in:
2026-06-11 15:33:31 +08:00
parent 65564f772a
commit 80db7867f4
18 changed files with 574 additions and 125 deletions

View File

@@ -1305,6 +1305,32 @@ class CustomerBalanceAPITestCase(TestCase):
response = self.client.get(f'/api/v1/customers/{self.customer.id}/balance/')
self.assertEqual(response.data['balance'], '30.00')
business_models.ExternalCustomerStatementOrder.objects.create(
merchant=self.merchant,
customer=self.customer,
category=business_models.ExternalCustomerStatementCategoryEnum.SALE,
external_source_id='XS-BAL-001',
occurred_at=datetime.date(2025, 11, 28),
total_amount=Decimal('100.00'),
zk_amount=Decimal('10.00'),
sf_amount=Decimal('20.00'),
)
business_models.ExternalCustomerStatementOrder.objects.create(
merchant=self.merchant,
customer=self.customer,
category=business_models.ExternalCustomerStatementCategoryEnum.SALE_RETURN,
external_source_id='XT-BAL-001',
occurred_at=datetime.date(2025, 11, 29),
total_amount=Decimal('15.00'),
zk_amount=Decimal('5.00'),
)
response = self.client.get(f'/api/v1/customers/{self.customer.id}/balance/')
self.assertEqual(response.data['balance'], '80.00')
statement_payload = services.build_customer_statement(merchant=self.merchant, customer=self.customer)
self.assertEqual(statement_payload['records'][0]['current_balance'], response.data['balance'])
class SupplierBalanceAPITestCase(TestCase):
def setUp(self):