コード例 #1
0
    def annul_payment(self, payment):

        self.require_auth(payment)

        if self.get_query_set().filter(Q(operation='CAPTURE')
                                       | Q(operation='SALE'),
                                       payment=payment).exists():
            logger.error("Amount allready captured, cannot annul")
            raise AmountAllreadyCaptured(payment)

        client = get_client()
        operation = 'ANNUL'

        request = get_netaxept_object(client, 'ProcessRequest')
        request.Operation = operation
        request.TransactionId = payment.transaction_id

        transaction = self.model(payment=payment,
                                 transaction_id=payment.transaction_id,
                                 operation=operation)

        try:
            response = process(client, request)
        except suds.WebFault as e:
            logger.error("Annul on payment failed")
            handle_response_exception(e, transaction)
        finally:
            transaction.save()

        return transaction
コード例 #2
0
 def credit_payment(self, payment, amount):
     
     self.require_auth(payment)
     
     if not self.get_query_set().filter(payment=payment, operation='CAPTURE').exists():
         raise NoAmountCaptured        
         
     client = get_client()
     operation = 'CREDIT'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     request.TransactionAmount = amount
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         amount=amount,
         operation=operation
     )
     
     try:
         response = process(client, request)
     except suds.WebFault, e:
         handle_response_exception(e, transaction)
コード例 #3
0
    def auth_payment(self, payment):

        if not payment.completed():
            logger.error("Payment registration not completed")
            raise PaymentRegistrationNotCompleted(payment)

        client = get_client()
        operation = 'AUTH'

        request = get_netaxept_object(client, 'ProcessRequest')
        request.Operation = operation
        request.TransactionId = payment.transaction_id

        transaction = self.model(payment=payment,
                                 transaction_id=payment.transaction_id,
                                 operation=operation)
        try:
            response = process(client, request)
        except suds.WebFault as e:
            logger.error("Authorization on payment failed")
            handle_response_exception(e, transaction)
        finally:
            transaction.save()

        return transaction
コード例 #4
0
    def capture_payment(self, payment, amount):

        self.require_auth(payment)

        client = get_client()
        operation = 'CAPTURE'

        request = get_netaxept_object(client, 'ProcessRequest')
        request.Operation = operation
        request.TransactionId = payment.transaction_id
        request.TransactionAmount = amount

        transaction = self.model(payment=payment,
                                 transaction_id=payment.transaction_id,
                                 amount=amount,
                                 operation=operation)

        try:
            response = process(client, request)
        except suds.WebFault as e:
            logger.error("Capture on payment not failed")
            handle_response_exception(e, transaction)
        finally:
            transaction.save()

        return transaction
コード例 #5
0
    def credit_payment(self, payment, amount):

        self.require_auth(payment)

        if not self.get_query_set().filter(
                Q(operation='CAPTURE') | Q(operation='SALE'),
                payment=payment).exists():
            logger.error("No amount captured, cannot credit")
            raise NoAmountCaptured(payment, amount)

        client = get_client()
        operation = 'CREDIT'

        request = get_netaxept_object(client, 'ProcessRequest')
        request.Operation = operation
        request.TransactionId = payment.transaction_id
        request.TransactionAmount = amount

        transaction = self.model(payment=payment,
                                 transaction_id=payment.transaction_id,
                                 amount=amount,
                                 operation=operation)

        try:
            response = process(client, request)
        except suds.WebFault as e:
            logger.error("Credit on payment failed")
            handle_response_exception(e, transaction)
        finally:
            transaction.save()

        return transaction
コード例 #6
0
    def sale_payment(self, payment, amount):

        if not payment.completed():
            raise PaymentRegistrationNotCompleted(payment, amount)

        client = get_client()
        operation = 'SALE'

        request = get_netaxept_object(client, 'ProcessRequest')
        request.Operation = operation
        request.TransactionId = payment.transaction_id
        request.TransactionAmount = amount

        transaction = self.model(
            payment=payment,
            transaction_id=payment.transaction_id,
            amount=amount,
            operation=operation,
        )

        try:
            response = process(client, request)
        except suds.WebFault as e:
            handle_response_exception(e, transaction)

        transaction.save()
        return transaction
コード例 #7
0
 def sale_payment(self, payment):
     
     if not payment.completed():
         logger.error("Payment registration not completed")
         raise PaymentRegistrationNotCompleted
              
     client = get_client()
     operation = 'SALE'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         operation=operation
     )
     
     try:
         response = process(client, request)
     except suds.WebFault as e:
         logger.error("Sale on payment failed")
         handle_response_exception(e, transaction)
     finally:
         transaction.save()
         
     return transaction
コード例 #8
0
 def annul_payment(self, payment):
     
     self.require_auth(payment)
     
     if self.get_query_set().filter(Q(operation='CAPTURE') | Q(operation='SALE'), payment=payment).exists():
         logger.error("Amount allready captured, cannot annul")
         raise AmountAllreadyCaptured
                
     client = get_client()
     operation = 'ANNUL'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         operation=operation
     )
             
     try:
         response = process(client, request)
     except suds.WebFault as e:
         logger.error("Annul on payment failed")
         handle_response_exception(e, transaction)
     finally:
         transaction.save()
         
     return transaction
コード例 #9
0
 def credit_payment(self, payment, amount):
     
     if not self.get_query_set().filter(Q(operation='CAPTURE') | Q(operation='SALE'), payment=payment).exists():
         logger.error("No amount captured, cannot credit")
         raise NoAmountCaptured        
         
     client = get_client()
     operation = 'CREDIT'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     request.TransactionAmount = amount
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         amount=amount,
         operation=operation
     )
     
     try:
         response = process(client, request)
     except suds.WebFault as e:
         logger.error("Credit on payment failed")
         handle_response_exception(e, transaction)
     finally:
         transaction.save()
         
     return transaction
コード例 #10
0
 def capture_payment(self, payment, amount):
     
     self.require_auth(payment)
                 
     client = get_client()
     operation = 'CAPTURE'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     request.TransactionAmount = amount
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         amount=amount,
         operation=operation
     )
     
     try:
         response = process(client, request)
     except suds.WebFault as e:
         logger.error("Capture on payment not failed")
         handle_response_exception(e, transaction)
     finally:
         transaction.save()
         
     return transaction
コード例 #11
0
 def auth_payment(self, payment):
     
     if not payment.completed():
         raise PaymentRegistrationNotCompleted
              
     client = get_client()
     operation = 'AUTH'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         operation=operation
     )
     try:
         response = process(client, request)
     except suds.WebFault, e:
         handle_response_exception(e, transaction)
コード例 #12
0
 def capture_payment(self, payment, amount):
     
     self.require_auth(payment)
                 
     client = get_client()
     operation = 'CAPTURE'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     request.TransactionAmount = amount
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         amount=amount,
         operation=operation
     )
     
     try:
         response = process(client, request)
     except suds.WebFault, e:
         handle_response_exception(e, transaction)
コード例 #13
0
 def annul_payment(self, payment):
     
     self.require_auth(payment)
     
     if self.get_query_set().filter(payment=payment, operation='CAPTURE').exists():
         raise AmountAllreadyCaptured
                
     client = get_client()
     operation = 'ANNUL'
     
     request = get_netaxept_object(client, 'ProcessRequest')
     request.Operation = operation
     request.TransactionId = payment.transaction_id
     
     transaction = self.model(
         payment=payment,
         transaction_id=payment.transaction_id,
         operation=operation
     )
             
     try:
         response = process(client, request)
     except suds.WebFault, e:
         handle_response_exception(e, transaction)