本文整理汇总了Python中visa.helpers.visa_api_client.VisaAPIClient类的典型用法代码示例。如果您正苦于以下问题:Python VisaAPIClient类的具体用法?Python VisaAPIClient怎么用?Python VisaAPIClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VisaAPIClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
date = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
self.visa_api_client = VisaAPIClient()
self.location_update = json.loads(
'''{
"accuracy": "5000",
"cloudNotificationKey": "03e3ae03-a627-4241-bad6-58f811c18e46",
"cloudNotificationProvider": "1",
"deviceId": "'''
+ self.config.get("VDP", "mlcDeviceId")
+ '''",
"deviceLocationDateTime": "'''
+ date
+ '''",
"geoLocationCoordinate": {
"latitude": "37.558546",
"longitude": "-122.271079"
},
"header": {
"messageDateTime": "'''
+ date
+ '''",
"messageId": "'''
+ self.config.get("VDP", "mlcMessageId")
+ '''"
},
"issuerId": "'''
+ self.config.get("VDP", "mlcIssuerId")
+ """",
"provider": "1",
"source": "2"
}"""
)
示例2: TestReplaceCard
class TestReplaceCard(unittest.TestCase):
config = parser.ConfigParser()
config_path = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)),'..','configuration.ini'))
config.read(config_path)
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.replace_cards_request = json.loads('''{
"communityCode": "''' + self.config.get('VDP','vtaCommunityCode') + '''",
"newCard": {
"address": '''+ self.config.get('VDP','vtaReplaceCardNewAddress') + ''',
"billCycleDay": "22",
"bin": null,
"cardEnrollmentDate": "2016-06-10T08:36:59+00:00",
"cardExpiryDate": "''' + self.config.get('VDP','vtaReplaceCardExpiryDate') + '''",
"cardNickName": "My Visa 3",
"cardNumber": "''' + self.config.get('VDP','vtaReplaceCardNumber') + '''",
"cardSecurityCode": "''' + self.config.get('VDP','vtaReplaceCardSecurityCode') + '''",
"isActive": true,
"lastFour": "''' + self.config.get('VDP','vtaReplaceCardLastFour') + '''",
"nameOnCard": "Mradul",
"paused": false,
"portfolioNum": "''' + self.config.get('VDP','vtaPortfolioNumber') + '''",
"previousCardNumber": null,
"productId": null,
"productIdDescription": "Credit",
"productType": "Credit",
"productTypeExtendedCode": "123",
"rpin": null
},
"oldCard": {
"address": '''+ self.config.get('VDP','vtaCreateCustomerAddress') + ''',
"billCycleDay": "22",
"bin": null,
"cardEnrollmentDate": "2016-06-10T08:36:59+00:00",
"cardExpiryDate": "''' + self.config.get('VDP','vtaCreateCustomerCardExpiryDate') + '''",
"cardNickName": "My Visa 3",
"cardNumber": "''' + self.config.get('VDP','vtaCreateCustomerCardNumber')+ '''",
"cardSecurityCode": "''' + self.config.get('VDP','vtaCreateCustomerCardSecurityCode') + '''",
"isActive": true,
"lastFour": "'''+ self.config.get('VDP','vtaCreateCustomerLastFour') + '''",
"nameOnCard": "Mradul",
"paused": false,
"portfolioNum": "''' + self.config.get('VDP','vtaPortfolioNumber') + '''",
"previousCardNumber": null,
"productId": null,
"productIdDescription": "Credit",
"productType": "Credit",
"productTypeExtendedCode": "123",
"rpin": null
}
}''')
def test_get_communities(self):
base_uri = 'vta/'
resource_path = 'v3/communities/' + self.config.get('VDP','vtaCommunityCode') + '/cards'
response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.replace_cards_request, 'Replace a card test', 'post', {'ServiceId' : self.config.get('VDP','vtaServiceId')})
self.assertEqual(str(response.status_code) ,"201" ,"Replace a card test failed")
pass
示例3: TestForeignExchange
class TestForeignExchange(unittest.TestCase):
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.foreign_exchange_request = json.loads('''{
"acquirerCountryCode": "840",
"acquiringBin": "408999",
"cardAcceptor": {
"address": {
"city": "San Francisco",
"country": "USA",
"county": "San Mateo",
"state": "CA",
"zipCode": "94404"
},
"idCode": "ABCD1234ABCD123",
"name": "ABCD",
"terminalId": "ABCD1234"
},
"destinationCurrencyCode": "826",
"markUpRate": "1",
"retrievalReferenceNumber": "201010101031",
"sourceAmount": "100.00",
"sourceCurrencyCode": "840",
"systemsTraceAuditNumber": "350421"
}''')
def test_foreign_exchange(self):
base_uri = 'forexrates/'
resource_path = 'v1/foreignexchangerates'
response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.foreign_exchange_request, 'Foreign Exchange call', 'post')
self.assertEqual(str(response.status_code) ,"200" ,"Foreign exchange test failed")
pass
示例4: TestCardEnrollement
class TestCardEnrollement(unittest.TestCase):
config = parser.ConfigParser()
config_path = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)),'..','configuration.ini'))
config.read(config_path)
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.enrollement_data = json.loads('''{
"enrollmentMessageType": "enroll",
"enrollmentRequest": {
"cardholderMobileNumber": "0016504323000",
"clientMessageID": "''' + self.config.get('VDP','mlcClientMessageID') +'''",
"deviceId": "''' + self.config.get('VDP','mlcDeviceId') +'''",
"issuerId": "''' + self.config.get('VDP','mlcIssuerId') +'''",
"primaryAccountNumber": "''' + self.config.get('VDP','mlcPrimaryAccountNumber') +'''"
}
}''')
def test_enrollement(self):
base_uri = 'mlc/'
resource_path = 'enrollment/v1/enrollments'
response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.enrollement_data, 'MLC Card Enrollement Test', 'post')
self.assertEqual(str(response.status_code) ,"200" ,"MLC enrollment's test failed")
pass
示例5: TestUpdatePaymentInformation
class TestUpdatePaymentInformation(unittest.TestCase):
config = parser.ConfigParser()
config_path = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)),'..','configuration.ini'))
config.read(config_path)
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.update_payment_info_request = json.loads('''{
"orderInfo": {
"currencyCode": "USD",
"discount": "5.25",
"eventType": "Confirm",
"giftWrap": "10.1",
"misc": "3.2",
"orderId": "testorderID",
"promoCode": "testPromoCode",
"reason": "Order Successfully Created",
"shippingHandling": "5.1",
"subtotal": "80.1",
"tax": "7.1",
"total": "101"
}
}''')
def test_update_payment_info(self):
base_uri = 'wallet-services-web/'
resource_path = 'payment/info/{callId}'
resource_path = resource_path.replace('{callId}', self.config.get('VDP','checkoutCallId'))
query_string = 'apikey=' + self.config.get('VDP','apiKey')
response = self.visa_api_client.do_x_pay_request(base_uri, resource_path , query_string, self.update_payment_info_request, 'Update Payment Information Test', 'put')
self.assertEqual(str(response.status_code) ,"200" ,"Update Payment Information test failed")
pass
示例6: setUp
def setUp(self):
date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
self.visa_api_client = VisaAPIClient()
self.m_visa_transaction_request = json.loads('''{
"acquirerCountryCode": "643",
"acquiringBin": "400171",
"amount": "124.05",
"businessApplicationId": "CI",
"cardAcceptor": {
"address": {
"city": "Bangalore",
"country": "IND"
},
"idCode": "ID-Code123",
"name": "Card Accpector ABC"
},
"localTransactionDateTime": "'''+ date +'''",
"merchantCategoryCode": "4829",
"recipientPrimaryAccountNumber": "4123640062698797",
"retrievalReferenceNumber": "430000367618",
"senderAccountNumber": "4541237895236",
"senderName": "Mohammed Qasim",
"senderReference": "1234",
"systemsTraceAuditNumber": "313042",
"transactionCurrencyCode": "USD",
"transactionIdentifier": "381228649430015"
}''')
示例7: TestCybersourcePayment
class TestCybersourcePayment(unittest.TestCase):
config = parser.ConfigParser()
config_path = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)),'..','configuration.ini'))
config.read(config_path)
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.payment_authorization_request = json.loads('''{
"amount": "0",
"currency": "USD",
"payment": {
"cardNumber": "4111111111111111",
"cardExpirationMonth": "10",
"cardExpirationYear": "2016"
}
}''')
def test_cybersource_payment_authorization(self):
base_uri = 'cybersource/'
resource_path = 'payments/v1/authorizations'
query_string = 'apikey=' + self.config.get('VDP','apiKey')
response = self.visa_api_client.do_x_pay_request(base_uri, resource_path , query_string, self.payment_authorization_request, 'Cybersource Payments Test', 'post')
self.assertEqual(str(response.status_code) ,"201" ,"Cybersource payments test failed")
pass
示例8: TestVisaTravelNotificationService
class TestVisaTravelNotificationService(unittest.TestCase):
config = parser.ConfigParser()
config_path = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)),'..','configuration.ini'))
config.read(config_path)
def setUp(self):
departureDate = datetime.datetime.now().strftime("%Y-%m-%d")
returnDate = datetime.datetime.strptime(departureDate, "%Y-%m-%d") + datetime.timedelta(days=10)
self.visa_api_client = VisaAPIClient()
self.travel_notification_request = json.loads('''{
"addTravelItinerary": {
"returnDate": "''' + returnDate.strftime("%Y-%m-%d") + '''",
"departureDate": "''' + departureDate +'''",
"destinations": [
{
"state": "CA",
"country": "840"
}
],
"primaryAccountNumbers": ''' + self.config.get('VDP','tnsCardNumbers') + ''',
"userId": "Rajesh",
"partnerBid": "''' + self.config.get('VDP','tnsPartnerBid') + '''"
}
}''')
def test_add_travel_itenary(self):
base_uri = 'travelnotificationservice/'
resource_path = 'v1/travelnotification/itinerary'
response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.travel_notification_request, 'Add Travel Itenary Test','post')
self.assertEqual(str(response.status_code) ,"200" ,"Add travel itenary test failed")
pass
示例9: setUp
def setUp(self):
date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]
self.visa_api_client = VisaAPIClient()
self.locator_request = json.loads('''{
"header": {
"messageDateTime": "'''+ date +'''",
"requestMessageId": "CDISI_GMR_001",
"startIndex": "1"
},
"searchAttrList": {
"visaMerchantId":"11687107",
"visaStoreId":"125861096",
"merchantName":"ALOHA CAFE",
"merchantCountryCode":"840",
"merchantCity": "LOS ANGELES",
"merchantState": "CA",
"merchantPostalCode": "90012",
"merchantStreetAddress": "410 E 2ND ST",
"businessRegistrationId":"196007747",
"acquirerCardAcceptorId":"191642760469222",
"acquiringBin":"486168"
},
"responseAttrList": [
"GNSTANDARD"
],
"searchOptions": {
"maxRecords": "2",
"matchIndicators": "true",
"matchScore": "true"
}
}''')
示例10: TestManageNotifications
class TestManageNotifications(unittest.TestCase):
config = parser.ConfigParser()
config_path = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)),'..','configuration.ini'))
config.read(config_path)
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.notification_subscription_request = json.loads('''{
"contactType": "''' + self.config.get('VDP','vtaNotificationContactType') + '''",
"contactValue": "[email protected]",
"emailFormat": "None",
"last4": "''' + self.config.get('VDP','vtaCreateCustomerLastFour') + '''",
"phoneCountryCode": "en-us",
"platform": "None",
"preferredLanguageCode": "''' + self.config.get('VDP','vtaPreferredLanguageCode') + '''",
"serviceOffering": "WelcomeMessage",
"serviceOfferingSubType": "WelcomeMessage",
"substitutions": {}
}''')
def test_notification_subscription(self):
base_uri = 'vta/'
resource_path = 'v3/communities/'+ self.config.get('VDP','vtaCommunityCode') +'/portfolios/' + self.config.get('VDP','vtaPortfolioNumber') +'/customers/' + self.config.get('VDP','vtaCustomerId')+ '/notifications';
response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.notification_subscription_request, 'Notification Subscriptions Test', 'post', {'ServiceId' : self.config.get('VDP','vtaServiceId')})
self.assertEqual(str(response.status_code) ,"201" ,"Notification Subscriptions Test failed")
pass
示例11: TestMerchantLocatorAPI
class TestMerchantLocatorAPI(unittest.TestCase):
def setUp(self):
date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]
self.visa_api_client = VisaAPIClient()
self.locator_request = json.loads('''{
"header": {
"messageDateTime": "''' + date + '''",
"requestMessageId": "VCO_GMR_001"
},
"searchAttrList": {
"merchantName": "ALOHA CAFE",
"merchantCountryCode": "840",
"latitude": "34.047616",
"longitude": "-118.239079",
"distance": "100",
"distanceUnit": "M"
},
"responseAttrList": [
"GNLOCATOR"
],
"searchOptions": {
"maxRecords": "2",
"matchIndicators": "true",
"matchScore": "true"
}
}''')
def test_merchant_locator_API(self):
base_uri = 'merchantlocator/'
resource_path = 'v1/locator'
response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.locator_request, 'Merchant Locator Test', 'post')
self.assertEqual(str(response.status_code) ,"200" ,"Merchant locator test failed")
pass
示例12: setUp
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.payment_account_validation = json.loads('''{
"acquirerCountryCode": "840",
"acquiringBin": "408999",
"addressVerificationResults": {
"postalCode": "T4B 3G5",
"street": "801 Metro Center Blv"
},
"cardAcceptor": {
"address": {
"city": "San Francisco",
"country": "USA",
"county": "CA",
"state": "CA",
"zipCode": "94404"
},
"idCode": "111111",
"name": "rohan",
"terminalId": "123"
},
"cardCvv2Value": "672",
"cardExpiryDate": "2018-06",
"primaryAccountNumber": "4957030000313108",
"retrievalReferenceNumber": "015221743720",
"systemsTraceAuditNumber": "743720"
}''')
示例13: setUp
def setUp(self):
date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]
self.visa_api_client = VisaAPIClient()
self.locator_request = json.loads('''{
"header": {
"messageDateTime": "''' + date + '''",
"requestMessageId": "VCO_GMR_001"
},
"searchAttrList": {
"merchantName": "ALOHA CAFE",
"merchantCountryCode": "840",
"latitude": "34.047616",
"longitude": "-118.239079",
"distance": "100",
"distanceUnit": "M"
},
"responseAttrList": [
"GNLOCATOR"
],
"searchOptions": {
"maxRecords": "2",
"matchIndicators": "true",
"matchScore": "true"
}
}''')
示例14: setUp
def setUp(self):
date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]
self.visa_api_client = VisaAPIClient()
self.locator_request = json.loads('''{
"header": {
"messageDateTime": "''' + date + '''",
"requestMessageId": "Request_001",
"startIndex": "0"
},
"searchAttrList": {
"merchantName": "Starbucks",
"merchantCountryCode": "840",
"latitude": "37.363922",
"longitude": "-121.929163",
"distance": "2",
"distanceUnit": "M"
},
"responseAttrList": [
"GNLOCATOR"
],
"searchOptions": {
"maxRecords": "5",
"matchIndicators": "true",
"matchScore": "true"
}
}''')
示例15: setUp
def setUp(self):
self.visa_api_client = VisaAPIClient()
self.funds_transfer_inquiry = json.loads('''{
"acquirerCountryCode": "840",
"acquiringBin": "408999",
"primaryAccountNumber": "4957030420210512",
"retrievalReferenceNumber": "330000550000",
"systemsTraceAuditNumber": "451006"
}''')