forked from AuthorizeNet/sample-code-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-subscription.py
More file actions
32 lines (23 loc) · 1022 Bytes
/
get-subscription.py
File metadata and controls
32 lines (23 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os, sys
import imp
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
constants = imp.load_source('modulename', 'constants.py')
from decimal import *
def get_subscription(subscriptionId):
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = constants.apiLoginId
merchantAuth.transactionKey = constants.transactionKey
getSubscription = apicontractsv1.ARBGetSubscriptionRequest()
getSubscription.merchantAuthentication = merchantAuth
getSubscription.subscriptionId = subscriptionId
getSubscriptionController = ARBGetSubscriptionController(getSubscription)
getSubscriptionController.execute()
response = getSubscriptionController.getresponse()
if (response.messages.resultCode=="Ok"):
print ("Subscription Name : %s" % response.subscription.name)
else:
print ("response code: %s" % response.messages.resultCode)
return response
if(os.path.basename(__file__) == os.path.basename(sys.argv[0])):
get_subscription(constants.subscriptionId)