예제 #1
0
 def get_status(self):
     """
     Get transaction status
     :return: Response object if transaction.status API
     :rtype: paynlsdk.api.transaction.status.Response
     """
     from paynlsdk.api.transaction.status import Request
     from paynlsdk.api.client import APIClient
     client = APIClient()
     request = Request(self.transaction_id)
     client.perform_request(request)
     return request.response
예제 #2
0
    def decline(self) -> bool:
        """
        Decline transaction that needs verification

        :return: Result of the decline: True is successful
        :rtype:  bool
        :raise: TransactionStatusException if not current status is not VERIFY
        """
        if not self.is_being_verified():
            raise TransactionStatusException('Cannot decline transaction because it does not have the status VERIFY')
        from paynlsdk.api.transaction.decline import Request
        from paynlsdk.api.client import APIClient
        client = APIClient()
        request = Request(self.transaction_id)
        client.perform_request(request)
        return request.response.result
예제 #3
0
    def capture(self) -> bool:
        """
        Capture authorized transaction

        :return: Result of the capture: True is successful
        :rtype:  bool
        :raise: TransactionNotAuthorizedException if not yet authorized
        """
        if not self.is_authorized():
            raise TransactionNotAuthorizedException('Cannot capture transaction, status is not authorized')
        # We will NOT use the "utility" methds here but the full API implementation
        from paynlsdk.api.transaction.capture import Request
        from paynlsdk.api.client import APIClient
        client = APIClient()
        request = Request(self.transaction_id)
        client.perform_request(request)
        return request.response.result