Skip to content

Commit a346265

Browse files
committed
Merge pull request #2 from AuthorizeNet/master
Updated SDK to 1.0.9
2 parents 3a1e675 + 4f59bf5 commit a346265

File tree

7 files changed

+4843
-3686
lines changed

7 files changed

+4843
-3686
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Authorize.Net Python SDK
22

3-
[![Build Status](https://travis-ci.org/AuthorizeNet/sdk-python.png?branch=master)]
3+
[![Travis](https://img.shields.io/travis/AuthorizeNet/sdk-python/master.svg)]
44
(https://travis-ci.org/AuthorizeNet/sdk-python)
55
[![Coverage Status](https://coveralls.io/repos/github/AuthorizeNet/sdk-python/badge.svg?branch=master)]
66
(https://coveralls.io/github/AuthorizeNet/sdk-python?branch=master)
7+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-python/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-python/?branch=master)
8+
[![PyPI](https://img.shields.io/pypi/v/authorizenet.svg)](https://badge.fury.io/py/authorizenet)
79

810
`pip install authorizenet`
911

anet_python_sdk_properties.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[properties]
2+
3+
#sandbox cradentials
4+
api.login.id : 5KP3u95bQpv
5+
transaction.key : 4Ktq966gC55GAX7S
6+
md5.hash.key : MD5_HASH_KEY
7+
8+
#log
9+
logfilename : logFile.log
10+
11+
#proxy setup
12+
#http://proxy.yourcompany.com:80
13+
#https://proxy.yourcompany.com:443
14+
15+

authorizenet/apicontractsv1.py

Lines changed: 4795 additions & 3665 deletions
Large diffs are not rendered by default.

authorizenet/apicontrollersbase.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'''
66
import abc
77
import logging
8+
import pyxb
89
import xml.dom.minidom
910
from pip._vendor import requests
1011
from _pyio import __metaclass__
@@ -137,6 +138,9 @@ def execute(self):
137138
self._response = apicontractsv1.CreateFromDocument(self._httpResponse)
138139
except Exception as createfromdocumentexception:
139140
logging.error( 'Create Document Exception: %s, %s', type(createfromdocumentexception), createfromdocumentexception.args )
141+
pyxb.RequireValidWhenParsing(False)
142+
self._response = apicontractsv1.CreateFromDocument(self._httpResponse)
143+
pyxb.RequireValidWhenParsing(True)
140144
else:
141145
if type(self.getresponseclass()) == type(self._response):
142146
if self._response.messages.resultCode == "Error":

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Versions should comply with PEP440. For a discussion on single-sourcing
1818
# the version across setup.py and the project code, see
1919
# https://packaging.python.org/en/latest/single_source_version.html
20-
version='1.0.7',
20+
version='1.0.9',
2121

2222
description='Authorize.Net Python SDK',
2323

tests/apitestbase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def setUp(self):
2424
self.amount = str(round(random.random()*100, 2))
2525

2626
self.merchantAuthentication = apicontractsv1.merchantAuthenticationType()
27-
self.merchantAuthentication.name = helper.getproperty('api_login_id')
28-
self.merchantAuthentication.transactionKey = helper.getproperty('transaction_key')
27+
self.merchantAuthentication.name = utility.helper.getproperty('api.login.id')
28+
self.merchantAuthentication.transactionKey = utility.helper.getproperty('transaction.key')
2929
self.ref_id = 'Sample'
3030

3131
self.dateOne = datetime.date(2020, 8, 30)
@@ -58,7 +58,7 @@ def setUp(self):
5858
self.subscriptionOne.trialAmount = Decimal ('0.03')
5959
self.subscriptionOne.payment = self.payment
6060
self.subscriptionOne.billTo = self.customerOne
61-
61+
6262
self.order = apicontractsv1.orderType()
6363
self.order.invoiceNumber = "INV-21345"
6464
self.order.description = "Product description"

tests/testssample.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,28 @@
2525

2626
class test_ReadProperty(apitestbase.ApiTestBase):
2727
def testPropertyFromFile(self):
28-
login= utility.helper.getproperty("api_login_id")
29-
transactionkey = utility.helper.getproperty("transaction_key")
28+
login= utility.helper.getproperty("api.login.id")
29+
transactionkey = utility.helper.getproperty("transaction.key")
3030
self.assertIsNotNone(login)
3131
self.assertIsNotNone(transactionkey)
3232

33+
3334
class test_TransactionReportingUnitTest(apitestbase.ApiTestBase):
3435
def testGetTransactionDetails(self):
3536

3637
gettransactiondetailsrequest = apicontractsv1.getTransactionDetailsRequest()
3738
gettransactiondetailsrequest.merchantAuthentication = self.merchantAuthentication
38-
gettransactiondetailsrequest.transId ='2244574222' #update valid transaction id
39+
gettransactiondetailsrequest.transId ='2252271173' #update valid transaction id
3940
gettransactiondetailscontroller = getTransactionDetailsController(gettransactiondetailsrequest)
4041
gettransactiondetailscontroller.execute()
4142
response = gettransactiondetailscontroller.getresponse()
4243
self.assertEquals('Ok', response.messages.resultCode)
43-
44+
45+
4446
class test_RecurringBillingTest(apitestbase.ApiTestBase):
45-
47+
48+
createdSubscriptionId = None
49+
4650
def testCreateSubscription(self):
4751

4852
createsubscriptionrequest = apicontractsv1.ARBCreateSubscriptionRequest()
@@ -53,34 +57,37 @@ def testCreateSubscription(self):
5357
arbcreatesubscriptioncontroller.execute()
5458
response = arbcreatesubscriptioncontroller.getresponse()
5559
self.assertIsNotNone(response.subscriptionId)
56-
self.assertEquals('Ok', response.messages.resultCode)
57-
60+
self.assertEquals('Ok', response.messages.resultCode)
61+
self.__class__.createdSubscriptionId = response.subscriptionId
62+
63+
5864
def testgetsubscription(self):
59-
65+
6066
getSubscription = apicontractsv1.ARBGetSubscriptionRequest()
6167
getSubscription.merchantAuthentication = self.merchantAuthentication
62-
getSubscription.subscriptionId = "3044441" #update valid subscription id
68+
getSubscription.subscriptionId = self.__class__.createdSubscriptionId #update valid subscription id
6369
getSubscriptionController = ARBGetSubscriptionController(getSubscription)
6470
getSubscriptionController.execute()
6571
response = getSubscriptionController.getresponse()
6672
self.assertIsNotNone(response.subscription.name)
6773
self.assertEquals('Ok', response.messages.resultCode)
68-
74+
75+
6976
def testcancelSubscription(self):
7077

7178
cancelsubscriptionrequest = apicontractsv1.ARBCancelSubscriptionRequest()
7279
cancelsubscriptionrequest.merchantAuthentication = self.merchantAuthentication
7380
cancelsubscriptionrequest.refId = 'Sample'
74-
cancelsubscriptionrequest.subscriptionId = '2261331' #input valid subscriptionId
81+
cancelsubscriptionrequest.subscriptionId = self.__class__.createdSubscriptionId #input valid subscriptionId
7582
cancelsubscriptioncontroller = ARBCancelSubscriptionController (cancelsubscriptionrequest)
7683
cancelsubscriptioncontroller.execute()
7784
response = cancelsubscriptioncontroller.getresponse()
7885
self.assertEquals('Ok', response.messages.resultCode)
79-
86+
8087

8188
class paymentTransactionUnitTest(apitestbase.ApiTestBase):
8289

83-
def testauthCaputureTransaction(self):
90+
def testauthCaptureTransaction(self):
8491

8592
transactionrequesttype = apicontractsv1.transactionRequestType()
8693
transactionrequesttype.transactionType = "authCaptureTransaction"
@@ -101,7 +108,7 @@ def testauthCaputureTransaction(self):
101108
self.assertIsNotNone(response.transactionResponse)
102109
self.assertIsNotNone(response.transactionResponse.transId)
103110
self.assertIsNot("0", response.transactionResponse.transId)
104-
111+
105112
def testauthOnlyContinueTransaction(self):
106113

107114
transactionrequesttype = apicontractsv1.transactionRequestType()
@@ -121,8 +128,7 @@ def testauthOnlyContinueTransaction(self):
121128
response = createtransactioncontroller.getresponse()
122129
self.assertIsNotNone(response.transactionResponse)
123130
self.assertIsNotNone(response.transactionResponse.transId)
124-
125-
'''
131+
'''
126132
class test_ProductionURL(apitestbase.ApiTestBase):
127133
'' '' ''Tests will run only with production credentials
128134
'' '' ''

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy