Completed
Pull Request — master (#36)
by
unknown
01:28
created

tests.ApiTestBase   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 56
Duplicated Lines 0 %
Metric Value
wmc 1
dl 0
loc 56
rs 10
1
'''
2
Created on Jul 15, 2015
3
4
@author: egodolja
5
'''
6
7
import unittest
8
import datetime
9
from decimal import *
10
import random
11
import test
12
13
from ConfigParser import SafeConfigParser
14
from authorizenet import apicontractsv1, apicontrollersbase
15
from authorizenet.utility import *
16
#from authorizenet.apicontractsv1 import CTD_ANON
17
from authorizenet import utility
18
19
class ApiTestBase(unittest.TestCase):
20
21
    def setUp(self):
22
        utility.helper.setpropertyfile('anet_python_sdk_properties.ini')
23
        
24
        self.amount = str(round(random.random()*100, 2))
25
       
26
        self.merchantAuthentication = apicontractsv1.merchantAuthenticationType()       
27
        self.merchantAuthentication.name = utility.helper.getproperty('api.login.id')
28
        self.merchantAuthentication.transactionKey = utility.helper.getproperty('transaction.key')
29
        self.ref_id = 'Sample'
30
        
31
        self.dateOne = datetime.date(2020, 8, 30)
32
#        self.interval = CTD_ANON()
33
#        self.interval.length = 1
34
#        self.interval.unit = 'months'
35
        self.paymentScheduleOne = apicontractsv1.paymentScheduleType()
36
        self.paymentScheduleOne.interval = apicontractsv1.paymentScheduleTypeInterval()
37
        
38
        self.paymentScheduleOne.interval.length = 1
39
        self.paymentScheduleOne.interval.unit = 'months'
40
        
41
        self.paymentScheduleOne.startDate = self.dateOne
42
        self.paymentScheduleOne.totalOccurrences = 12
43
        self.paymentScheduleOne.trialOccurrences = 1
44
        
45
        self.creditCardOne = apicontractsv1.creditCardType()
46
        self.creditCardOne.cardNumber = "4111111111111111"
47
        self.creditCardOne.expirationDate = "2020-12"
48
        
49
        self.payment = apicontractsv1.paymentType()
50
        self.payment.creditCard = self.creditCardOne
51
        
52
        self.customerOne = apicontractsv1.nameAndAddressType()
53
        self.customerOne.firstName = "John"
54
        self.customerOne.lastName = "Smith"
55
        
56
        self.customerData = apicontractsv1.customerDataType()
57
        self.customerData.id = "99999456654"
58
        
59
        self.subscriptionOne = apicontractsv1.ARBSubscriptionType()
60
        self.subscriptionOne.paymentSchedule = self.paymentScheduleOne
61
        self.subscriptionOne.amount = Decimal(str(round(random.random()*100, 2)))
62
        self.subscriptionOne.trialAmount = Decimal ('0.03')
63
        self.subscriptionOne.payment = self.payment
64
        self.subscriptionOne.billTo = self.customerOne
65
66
        self.order = apicontractsv1.orderType()
67
        self.order.invoiceNumber = "INV-21345"
68
        self.order.description = "Product description"
69
        
70
        self.billTo = apicontractsv1.customerAddressType()
71
        self.billTo.firstName = "Ellen"
72
        self.billTo.lastName = "Johnson"
73
        self.billTo.company = "Souveniropolis"
74
        self.billTo.address = "14 Main St"
75
        self.billTo.city = "Seattle"
76
        self.billTo.state = "WA"
77
        self.billTo.zip = "98122"
78
        self.billTo.country = "USA"
79
       
80
    
81