def capture(self, token: str, child_commerce_code: str,
             child_buy_order: str, authorization_code: str,
             capture_amount: float):
     ValidationUtil.has_text_with_max_length(token,
                                             ApiConstants.TOKEN_LENGTH,
                                             "token")
     ValidationUtil.has_text_with_max_length(
         child_commerce_code, ApiConstants.COMMERCE_CODE_LENGTH,
         "child_commerce_code")
     ValidationUtil.has_text_with_max_length(child_buy_order,
                                             ApiConstants.BUY_ORDER_LENGTH,
                                             "child_buy_order")
     ValidationUtil.has_text_with_max_length(
         authorization_code, ApiConstants.AUTHORIZATION_CODE_LENGTH,
         "authorization_code")
     try:
         endpoint = MallTransaction.CAPTURE_ENDPOINT.format(token)
         request = TransactionCaptureRequest(
             commerce_code=child_commerce_code,
             buy_order=child_buy_order,
             authorization_code=authorization_code,
             capture_amount=capture_amount)
         return RequestService.put(
             endpoint,
             TransactionCaptureRequestSchema().dumps(request).data,
             self.options)
     except TransbankError as e:
         raise TransactionCaptureError(e.message, e.code)
예제 #2
0
 def commit(self, token: str):
     ValidationUtil.has_text_with_max_length(token,
                                             ApiConstants.TOKEN_LENGTH,
                                             "token")
     try:
         endpoint = Transaction.COMMIT_ENDPOINT.format(token)
         return RequestService.put(endpoint, {}, self.options)
     except TransbankError as e:
         raise TransactionCommitError(e.message, e.code)
 def finish(self, token: str):
     ValidationUtil.has_text_with_max_length(token,
                                             ApiConstants.TOKEN_LENGTH,
                                             "token")
     try:
         endpoint = MallInscription.FINISH_ENDPOINT.format(token)
         return RequestService.put(endpoint, {}, self.options)
     except TransbankError as e:
         raise InscriptionFinishError(e.message, e.code)
 def commit(self, token: str, details: list):
     ValidationUtil.has_text_with_max_length(token,
                                             ApiConstants.TOKEN_LENGTH,
                                             "token")
     try:
         endpoint = MallTransaction.COMMIT_ENDPOINT.format(token)
         request = TransactionCommitRequest(details)
         return RequestService.put(
             endpoint,
             TransactionCommitRequestSchema().dumps(request).data,
             self.options)
     except TransbankError as e:
         raise TransactionCommitError(e.message, e.code)
 def commit(self, token: str, id_query_installments: str,
            deferred_period_index: int, grace_period: int):
     ValidationUtil.has_text_with_max_length(token,
                                             ApiConstants.TOKEN_LENGTH,
                                             "token")
     try:
         endpoint = Transaction.COMMIT_ENDPOINT.format(token)
         request = TransactionCommitRequest(id_query_installments,
                                            deferred_period_index,
                                            grace_period)
         return RequestService.put(
             endpoint,
             TransactionCommitRequestSchema().dumps(request).data,
             self.options)
     except TransbankError as e:
         raise TransactionCommitError(e.message, e.code)