# -*- coding: utf-8 -*-

"""
pqapiv2

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""

import json
import dateutil.parser

from tests.controllers.controller_test_base import ControllerTestBase
from tests.test_helper import TestHelper
from pqapiv2.api_helper import APIHelper
from pqapiv2.models.payment_request import PaymentRequest


class PaymentsControllerTests(ControllerTestBase):

    @classmethod
    def setUpClass(cls):
        super(PaymentsControllerTests, cls).setUpClass()
        cls.controller = cls.client.payments
        cls.response_catcher = cls.controller.http_call_back

    # Retrieve a list of all payments that supports filtering, sorting, and pagination through existing mechanisms.
    def test_retrieve_payment(self):
        # Parameters for the API call
        pmnt_token = 'pmnt-d3ff8a0d-aec9-49a6-a95b-6191aebeca20'
        x_my_pay_quicker_version = '2020.02.24'
        filter = '\'name\'*\'Fra\'||*\'Ger\',\'numericCode\'>\'5\''
        language = 'en-US'

        # Perform the API call through the SDK function
        result = self.controller.retrieve_payment(pmnt_token, x_my_pay_quicker_version, filter, language)

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

        # Test headers
        expected_headers = {}
        expected_headers['content-type'] = 'application/json'

        self.assertTrue(TestHelper.match_headers(expected_headers, self.response_catcher.response.headers))


    # Accept an open payment quote.
    def test_accept_payment_quote(self):
        # Parameters for the API call
        pmnt_token = 'pmnt-d3ff8a0d-aec9-49a6-a95b-6191aebeca20'
        x_my_pay_quicker_version = '2020.02.24'
        body = None

        # Perform the API call through the SDK function
        result = self.controller.accept_payment_quote(pmnt_token, x_my_pay_quicker_version, body)

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

        # Test headers
        expected_headers = {}
        expected_headers['content-type'] = 'application/json'

        self.assertTrue(TestHelper.match_headers(expected_headers, self.response_catcher.response.headers))


    # Cancel an open payment quote.
    def test_cancel_payment_quote(self):
        # Parameters for the API call
        pmnt_token = 'pmnt-d3ff8a0d-aec9-49a6-a95b-6191aebeca20'
        x_my_pay_quicker_version = '2020.02.24'

        # Perform the API call through the SDK function
        self.controller.cancel_payment_quote(pmnt_token, x_my_pay_quicker_version)

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

    # Perform a payment retraction for the full payment amount.
    def test_retract_payment_full(self):
        # Parameters for the API call
        pmnt_token = 'pmnt-d3ff8a0d-aec9-49a6-a95b-6191aebeca20'
        x_my_pay_quicker_version = '2020.02.24'

        # Perform the API call through the SDK function
        self.controller.retract_payment_full(pmnt_token, x_my_pay_quicker_version)

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

    # Perform a payment retraction for a partial payment amount.
    def test_retract_payment_partial(self):
        # Parameters for the API call
        pmnt_token = 'pmnt-d3ff8a0d-aec9-49a6-a95b-6191aebeca20'
        x_my_pay_quicker_version = '2020.02.24'

        # Perform the API call through the SDK function
        self.controller.retract_payment_partial(pmnt_token, x_my_pay_quicker_version)

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

    # Retrieve a list of all payments that supports filtering, sorting, and pagination through existing mechanisms.
    def test_list_payments(self):
        # Parameters for the API call
        x_my_pay_quicker_version = '2020.02.24'
        page = None
        page_size = 20
        filter = '\'name\'*\'Fra\'||*\'Ger\',\'numericCode\'>\'5\''
        sort = '-name'
        language = 'en-US'

        # Perform the API call through the SDK function
        result = self.controller.list_payments(x_my_pay_quicker_version, page, page_size, filter, sort, language)

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

        # Test headers
        expected_headers = {}
        expected_headers['content-type'] = 'application/json'

        self.assertTrue(TestHelper.match_headers(expected_headers, self.response_catcher.response.headers))


    # Create a payment quote. 
    def test_create_payment_quote(self):
        # Parameters for the API call
        x_my_pay_quicker_version = '2020.02.24'
        body = None

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

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

        # Test headers
        expected_headers = {}
        expected_headers['content-type'] = 'application/json'

        self.assertTrue(TestHelper.match_headers(expected_headers, self.response_catcher.response.headers))


