コード例 #1
0
    def transaction(transaction_id,
                    amount=None,
                    description=None,
                    process_date=None,
                    products={},
                    vat_percentage=None,
                    exchange_url=None):
        # type: (str, int, str, str, dict, float, str) -> paynlsdk2.api.refund.transaction.Response
        """
        Refund a transaction

        :param transaction_id: Transaction ID
        :type transaction_id: str
        :param amount: transaction amount to refund
        :type amount: int
        :param description: refund description
        :type description: str
        :param process_date: date at which refund needs to be processed
                TODO: this *should* be a datetime
        :type process_date: str
        :param products: dictionary of products to refund (keys: product ID, value: quantity)
        :type products: dict
        :param vat_percentage: VAT percentage
        :type vat_percentage: float
        :param exchange_url: URL for the exchange call
        :type exchange_url: str
        :return: Transaction refund response
        :rtype: paynlsdk2.api.refund.transaction.Response
        """
        from paynlsdk2.api.refund.transaction import Request
        client = APIClient()
        request = Request(transaction_id, amount, description, process_date,
                          products, vat_percentage, exchange_url)
        client.perform_request(request)
        return request.response
コード例 #2
0
ファイル: info.py プロジェクト: ssl/python2-sdk
 def get_status(self):
     """
     Get transaction status
     :return: Response object if transaction.status API
     :rtype: paynlsdk2.api.transaction.status.Response
     """
     from paynlsdk2.api.transaction.status import Request
     from paynlsdk2.api.client import APIClient
     client = APIClient()
     request = Request(self.transaction_id)
     client.perform_request(request)
     return request.response
コード例 #3
0
    def pay_server_ip_response(ip_address):
        # type: (str) -> paynlsdk2.api.validate.payserverip.Response
        """
        Get a Pay server IP validation :class:`paynlsdk2.api.validate.payserverip.Response` instance

        :param ip_address: IP address
        :type ip_address: str
        :return: Response instance
        :rtype: paynlsdk2.api.validate.payserverip.Response
        """
        from paynlsdk2.api.validate.payserverip import Request
        client = APIClient()
        request = Request(ip_address)
        client.perform_request(request)
        return request.response
コード例 #4
0
    def info(refund_id):
        # type: (str) -> paynlsdk2.api.refund.info.Response
        """
        Return refund info

        :param refund_id: Refund ID (starts wih "RF-")
        :type refund_id: str
        :return: Info Response
        :rtype: paynlsdk2.api.refund.info.Response
        """
        from paynlsdk2.api.refund.info import Request
        client = APIClient()
        request = Request(refund_id)
        client.perform_request(request)
        return request.response
コード例 #5
0
ファイル: info.py プロジェクト: ssl/python2-sdk
    def capture(self):
        """
        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 paynlsdk2.api.transaction.capture import Request
        from paynlsdk2.api.client import APIClient
        client = APIClient()
        request = Request(self.transaction_id)
        client.perform_request(request)
        return request.response.result
コード例 #6
0
ファイル: info.py プロジェクト: ssl/python2-sdk
    def decline(self):
        """
        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 paynlsdk2.api.transaction.decline import Request
        from paynlsdk2.api.client import APIClient
        client = APIClient()
        request = Request(self.transaction_id)
        client.perform_request(request)
        return request.response.result
コード例 #7
0
ファイル: paymentmethods.py プロジェクト: ssl/python2-sdk
    def get_list(payment_method_id=None):
        # type: (int) -> Dict[int, ServicePaymentProfile]
        """
        Gets the list of payment methods.

        :param payment_method_id: payment method ID (defaults to 10, or iDeal)
        :type payment_method_id: int
        :return: List of banks
        :rtype: List[ServicePaymentProfile]
        """
        from paynlsdk2.api.transaction.getservicepaymentoptions import Request
        client = APIClient()
        request = Request()
        client.perform_request(request)
        profiles = request.response.payment_profiles
        if payment_method_id is None:
            return profiles
        elif payment_method_id in profiles:
            return {payment_method_id: profiles[payment_method_id]}
        raise KeyError(
            'Payment method ID "{}" is not found in the result dictionary'.
            format(payment_method_id))