def test_test_get_credit_card(self):
        # Parameters for the API call
        token = '56ac1a30-6ba2-4047-9b8c-70f97a5502c5'

        # Perform the API call through the SDK function
        result = self.controller.get_credit_card(token)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '{"customerIdentifier":"sdkautotest4","accountIdentifier":"sdkautotest5","t'
            'oken":"56ac1a30-6ba2-4047-9b8c-70f97a5502c5","label":"SDK Auto Testing Card'
            ' 1","lastFourDigits":"4444","expirationDate":"2020-01","status":"ACTIVE","c'
            'reatedDate":"2018-04-26T18:52:17.575Z","activationDate":"2018-04-26T18:52:1'
            '7.575Z","contactInformation":[{"fullName":"Test User","emailAddress":"test@'
            'example.com"},{"fullName":"Test Man Two","emailAddress":"*****@*****.**"'
            '}],"accountNumber":"A32386768"}')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(
            TestHelper.match_body(expected_body,
                                  received_body,
                                  check_values=True))
    def test_test_retrieve_catalog(self):

        # Perform the API call through the SDK function
        result = self.controller.get_catalog()

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '{"catalogName":"TestCatalog","brands":[{"brandKey":"B916708","brandName":"'
            'Amazon.com","disclaimer":"disclaimer","description":"desc","shortDescriptio'
            'n":"short desc","terms":"terms","createdDate":"2016-06-17T16:52:24Z","lastU'
            'pdateDate":"2017-10-23T22:18:51Z","imageUrls":{"80w-326ppi":"https://d30s7y'
            'zk2az89n.cloudfront.net/images/brands/b916708-80w-326ppi.png","130w-326ppi"'
            ':"https://d30s7yzk2az89n.cloudfront.net/images/brands/b916708-130w-326ppi.p'
            'ng","200w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/images/brands/b916'
            '708-200w-326ppi.png","278w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/i'
            'mages/brands/b916708-278w-326ppi.png","300w-326ppi":"https://d30s7yzk2az89n'
            '.cloudfront.net/images/brands/b916708-300w-326ppi.png","1200w-326ppi":"http'
            's://d30s7yzk2az89n.cloudfront.net/images/brands/b916708-1200w-326ppi.png"},'
            '"status":"active","items":[{"utid":"U666425","rewardName":"Amazon.com Gift '
            'Card","currencyCode":"USD","status":"active","valueType":"VARIABLE_VALUE","'
            'rewardType":"gift card","minValue":0.01,"maxValue":2000,"createdDate":"2016'
            '-06-17T17:38:45.294Z","lastUpdateDate":"2017-12-15T01:27:49.607Z","countrie'
            's":["US"]}]},{"brandKey":"B725361","brandName":"AMC Theatres®","disclaimer"'
            ':"discl","description":"desc","shortDescription":"short desc","terms":"term'
            's","createdDate":"2016-06-23T21:53:45Z","lastUpdateDate":"2016-07-25T22:41:'
            '11Z","imageUrls":{"80w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/image'
            's/brands/b725361-80w-326ppi.png","130w-326ppi":"https://d30s7yzk2az89n.clou'
            'dfront.net/images/brands/b725361-130w-326ppi.png","200w-326ppi":"https://d3'
            '0s7yzk2az89n.cloudfront.net/images/brands/b725361-200w-326ppi.png","278w-32'
            '6ppi":"https://d30s7yzk2az89n.cloudfront.net/images/brands/b725361-278w-326'
            'ppi.png","300w-326ppi":"https://d30s7yzk2az89n.cloudfront.net/images/brands'
            '/b725361-300w-326ppi.png","1200w-326ppi":"https://d30s7yzk2az89n.cloudfront'
            '.net/images/brands/b725361-1200w-326ppi.png"},"status":"active","items":[{"'
            'utid":"U154092","rewardName":"AMC® Gift Card $10.00","currencyCode":"USD","'
            'status":"active","valueType":"FIXED_VALUE","rewardType":"gift card","faceVa'
            'lue":10,"createdDate":"2016-07-27T02:54:30.142Z","lastUpdateDate":"2016-09-'
            '21T20:59:01.874Z","countries":["US"]},{"utid":"U913336","rewardName":"AMC® '
            'Gift Card $25.00","currencyCode":"USD","status":"active","valueType":"FIXED'
            '_VALUE","rewardType":"gift card","faceValue":25,"createdDate":"2016-07-27T0'
            '2:55:37.899Z","lastUpdateDate":"2016-10-17T20:55:00.386Z","countries":["US"'
            ']},{"utid":"U652361","rewardName":"AMC® Gift Card $50.00","currencyCode":"U'
            'SD","status":"active","valueType":"FIXED_VALUE","rewardType":"gift card","f'
            'aceValue":50,"createdDate":"2016-07-27T02:56:53.391Z","lastUpdateDate":"201'
            '6-09-21T20:59:16.283Z","countries":["US"]}]}]}')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(TestHelper.match_body(expected_body, received_body))
    def test_test_status_is_ok(self):

        # Perform the API call through the SDK function
        result = self.controller.get_system_status()

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize('{"status":"UP"}')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(TestHelper.match_body(expected_body, received_body))
    def test_test_get_all_accounts(self):

        # Perform the API call through the SDK function
        result = self.controller.get_all_accounts()

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '[{"accountIdentifier":"sdkautotest2","accountNumber":"A11720237","displayN'
            'ame":"SDK Auto Testing 2","currencyCode":"USD","currentBalance":0,"createdA'
            't":"2018-04-26T18:13:45.196Z","status":"ACTIVE","contactEmail":"test@exampl'
            'e.com"}]')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(
            TestHelper.match_body(expected_body,
                                  received_body,
                                  check_values=True))
    def test_test_get_all_customers(self):

        # Perform the API call through the SDK function
        result = self.controller.get_all_customers()

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)
        
        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '[{"customerIdentifier":"sdkautotest1","displayName":"SDK Auto Testing 1","'
            'status":"active","createdAt":"2018-04-26T18:13:12.874Z","accounts":[{"accou'
            'ntIdentifier":"sdkautotest3","accountNumber":"A01335766","displayName":"SDK'
            ' Auto Testing 3","createdAt":"2018-04-26T18:16:51.652Z","status":"ACTIVE"},'
            '{"accountIdentifier":"sdkautotest2","accountNumber":"A11720237","displayNam'
            'e":"SDK Auto Testing 2","createdAt":"2018-04-26T18:13:45.196Z","status":"AC'
            'TIVE"}]}]'
            )
        received_body = APIHelper.json_deserialize(self.response_catcher.response.raw_body)
        self.assertTrue(TestHelper.match_body(expected_body, received_body, check_values = True))
    def test_test_retrieve_exchange_rates(self):

        # Perform the API call through the SDK function
        result = self.controller.get_exchange_rates()

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '{"disclaimer":"Exchange rates are provided here for reference. They are up'
            'dated at least once a day and may have changed by time of order.","exchange'
            'Rates":[{"lastModifiedDate":"2018-04-19T13:00:14.291","rewardCurrency":"EUR'
            '","baseCurrency":"NZD","baseFx":0.59120},{"lastModifiedDate":"2018-04-19T13'
            ':00:14.291","rewardCurrency":"USD","baseCurrency":"NZD","baseFx":0.73130},{'
            '"lastModifiedDate":"2018-04-19T13:00:14.230","rewardCurrency":"INR","baseCu'
            'rrency":"AUD","baseFx":51.29066}]}')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(TestHelper.match_body(expected_body, received_body))
    def test_test_add_funds(self):
        # Parameters for the API call
        body = APIHelper.json_deserialize(
            '{"accountIdentifier":"sdkautotest5","amount":1.25,"creditCardToken":"56ac1'
            'a30-6ba2-4047-9b8c-70f97a5502c5","customerIdentifier":"sdkautotest4"}',
            DepositRequestModel.from_dictionary)

        # Perform the API call through the SDK function
        result = self.controller.add_funds(body)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '{"referenceDepositID":"RAD-180426-5407","amount":1.25,"amountCharged":1.29'
            ',"feePercent":3.5,"createdDate":"2018-04-26T18:56:28.28Z","status":"SUCCESS'
            '","accountNumber":"A32386768"}')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(TestHelper.match_body(expected_body, received_body))
    def test_test_get_deposit(self):
        # Parameters for the API call
        deposit_id = 'RAD-180426-5407'

        # Perform the API call through the SDK function
        result = self.controller.get_deposit(deposit_id)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '{"referenceDepositID":"RAD-180426-5407","amount":1.25,"amountCharged":1.29'
            ',"feePercent":3.5,"createdDate":"2018-04-26T18:56:28.28Z","status":"SUCCESS'
            '","accountNumber":"A32386768"}')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(
            TestHelper.match_body(expected_body,
                                  received_body,
                                  check_values=True))
Esempio n. 9
0
    def test_test_place_order_with_minimum_criteria(self):
        # Parameters for the API call
        body = APIHelper.json_deserialize(
            '{"accountIdentifier":"sdkautotest5","amount":1.00,"customerIdentifier":"sd'
            'kautotest4","sendEmail":false,"utid":"U561593"}',
            CreateOrderRequestModel.from_dictionary)

        # Perform the API call through the SDK function
        result = self.controller.create_order(body)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 201)

        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        expected_body = APIHelper.json_deserialize(
            '{"referenceOrderID":"RA180426-1401-64","customerIdentifier":"sdkautotest4"'
            ',"accountIdentifier":"sdkautotest5","accountNumber":"A32386768","amountChar'
            'ged":{"value":1,"currencyCode":"USD","total":1},"marginShare":{"value":0,"c'
            'urrencyCode":"USD"},"denomination":{"value":1,"currencyCode":"USD"},"utid":'
            '"U561593","rewardName":"Reward Link","sender":{"firstName":"","lastName":""'
            ',"email":""},"recipient":{"email":"","firstName":"","lastName":""},"sendEma'
            'il":false,"status":"COMPLETE","createdAt":"2018-04-26T20:08:59.624Z","rewar'
            'd":{"credentials":{"Redemption URL":"https://sandbox.rewardlink.io/r/1/ed0H'
            'tzSblNV6oFddNnnlf68eXzGQoREvcxwxu_Vi5Wk"},"credentialList":[{"label":"Redem'
            'ption URL","value":"https://sandbox.rewardlink.io/r/1/ed0HtzSblNV6oFddNnnlf'
            '68eXzGQoREvcxwxu_Vi5Wk","type":"url"}],"redemptionInstructions":"<p>&bull; '
            'Click on the redemption link above to activate your Reward Link.<br />\\r'
            '\\n&bull; Next, you will be able to spend your balance on retail gift cards'
            '.</p>\\r\\n\\r\\n<p>If you don&#39;t want to spend your entire Reward Link '
            'value right away, save the email or URL and return via the redemption link '
            '- your value will be waiting to be spent. This allows you to store the bala'
            'nce to redeem at another time.</p>\\r\\n"}}')
        received_body = APIHelper.json_deserialize(
            self.response_catcher.response.raw_body)
        self.assertTrue(TestHelper.match_body(expected_body, received_body))