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
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)
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
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
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
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
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
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
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
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
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)
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)
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)