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" }''')
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" }''')
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" } }''')
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" }''')
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 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" } }''')
def setUp(self): self.visa_api_client = VisaAPIClient() self.funds_transfer_inquiry = json.loads('''{ "acquirerCountryCode": "840", "acquiringBin": "408999", "primaryAccountNumber": "4957030420210512", "retrievalReferenceNumber": "330000550000", "systemsTraceAuditNumber": "451006" }''')
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 setUp(self): self.visa_api_client = VisaAPIClient() self.watch_list_inquiry = json.loads(''' { "acquirerCountryCode": "840", "acquiringBin": "408999", "address": { "city": "Bangalore", "cardIssuerCountryCode": "IND" }, "referenceNumber": "430000367618", "name": "Mohammed Qasim" }''')
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
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" } }''')
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" }''')
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
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
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
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" }""" )
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": "*****@*****.**", "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
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
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
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
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
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
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 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 setUp(self): self.visa_api_client = VisaAPIClient() self.notification_subscription_request = json.loads( '''{ "contactType": "''' + self.config.get('VDP', 'vtaNotificationContactType') + '''", "contactValue": "*****@*****.**", "emailFormat": "None", "last4": "''' + self.config.get('VDP', 'vtaCreateCustomerLastFour') + '''", "phoneCountryCode": "en-us", "platform": "None", "preferredLanguageCode": "''' + self.config.get('VDP', 'vtaPreferredLanguageCode') + '''", "serviceOffering": "WelcomeMessage", "serviceOfferingSubType": "WelcomeMessage", "substitutions": {} }''')
class TestProgramAdministration(unittest.TestCase): def setUp(self): self.visa_api_client = VisaAPIClient() def test_retrieve_transaction(self): base_uri = 'vctc/' resource_path = 'programadmin/v1/configuration/transactiontypecontrols' response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, '', 'Retrieve Transaction Type Control call', 'get') self.assertEqual(str(response.status_code) ,"200" ,"Retrieve transaction type control test failed") pass
def setUp(self): date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") self.visa_api_client = VisaAPIClient() self.push_funds_request = { "acquirerCountryCode": "840", "acquiringBin": "408999", "amount": "124.05", "businessApplicationId": "AA", "cardAcceptor": { "address": { "country": "USA", "county": "San Mateo", "state": "CA", "zipCode": "94404" }, "idCode": "CA-IDCode-77765", "name": "Visa Inc. USA-Foster City", "terminalId": "TID-9999" }, "localTransactionDateTime": date, "merchantCategoryCode": "6012", "pointOfServiceData": { "motoECIIndicator": "0", "panEntryMode": "90", "posConditionCode": "00" }, "recipientName": "rohan", "recipientPrimaryAccountNumber": "4957030420210462", "retrievalReferenceNumber": "412770451018", "senderAccountNumber": "4957030420210454", "senderAddress": "901 Metro Center Blvd", "senderCity": "Foster City", "senderCountryCode": "124", "senderName": "Mohammed Qasim", "senderReference": "", "senderStateCode": "CA", "sourceOfFundsCode": "05", "systemsTraceAuditNumber": "451018", "transactionCurrencyCode": "USD", "transactionIdentifier": "381228649430015" }
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') +'''" } }''')
class TestValidationAPI(unittest.TestCase): def setUp(self): self.visa_api_client = VisaAPIClient() def test_retrieve_list_recent_decision_records(self): base_uri = 'vctc/'; resource_path = 'validation/v1/decisions/history'; query_string = '?limit=1&page=1' response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path + query_string, '', 'Retrieve List of Recent Decision Records call', 'get') self.assertEqual(str(response.status_code) ,"200" ,"Retrieve List of Recent Decision Records test failed") pass
class TestFundsTransfer(unittest.TestCase): def setUp(self): date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") self.visa_api_client = VisaAPIClient() self.push_funds_request = { "acquirerCountryCode": "840", "acquiringBin": "408999", "amount": "124.05", "businessApplicationId": "AA", "cardAcceptor": { "address": { "country": "USA", "county": "San Mateo", "state": "CA", "zipCode": "94404" }, "idCode": "CA-IDCode-77765", "name": "Visa Inc. USA-Foster City", "terminalId": "TID-9999" }, "localTransactionDateTime": date, "merchantCategoryCode": "6012", "pointOfServiceData": { "motoECIIndicator": "0", "panEntryMode": "90", "posConditionCode": "00" }, "recipientName": "rohan", "recipientPrimaryAccountNumber": "4957030420210462", "retrievalReferenceNumber": "412770451018", "senderAccountNumber": "4957030420210454", "senderAddress": "901 Metro Center Blvd", "senderCity": "Foster City", "senderCountryCode": "124", "senderName": "Mohammed Qasim", "senderReference": "", "senderStateCode": "CA", "sourceOfFundsCode": "05", "systemsTraceAuditNumber": "451018", "transactionCurrencyCode": "USD", "transactionIdentifier": "381228649430015" } def test_push_funds_transactions(self): base_uri = 'visadirect/' resource_path = 'fundstransfer/v1/pushfundstransactions' response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path, self.push_funds_request, 'Push Funds Transaction Test', 'post') self.assertEqual(str(response.status_code), "200", "Push Funds Transaction test failed") pass
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') + '''" } }''')
class TestProgramAdministration(unittest.TestCase): def setUp(self): self.visa_api_client = VisaAPIClient() def test_retrieve_transaction(self): base_uri = 'vctc/' resource_path = 'programadmin/v1/configuration/transactiontypecontrols' response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path, '', 'Retrieve Transaction Type Control call', 'get') self.assertEqual(str(response.status_code), "200", "Retrieve transaction type control test failed") pass
class TestGeneralAttributesEnquiry(unittest.TestCase): def setUp(self): self.visa_api_client = VisaAPIClient() self.general_attribute_inquiry = json.loads('''{ "primaryAccountNumber": "4465390000029077" }''') def test_general_attributes_inquiry(self): base_uri = 'paai/' resource_path = 'generalattinq/v1/cardattributes/generalinquiry' response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.general_attribute_inquiry, 'General Attributes Inquiry call', 'post') self.assertEqual(str(response.status_code) ,"200" ,"General attributes inquiry test failed") pass
def setUp(self): self.visa_api_client = VisaAPIClient() self.notification_subscription_request = json.loads('''{ "contactType": "''' + self.config.get('VDP','vtaNotificationContactType') + '''", "contactValue": "*****@*****.**", "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 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": "cmu edctn materials cntr", "merchantStreetAddress": "802 industrial dr", "merchantCity": "Mount Pleasant", "merchantState": "MI", "merchantPostalCode": "48858", "merchantCountryCode": "840", "merchantPhoneNumber": "19897747123", "merchantUrl": "http://www.emc.cmich.edu", "businessRegistrationId": "386004447", "acquirerCardAcceptorId": "424295031886", "acquiringBin": "476197" }, "responseAttrList": [ "GNBANKA" ], "searchOptions": { "maxRecords": "5", "matchIndicators": "true", "matchScore": "true", "proximity": [ "merchantName" ], "wildCard": [ "merchantName" ] } }''')
class TestManageCommunities(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() def test_get_communities(self): base_uri = 'vta/' resource_path = 'v3/communities' response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, '', 'Get Communities Test', 'get', {'ServiceId' : self.config.get('VDP','vtaServiceId')}) self.assertEqual(str(response.status_code) ,"200" ,"Get Communities Test failed") pass
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" }''')
class TestValidationAPI(unittest.TestCase): def setUp(self): self.visa_api_client = VisaAPIClient() def test_retrieve_list_recent_decision_records(self): base_uri = 'vctc/' resource_path = 'validation/v1/decisions/history' query_string = '?limit=1&page=1' response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path + query_string, '', 'Retrieve List of Recent Decision Records call', 'get') self.assertEqual( str(response.status_code), "200", "Retrieve List of Recent Decision Records test failed") pass
def setUp(self): date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") self.visa_api_client = VisaAPIClient() self.push_funds_request = json.loads('''{ "systemsTraceAuditNumber": 350420, "retrievalReferenceNumber": "401010350420", "localTransactionDateTime": "''' + date + '''", "acquiringBin": 409999, "acquirerCountryCode": "101", "senderAccountNumber": "1234567890123456", "transactionCurrencyCode": "USD", "senderName": "John Smith", "senderCountryCode": "USA", "senderAddress": "44 Market St.", "senderCity": "San Francisco", "senderStateCode": "CA", "recipientName": "Adam Smith", "recipientPrimaryAccountNumber": "4957030420210454", "amount": "112.00", "businessApplicationId": "AA", "transactionIdentifier": 234234322342343, "merchantCategoryCode": 6012, "sourceOfFundsCode": "03", "cardAcceptor": { "name": "John Smith", "terminalId": "13655392", "idCode": "VMT200911026070", "address": { "state": "CA", "county": "081", "country": "USA", "zipCode": "94105" } }, "feeProgramIndicator": "123" }''')
class TestLocationUpdate(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): 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" }""" ) def test_location_update(self): base_uri = "mlc/" resource_path = "locationupdate/v1/locations" response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path, self.location_update, "Location Update Test", "post" ) self.assertEqual(str(response.status_code), "200", "Location update test failed") pass
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 } }''')
class TestFundsTransfer(unittest.TestCase): def setUp(self): date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") self.visa_api_client = VisaAPIClient() self.push_funds_request = json.loads('''{ "systemsTraceAuditNumber": 350420, "retrievalReferenceNumber": "401010350420", "localTransactionDateTime": "''' + date + '''", "acquiringBin": 409999, "acquirerCountryCode": "101", "senderAccountNumber": "1234567890123456", "transactionCurrencyCode": "USD", "senderName": "John Smith", "senderCountryCode": "USA", "senderAddress": "44 Market St.", "senderCity": "San Francisco", "senderStateCode": "CA", "recipientName": "Adam Smith", "recipientPrimaryAccountNumber": "4957030420210454", "amount": "112.00", "businessApplicationId": "AA", "transactionIdentifier": 234234322342343, "merchantCategoryCode": 6012, "sourceOfFundsCode": "03", "cardAcceptor": { "name": "John Smith", "terminalId": "13655392", "idCode": "VMT200911026070", "address": { "state": "CA", "county": "081", "country": "USA", "zipCode": "94105" } }, "feeProgramIndicator": "123" }''') def test_push_funds_transactions(self): base_uri = 'visadirect/' resource_path = 'fundstransfer/v1/pushfundstransactions' response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path, self.push_funds_request, 'Push Funds Transaction Test', 'post') self.assertEqual(str(response.status_code), "200", "Push Funds Transaction test failed") pass
class TestGetPaymentData(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() def test_get_payment_info(self): base_uri = 'wallet-services-web/' resource_path = 'payment/data/{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, '', 'Get Payments Information Test', 'get') self.assertEqual(str(response.status_code) ,"200" ,"Get Payments Information test failed") pass
class TestMerchantSearchAPI(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": "Request_001", "startIndex": "0" }, "searchAttrList": { "merchantName": "cmu edctn materials cntr", "merchantStreetAddress": "802 industrial dr", "merchantCity": "Mount Pleasant", "merchantState": "MI", "merchantPostalCode": "48858", "merchantCountryCode": "840", "merchantPhoneNumber": "19897747123", "merchantUrl": "http://www.emc.cmich.edu", "businessRegistrationId": "386004447", "acquirerCardAcceptorId": "424295031886", "acquiringBin": "476197" }, "responseAttrList": [ "GNBANKA" ], "searchOptions": { "maxRecords": "5", "matchIndicators": "true", "matchScore": "true", "proximity": [ "merchantName" ], "wildCard": [ "merchantName" ] } }''') def test_merchant_search_API(self): base_uri = 'merchantsearch/' resource_path = 'v1/search' response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.locator_request, 'Merchant Search Test', 'post') self.assertEqual(str(response.status_code) ,"200" ,"Merchant search test failed") pass
class TestFundsTransfer(unittest.TestCase): def setUp(self): date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") self.visa_api_client = VisaAPIClient() self.push_funds_request = json.loads('''{ "systemsTraceAuditNumber": 350420, "retrievalReferenceNumber": "401010350420", "localTransactionDateTime": "'''+ date + '''", "acquiringBin": 409999, "acquirerCountryCode": "101", "senderAccountNumber": "1234567890123456", "transactionCurrencyCode": "USD", "senderName": "John Smith", "senderCountryCode": "USA", "senderAddress": "44 Market St.", "senderCity": "San Francisco", "senderStateCode": "CA", "recipientName": "Adam Smith", "recipientPrimaryAccountNumber": "4957030420210454", "amount": "112.00", "businessApplicationId": "AA", "transactionIdentifier": 234234322342343, "merchantCategoryCode": 6012, "sourceOfFundsCode": "03", "cardAcceptor": { "name": "John Smith", "terminalId": "13655392", "idCode": "VMT200911026070", "address": { "state": "CA", "county": "081", "country": "USA", "zipCode": "94105" } }, "feeProgramIndicator": "123" }''') def test_push_funds_transactions(self): base_uri = 'visadirect/' resource_path = 'fundstransfer/v1/pushfundstransactions' response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.push_funds_request, 'Push Funds Transaction Test','post') self.assertEqual(str(response.status_code) ,"200" ,"Push Funds Transaction test failed") pass
class TestLocationUpdate(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): 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" }''') def test_location_update(self): base_uri = 'mlc/' resource_path = 'locationupdate/v1/locations' response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path, self.location_update, 'Location Update Test', 'post') self.assertEqual(str(response.status_code), "200", "Location update test failed") pass
class TestConsumerRules(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.card_register_data = json.loads('''{ "primaryAccountNumber": ''' + self.config.get('VDP','vctcTestPan') +''' }''') def test_register_a_card(self): base_uri = 'vctc/' resource_path = 'customerrules/v1/consumertransactioncontrols' response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.card_register_data, 'Register a card call', 'post') self.assertTrue((str(response.status_code) == "200" or str(response.status_code) == "201"),"Register a card test failed") pass
class TestMerchantSearchAPI(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": "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" } }''') def test_merchant_search_API(self): base_uri = 'merchantsearch/' resource_path = 'v1/search' response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path, self.locator_request, 'Merchant Search Test', 'post') self.assertEqual(str(response.status_code), "200", "Merchant search test failed") pass
class TestManageCommunities(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() def test_get_communities(self): base_uri = 'vta/' resource_path = 'v3/communities' response = self.visa_api_client.do_mutual_auth_request( base_uri + resource_path, '', 'Get Communities Test', 'get', {'ServiceId': self.config.get('VDP', 'vtaServiceId')}) self.assertEqual(str(response.status_code), "200", "Get Communities Test failed") pass