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
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
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 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 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 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
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 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 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
Beispiel #11
0
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
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
Beispiel #14
0
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
Beispiel #15
0
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
Beispiel #16
0
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 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 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 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 TestFundsTransferAttributes(unittest.TestCase):

    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 test_funds_transfer_inquiry(self):
        base_uri = 'paai/'
        resource_path = 'fundstransferattinq/v1/cardattributes/fundstransferinquiry'
        response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.funds_transfer_inquiry, 'Funds Transfer Inquiry call', 'post')
        self.assertEqual(str(response.status_code) ,"200" ,"Funds transfer inquiry 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
Beispiel #22
0
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
Beispiel #23
0
class TestFundsTransferAttributes(unittest.TestCase):
    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 test_funds_transfer_inquiry(self):
        base_uri = 'paai/'
        resource_path = 'fundstransferattinq/v1/cardattributes/fundstransferinquiry'
        response = self.visa_api_client.do_mutual_auth_request(
            base_uri + resource_path, self.funds_transfer_inquiry,
            'Funds Transfer Inquiry call', 'post')
        self.assertEqual(str(response.status_code), "200",
                         "Funds transfer inquiry test failed")
        pass
Beispiel #24
0
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
class TestWatchListScreening(unittest.TestCase):

    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"
                  }''')
    
    def test_watch_list_inquiry(self):
        base_uri = 'visadirect/'
        resource_path = 'watchlistscreening/v1/watchlistinquiry'
        response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.watch_list_inquiry, 'Watch List Inquiry Test','post')
        self.assertEqual(str(response.status_code) ,"200" ,"Watch List Inquiry test failed")
        pass
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 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 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
Beispiel #29
0
class TestMVisa(unittest.TestCase):
    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 test_mVisa_transactions(self):
        base_uri = 'visadirect/'
        resource_path = 'mvisa/v1/cashinpushpayments'
        response = self.visa_api_client.do_mutual_auth_request(
            base_uri + resource_path, self.m_visa_transaction_request,
            'M Visa Transaction Test', 'post')
        self.assertEqual(str(response.status_code), "200",
                         "M Visa Transaction test failed")
        pass
class TestWatchListScreening(unittest.TestCase):
    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"
                  }''')

    def test_watch_list_inquiry(self):
        base_uri = 'visadirect/'
        resource_path = 'watchlistscreening/v1/watchlistinquiry'
        response = self.visa_api_client.do_mutual_auth_request(
            base_uri + resource_path, self.watch_list_inquiry,
            'Watch List Inquiry Test', 'post')
        self.assertEqual(str(response.status_code), "200",
                         "Watch List Inquiry test failed")
        pass
Beispiel #31
0
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": "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 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
Beispiel #32
0
class TestMVisa(unittest.TestCase):

    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 test_mVisa_transactions(self):
        base_uri = 'visadirect/'
        resource_path = 'mvisa/v1/cashinpushpayments'
        response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.m_visa_transaction_request, 'M Visa Transaction Test','post')
        self.assertEqual(str(response.status_code) ,"200" ,"M Visa Transaction test failed")
        pass
class TestPaymentAccountValidation(unittest.TestCase):

    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 test_enrollement(self):
        base_uri = 'pav/'
        resource_path = 'v1/cardvalidation'
        response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.payment_account_validation, 'Card Validation call', 'post')
        self.assertEqual(str(response.status_code) ,"200" ,"Card validation test failed")
        pass
class TestATMLocator(unittest.TestCase):

    def setUp(self):
        date = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
        self.visa_api_client = VisaAPIClient()
        self.atm_inquiry_request = json.loads('''{
          "requestData": {
                "culture": "en-US",
                "distance": "20",
                "distanceUnit": "mi",
                "location": {
                  "address": null,
                  "geocodes": null,
                  "placeName": "800 metro center , foster city,ca"
                },
                "metaDataOptions": 0,
                "options": {
                  "findFilters": [
                    {
                      "filterName": "PLACE_NAME",
                      "filterValue": "FORT FINANCIAL CREDIT UNION|ULTRON INC|U.S. BANK"
                    },
                    {
                      "filterName": "OPER_HRS",
                      "filterValue": "C"
                    },
                    {
                      "filterName": "AIRPORT_CD",
                      "filterValue": ""
                    },
                    {
                      "filterName": "WHEELCHAIR",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "BRAILLE_AUDIO",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "BALANCE_INQUIRY",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "CHIP_CAPABLE",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "PIN_CHANGE",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "RESTRICTED",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "PLUS_ALLIANCE_NO_SURCHARGE_FEE",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "ACCEPTS_PLUS_SHARED_DEPOSIT",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "V_PAY_CAPABLE",
                      "filterValue": "N"
                    },
                    {
                      "filterName": "READY_LINK",
                      "filterValue": "N"
                    }
                  ],
                  "operationName": "or",
                  "range": {
                    "count": 99,
                    "start": 0
                  },
                  "sort": {
                    "direction": "desc",
                    "primary": "city"
                  },
                  "useFirstAmbiguous": true
                }
              },
              "wsRequestHeaderV2": {
                "applicationId": "VATMLOC",
                "correlationId": "909420141104053819418",
                "requestMessageId": "test12345678",
                "requestTs": "''' + date + '''",
                "userBid": "10000108",
                "userId": "CDISIUserID"
              }
            }''')
    
    def test_locate_atm(self):
        base_uri = 'globalatmlocator/'
        resource_path = 'v1/localatms/atmsinquiry'
        response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.atm_inquiry_request, 'ATM Locator test','post')
        self.assertEqual(str(response.status_code) ,"200" ,"ATM Locator Test failed")
        pass
Beispiel #35
0
class TestManageCustomers(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.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
        self.visa_api_client = VisaAPIClient()
        self.create_customer_request = json.loads(
            '''{
    "customer": {
        "cards": [
            {
                "address": ''' +
            self.config.get('VDP', 'vtaCreateCustomerAddress') + ''',
                "billCycleDay": "7",
                "bin": 431263,
                "cardEnrollmentDate": "''' + date + '''",
                "cardExpiryDate": "''' +
            self.config.get('VDP', 'vtaCreateCustomerCardExpiryDate') + '''",
                "cardNickName": "My Card",
                "cardNumber": "''' +
            self.config.get('VDP', 'vtaCreateCustomerCardNumber') + '''",
                "cardSecurityCode": "''' +
            self.config.get('VDP', 'vtaCreateCustomerCardSecurityCode') + '''",
                "contactServiceOfferings": [
                    {
                        "contact": {
                            "contactNickName": "testEmail",
                            "contactType": "Email",
                            "contactValue": "*****@*****.**",
                            "isVerified": true,
                            "lastUpdateDateTime": "''' + date + '''",
                            "mobileCountryCode": null,
                            "mobileVerificationCode": null,
                            "mobileVerificationCodeDate": "''' +
            datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") + '''",
                            "platform": "None",
                            "preferredEmailFormat": "Html",
                            "securityPhrase": null,
                            "status": "Active"
                        },
                        "serviceOfferings": [
                            {
                                "isActive": true,
                                "offeringId": "Threshold",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            },
                            {
                                "isActive": true,
                                "offeringId": "CrossBorder",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            },
                            {
                                "isActive": true,
                                "offeringId": "Declined",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            },
                            {
                                "isActive": true,
                                "offeringId": "CardNotPresent",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "isActive": true,
                "lastFour": "''' +
            self.config.get('VDP', 'vtaCreateCustomerLastFour') + '''",
                "nameOnCard": "Migration",
                "paused": false,
                "portfolioNum": "''' +
            self.config.get('VDP', 'vtaPortfolioNumber') + '''",
                "previousCardNumber": null,
                "productId": null,
                "productIdDescription": "Credit",
                "productType": "Credit",
                "productTypeExtendedCode": "Credit",
                "rpin": null
            }
        ],
        "communityCode": "''' + self.config.get('VDP', 'vtaCommunityCode') +
            '''",
        "contacts": [
            {
                "contactNickName": "testEmail",
                "contactType": "Email",
                "contactValue": "*****@*****.**",
                "isVerified": true,
                "lastUpdateDateTime": "''' + date + '''",
                "mobileCountryCode": null,
                "mobileVerificationCode": null,
                "mobileVerificationCodeDate": "''' +
            datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") + '''",
                "platform": "None",
                "preferredEmailFormat": "Html",
                "securityPhrase": null,
                "status": "Active"
            }
        ],
        "customerEnrollmentDate": "''' + date + '''",
        "customerId": "a1bb6fe1-ea64-4269-b29d-169aebd8780a",
        "firstName": "James",
        "isActive": ''' + self.config.get('VDP', 'vtaCreateCustomerIsActive') +
            ''',
        "lastName": "Bond",
        "preferredCountryCode": "''' +
            self.config.get('VDP', 'vtaCreateCustomerPreferedCountryCode') +
            '''",
        "preferredCurrencyCode": "''' +
            self.config.get('VDP', 'vtaCreateCustomerPreferedCurrencyCode') +
            '''",
        "preferredFuelAmount": "75",
        "preferredLanguage": "''' +
            self.config.get('VDP', 'vtaCreateCustomerPreferedLanguage') + '''",
        "preferredTimeZone": "''' +
            self.config.get('VDP', 'vtaCreateCustomerPreferedTimeZone') + '''",
        "preferredTipPercentage": "15"
    }
}''')

    def test_get_customers(self):
        base_uri = 'vta/'
        resource_path = 'v3/communities/' + self.config.get(
            'VDP', 'vtaCommunityCode') + "/customers"
        response = self.visa_api_client.do_mutual_auth_request(
            base_uri + resource_path, self.create_customer_request,
            'Create Customers Test', 'post',
            {'ServiceId': self.config.get('VDP', 'vtaServiceId')})
        self.assertEqual(str(response.status_code), "201",
                         "Create Customers Test failed")
        pass
class TestManageCustomers(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.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
        self.visa_api_client = VisaAPIClient()
        self.create_customer_request = json.loads('''{
    "customer": {
        "cards": [
            {
                "address": '''+ self.config.get('VDP','vtaCreateCustomerAddress') + ''',
                "billCycleDay": "7",
                "bin": 431263,
                "cardEnrollmentDate": "''' + date + '''",
                "cardExpiryDate": "''' + self.config.get('VDP','vtaCreateCustomerCardExpiryDate') + '''",
                "cardNickName": "My Card",
                "cardNumber": "''' + self.config.get('VDP','vtaCreateCustomerCardNumber') + '''",
                "cardSecurityCode": "''' + self.config.get('VDP','vtaCreateCustomerCardSecurityCode') + '''",
                "contactServiceOfferings": [
                    {
                        "contact": {
                            "contactNickName": "testEmail",
                            "contactType": "Email",
                            "contactValue": "*****@*****.**",
                            "isVerified": true,
                            "lastUpdateDateTime": "''' + date + '''",
                            "mobileCountryCode": null,
                            "mobileVerificationCode": null,
                            "mobileVerificationCodeDate": "''' + datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") + '''",
                            "platform": "None",
                            "preferredEmailFormat": "Html",
                            "securityPhrase": null,
                            "status": "Active"
                        },
                        "serviceOfferings": [
                            {
                                "isActive": true,
                                "offeringId": "Threshold",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            },
                            {
                                "isActive": true,
                                "offeringId": "CrossBorder",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            },
                            {
                                "isActive": true,
                                "offeringId": "Declined",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            },
                            {
                                "isActive": true,
                                "offeringId": "CardNotPresent",
                                "offeringProperties": [
                                    {
                                        "key": "ThresholdAmount",
                                        "value": "10"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "isActive": true,
                "lastFour": "''' + self.config.get('VDP','vtaCreateCustomerLastFour') + '''",
                "nameOnCard": "Migration",
                "paused": false,
                "portfolioNum": "''' + self.config.get('VDP','vtaPortfolioNumber') + '''",
                "previousCardNumber": null,
                "productId": null,
                "productIdDescription": "Credit",
                "productType": "Credit",
                "productTypeExtendedCode": "Credit",
                "rpin": null
            }
        ],
        "communityCode": "''' + self.config.get('VDP','vtaCommunityCode') + '''",
        "contacts": [
            {
                "contactNickName": "testEmail",
                "contactType": "Email",
                "contactValue": "*****@*****.**",
                "isVerified": true,
                "lastUpdateDateTime": "''' + date + '''",
                "mobileCountryCode": null,
                "mobileVerificationCode": null,
                "mobileVerificationCodeDate": "''' + datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S") + '''",
                "platform": "None",
                "preferredEmailFormat": "Html",
                "securityPhrase": null,
                "status": "Active"
            }
        ],
        "customerEnrollmentDate": "''' + date + '''",
        "customerId": "a1bb6fe1-ea64-4269-b29d-169aebd8780a",
        "firstName": "James",
        "isActive": ''' + self.config.get('VDP','vtaCreateCustomerIsActive') + ''',
        "lastName": "Bond",
        "preferredCountryCode": "''' + self.config.get('VDP','vtaCreateCustomerPreferedCountryCode') + '''",
        "preferredCurrencyCode": "''' + self.config.get('VDP','vtaCreateCustomerPreferedCurrencyCode') + '''",
        "preferredFuelAmount": "75",
        "preferredLanguage": "''' + self.config.get('VDP','vtaCreateCustomerPreferedLanguage') + '''",
        "preferredTimeZone": "''' + self.config.get('VDP','vtaCreateCustomerPreferedTimeZone') + '''",
        "preferredTipPercentage": "15"
    }
}''')
    
    def test_get_customers(self):
        base_uri = 'vta/'
        resource_path = 'v3/communities/'+ self.config.get('VDP','vtaCommunityCode') +"/customers";
        response = self.visa_api_client.do_mutual_auth_request(base_uri + resource_path, self.create_customer_request, 'Create Customers Test', 'post', {'ServiceId' : self.config.get('VDP','vtaServiceId')})
        self.assertEqual(str(response.status_code) ,"201" ,"Create Customers 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