コード例 #1
0
def cancel_subscription(subscriptionId):
    merchantAuth = apicontractsv1.merchantAuthenticationType()
    merchantAuth.name = constants.apiLoginId
    merchantAuth.transactionKey = constants.transactionKey

    request = apicontractsv1.ARBCancelSubscriptionRequest()
    request.merchantAuthentication = merchantAuth
    request.refId = "Sample"
    request.subscriptionId = subscriptionId

    controller = ARBCancelSubscriptionController(request)
    controller.execute()

    response = controller.getresponse()

    if (response.messages.resultCode == "Ok"):
        print "SUCCESS"
        print "Message Code : %s" % response.messages.message[0].code
        print "Message text : %s" % response.messages.message[0].text
    else:
        print "ERROR"
        print "Message Code : %s" % response.messages.message[0].code
        print "Message text : %s" % response.messages.message[0].text

    return response
コード例 #2
0
    def subscription_cancel(self, receipt):
        """
        If receipt.invoice.total is zero, no need to call Gateway as there is no
        transaction for it. Otherwise it will cancel the subscription on the Gateway
        and if successfull it will cancel it on the receipt.
        """
        if not receipt.order_item.invoice.total:
            receipt.cancel()
            receipt.save()
            return None

        self.transaction = apicontractsv1.ARBCancelSubscriptionRequest()
        self.transaction.merchantAuthentication = self.merchant_auth
        self.transaction.subscriptionId = str(receipt.transaction)
        self.transaction.includeTransactions = False

        self.controller = ARBCancelSubscriptionController(self.transaction)
        self.set_controller_api_endpoint()
        self.controller.execute()

        response = self.controller.getresponse()

        self.check_subscription_response(response)

        if self.transaction_submitted:
            receipt.cancel()
            receipt.save()
コード例 #3
0
 def testcancelSubscription(self):
     
     cancelsubscriptionrequest = apicontractsv1.ARBCancelSubscriptionRequest()
     cancelsubscriptionrequest.merchantAuthentication = self.merchantAuthentication
     cancelsubscriptionrequest.refId = 'Sample'
     cancelsubscriptionrequest.subscriptionId = self.__class__.createdSubscriptionId #input valid subscriptionId
     cancelsubscriptioncontroller = ARBCancelSubscriptionController (cancelsubscriptionrequest)
     cancelsubscriptioncontroller.execute()  
     response = cancelsubscriptioncontroller.getresponse()
     self.assertEquals('Ok', response.messages.resultCode)  
コード例 #4
0
ファイル: testssample.py プロジェクト: vicusik/sdk-python
 def testCancelSubscription(self):   
     cancelsubscriptionrequest = apicontractsv1.ARBCancelSubscriptionRequest()
     cancelsubscriptionrequest.merchantAuthentication = self.merchantAuthentication
     cancelsubscriptionrequest.refId = 'Sample'
     subscriptionID = self.testCreateSubscription()
     cancelsubscriptionrequest.subscriptionId = subscriptionID #input valid subscriptionId
     cancelsubscriptioncontroller = ARBCancelSubscriptionController (cancelsubscriptionrequest)
     cancelsubscriptioncontroller.execute()  
     response = cancelsubscriptioncontroller.getresponse()
     if hasattr(response, 'messages') == True:
         if hasattr(response.messages, 'resultCode') == True:
             self.assertEquals('Ok', response.messages.resultCode)
コード例 #5
0
    def cancel_subscription_payment(self, reciept, subscription_id):
        self.transaction = apicontractsv1.ARBCancelSubscriptionRequest()
        self.transaction.merchantAuthentication = self.merchant_auth
        self.transaction.subscriptionId = str(subscription_id)

        self.controller = ARBCancelSubscriptionController(self.transaction)
        self.controller.execute()

        response = self.controller.getresponse()

        self.check_subscription_response(response)

        if self.transaction_submitted:
            reciept.status = PurchaseStatus.CANCELED
            reciept.save()
コード例 #6
0
    def subscription_cancel(self, receipt):
        self.transaction = apicontractsv1.ARBCancelSubscriptionRequest()
        self.transaction.merchantAuthentication = self.merchant_auth
        self.transaction.subscriptionId = str(receipt.transaction)
        self.transaction.includeTransactions = False

        self.controller = ARBCancelSubscriptionController(self.transaction)
        self.controller.execute()

        response = self.controller.getresponse()

        self.check_subscription_response(response)

        if self.transaction_submitted:
            receipt.status = PurchaseStatus.CANCELED
            receipt.save()
コード例 #7
0
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'

request = apicontractsv1.ARBCancelSubscriptionRequest()
request.merchantAuthentication = merchantAuth
request.refId = "Sample"
request.subscriptionId = "2945617"

controller = ARBCancelSubscriptionController(request)
controller.execute()

response = controller.getresponse()

if (response.messages.resultCode == "Ok"):
    print "SUCCESS"
    print "Message Code : %s" % response.messages.message[0].code
    print "Message text : %s" % response.messages.message[0].text
else:
    print "ERROR"
    print "Message Code : %s" % response.messages.message[0].code
    print "Message text : %s" % response.messages.message[0].text