Exemplo n.º 1
0
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 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 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
Exemplo n.º 4
0
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 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 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