fix: agent 4 to 6
This commit is contained in:
@@ -6,3 +6,8 @@ class IPaymentRepository(ABC):
|
||||
async def create_completed(self,*,user_id:str,order_id:str,itpay_payment_id:str,itpay_paid_amount:str|None,transaction_id:str|None,paid_at:str|None,expired_date:str|None) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@abstractmethod
|
||||
async def update_receipt(self,*,order_id:str,receipt_cloudekassir_id:str|None,receipt_cloudekassir_link:str|None) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ class CreatePaymentCloudkassirCommand:
|
||||
if paid_total is not None and abs(total_amount - paid_total) > Decimal('0.02'):
|
||||
raise ApplicationException(status_code=400, message='Receipt total does not match paid amount')
|
||||
|
||||
await self._receipt.create_receipt(
|
||||
receipt_response = await self._receipt.create_receipt(
|
||||
order_id=order_id,
|
||||
user_id=user_id,
|
||||
email=email,
|
||||
@@ -102,3 +102,11 @@ class CreatePaymentCloudkassirCommand:
|
||||
service_fee=service_fee,
|
||||
request_id=str(ULID()),
|
||||
)
|
||||
receipt_model = receipt_response.get('Model')
|
||||
if not isinstance(receipt_model, dict):
|
||||
receipt_model = {}
|
||||
await self._unit_of_work.payment_repository.update_receipt(
|
||||
order_id=order_id,
|
||||
receipt_cloudekassir_id=str(receipt_model.get('Id') or '') or None,
|
||||
receipt_cloudekassir_link=str(receipt_model.get('ReceiptLocalUrl') or '') or None,
|
||||
)
|
||||
|
||||
@@ -12,6 +12,7 @@ class PaymentEntity:
|
||||
order_id: str | None = None
|
||||
status: PaymentStatus | None = None
|
||||
|
||||
receipt_cloudekassir_id: str | None = None
|
||||
receipt_cloudekassir_link: str | None = None
|
||||
|
||||
itpay_payment_id: str | None = None
|
||||
|
||||
Reference in New Issue
Block a user