diff --git a/resources/cassettes/test_bill_create.yaml b/resources/cassettes/test_bill_create.yaml new file mode 100644 index 0000000..fbf42f4 --- /dev/null +++ b/resources/cassettes/test_bill_create.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: '{"customer_id": 2481258, "code": "my-first-bill", "installments": 1, "payment_method_code": + "credit_card", "bill_items": [{"product_code": "product-1", "amount": 100.0}], + "payment_profile": {"id": 2284520}}' + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['206'] + Content-Type: [application/json] + User-Agent: [python-requests/2.13.0] + method: POST + uri: https://app.vindi.com.br/api/v1/bills + response: + body: {string: "{\"bill\":{\"id\":7064381,\"code\":\"my-first-bill\",\"amount\":\"100.0\",\"installments\":1,\"status\":\"pending\",\"seen_at\":null,\"billing_at\":null,\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"url\":\"https://app.vindi.com.br/customer/bills/7064381?token=db96ea6a-561f-44ab-a040-b0909c739564\",\"created_at\":\"2017-04-21T09:18:55.000-03:00\",\"updated_at\":\"2017-04-21T09:18:56.000-03:00\",\"bill_items\":[{\"id\":8362517,\"amount\":\"100.0\",\"quantity\":null,\"pricing_range_id\":null,\"description\":null,\"pricing_schema\":null,\"product\":{\"id\":82534,\"name\":\"Product + 1\",\"code\":\"product-1\"},\"product_item\":null,\"discount\":null}],\"charges\":[{\"id\":6803582,\"amount\":\"100.0\",\"status\":\"pending\",\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"paid_at\":null,\"installments\":1,\"attempt_count\":0,\"next_attempt\":null,\"print_url\":null,\"created_at\":\"2017-04-21T09:18:56.000-03:00\",\"updated_at\":\"2017-04-21T09:18:56.000-03:00\",\"last_transaction\":null,\"payment_method\":{\"id\":17293,\"public_name\":\"Cart\xE3o + de cr\xE9dito\",\"name\":\"Cart\xE3o de cr\xE9dito\",\"code\":\"credit_card\",\"type\":\"PaymentMethod::CreditCard\"}}],\"customer\":{\"id\":2481258,\"name\":\"John + Doe\",\"email\":\"john@doe.com\",\"code\":null},\"period\":null,\"subscription\":null,\"metadata\":{},\"payment_profile\":{\"id\":2284520,\"holder_name\":\"JOHN + DOE\",\"registry_code\":null,\"bank_branch\":null,\"bank_account\":null,\"card_expiration\":\"2020-12-31T23:59:59.000-02:00\",\"card_number_first_six\":\"555555\",\"card_number_last_four\":\"5557\",\"token\":\"ba3cf5f2-143f-44df-b09e-0bc69dfb7a96\",\"created_at\":\"2017-04-20T08:59:01.000-03:00\",\"payment_company\":{\"id\":1,\"name\":\"MasterCard\",\"code\":\"mastercard\"}}}}"} + headers: + Cache-Control: ['max-age=0, private, must-revalidate'] + Connection: [keep-alive] + Content-Length: ['1561'] + Content-Type: [application/json; charset=UTF-8] + Date: ['Fri, 21 Apr 2017 12:18:56 GMT'] + ETag: [W/"4c7430bea9c7892cad07e10dbefd87cc"] + Rate-Limit-Limit: ['120'] + Rate-Limit-Remaining: ['119'] + Rate-Limit-Reset: ['1492777195'] + Server: [nginx] + Vindi-Merchant-Id: ['5963'] + X-Request-Id: [885764eb-c2f6-444d-b1ba-fbf217f9ec45] + X-Runtime: ['0.296408'] + status: {code: 201, message: Created} +version: 1 diff --git a/resources/cassettes/test_bill_destroy.yaml b/resources/cassettes/test_bill_destroy.yaml new file mode 100644 index 0000000..a41d2c0 --- /dev/null +++ b/resources/cassettes/test_bill_destroy.yaml @@ -0,0 +1,34 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json] + User-Agent: [python-requests/2.13.0] + method: DELETE + uri: https://app.vindi.com.br/api/v1/bills/7071692 + response: + body: {string: "{\"bill\":{\"id\":7071692,\"code\":\"my-third-bill\",\"amount\":\"0.0\",\"installments\":1,\"status\":\"canceled\",\"seen_at\":null,\"billing_at\":\"2017-04-21T00:00:00.000-03:00\",\"due_at\":\"2017-04-21T23:59:59.000-03:00\",\"url\":\"https://app.vindi.com.br/customer/bills/7071692?token=4acee607-f2b6-433a-8134-67be26553f97\",\"created_at\":\"2017-04-21T11:08:49.000-03:00\",\"updated_at\":\"2017-04-21T11:49:06.666-03:00\",\"bill_items\":[{\"id\":8371854,\"amount\":\"100.0\",\"quantity\":null,\"pricing_range_id\":null,\"description\":null,\"pricing_schema\":null,\"product\":{\"id\":82534,\"name\":\"Product + 1\",\"code\":\"product-1\"},\"product_item\":null,\"discount\":null}],\"charges\":[{\"id\":6810651,\"amount\":\"100.0\",\"status\":\"canceled\",\"due_at\":\"2017-04-21T23:59:59.000-03:00\",\"paid_at\":null,\"installments\":1,\"attempt_count\":0,\"next_attempt\":null,\"print_url\":null,\"created_at\":\"2017-04-21T11:08:49.000-03:00\",\"updated_at\":\"2017-04-21T11:49:06.000-03:00\",\"last_transaction\":null,\"payment_method\":{\"id\":17293,\"public_name\":\"Cart\xE3o + de cr\xE9dito\",\"name\":\"Cart\xE3o de cr\xE9dito\",\"code\":\"credit_card\",\"type\":\"PaymentMethod::CreditCard\"}}],\"customer\":{\"id\":2481258,\"name\":\"John + Doe\",\"email\":\"john@doe.com\",\"code\":null},\"period\":null,\"subscription\":null,\"metadata\":{},\"payment_profile\":{\"id\":2284520,\"holder_name\":\"JOHN + DOE\",\"registry_code\":null,\"bank_branch\":null,\"bank_account\":null,\"card_expiration\":\"2020-12-31T23:59:59.000-02:00\",\"card_number_first_six\":\"555555\",\"card_number_last_four\":\"5557\",\"token\":\"ba3cf5f2-143f-44df-b09e-0bc69dfb7a96\",\"created_at\":\"2017-04-20T08:59:01.000-03:00\",\"payment_company\":{\"id\":1,\"name\":\"MasterCard\",\"code\":\"mastercard\"}}}}"} + headers: + Cache-Control: ['max-age=0, private, must-revalidate'] + Connection: [keep-alive] + Content-Length: ['1588'] + Content-Type: [application/json; charset=UTF-8] + Date: ['Fri, 21 Apr 2017 14:49:06 GMT'] + ETag: [W/"cd9afb6ea9fb00294280b967826cc5bd"] + Rate-Limit-Limit: ['120'] + Rate-Limit-Remaining: ['118'] + Rate-Limit-Reset: ['1492786149'] + Server: [nginx] + Vindi-Merchant-Id: ['5963'] + X-Request-Id: [fbe252be-cb20-4f66-b0bb-baf2ef04f1ac] + X-Runtime: ['0.112778'] + status: {code: 200, message: OK} +version: 1 diff --git a/resources/cassettes/test_bill_list.yaml b/resources/cassettes/test_bill_list.yaml new file mode 100644 index 0000000..58b480a --- /dev/null +++ b/resources/cassettes/test_bill_list.yaml @@ -0,0 +1,35 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json] + User-Agent: [python-requests/2.13.0] + method: GET + uri: https://app.vindi.com.br/api/v1/bills + response: + body: {string: "{\"bills\":[{\"id\":7064381,\"code\":\"my-first-bill\",\"amount\":\"100.0\",\"installments\":1,\"status\":\"pending\",\"seen_at\":null,\"billing_at\":null,\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"url\":\"https://app.vindi.com.br/customer/bills/7064381?token=db96ea6a-561f-44ab-a040-b0909c739564\",\"created_at\":\"2017-04-21T09:18:55.000-03:00\",\"updated_at\":\"2017-04-21T09:18:56.000-03:00\",\"bill_items\":[{\"id\":8362517,\"amount\":\"100.0\",\"quantity\":null,\"pricing_range_id\":null,\"description\":null,\"pricing_schema\":null,\"product\":{\"id\":82534,\"name\":\"Product + 1\",\"code\":\"product-1\"},\"product_item\":null,\"discount\":null}],\"charges\":[{\"id\":6803582,\"amount\":\"100.0\",\"status\":\"pending\",\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"paid_at\":null,\"installments\":1,\"attempt_count\":0,\"next_attempt\":null,\"print_url\":null,\"created_at\":\"2017-04-21T09:18:56.000-03:00\",\"updated_at\":\"2017-04-21T09:18:56.000-03:00\",\"last_transaction\":null,\"payment_method\":{\"id\":17293,\"public_name\":\"Cart\xE3o + de cr\xE9dito\",\"name\":\"Cart\xE3o de cr\xE9dito\",\"code\":\"credit_card\",\"type\":\"PaymentMethod::CreditCard\"}}],\"customer\":{\"id\":2481258,\"name\":\"John + Doe\",\"email\":\"john@doe.com\",\"code\":null},\"period\":null,\"subscription\":null,\"metadata\":{},\"payment_profile\":{\"id\":2284520,\"holder_name\":\"JOHN + DOE\",\"registry_code\":null,\"bank_branch\":null,\"bank_account\":null,\"card_expiration\":\"2020-12-31T23:59:59.000-02:00\",\"card_number_first_six\":\"555555\",\"card_number_last_four\":\"5557\",\"token\":\"ba3cf5f2-143f-44df-b09e-0bc69dfb7a96\",\"created_at\":\"2017-04-20T08:59:01.000-03:00\",\"payment_company\":{\"id\":1,\"name\":\"MasterCard\",\"code\":\"mastercard\"}}}]}"} + headers: + Cache-Control: ['max-age=0, private, must-revalidate'] + Connection: [keep-alive] + Content-Length: ['1564'] + Content-Type: [application/json; charset=UTF-8] + Date: ['Fri, 21 Apr 2017 12:21:51 GMT'] + ETag: [W/"bdd79778039b209ced3f464578a4a527"] + Per-Page: ['25'] + Rate-Limit-Limit: ['120'] + Rate-Limit-Remaining: ['119'] + Rate-Limit-Reset: ['1492777371'] + Server: [nginx] + Total: ['1'] + Vindi-Merchant-Id: ['5963'] + X-Request-Id: [5e28c6d7-9dd1-42ec-87e9-308a00a6ccc2] + X-Runtime: ['0.040105'] + status: {code: 200, message: OK} +version: 1 diff --git a/resources/cassettes/test_bill_retrieve.yaml b/resources/cassettes/test_bill_retrieve.yaml new file mode 100644 index 0000000..ad81702 --- /dev/null +++ b/resources/cassettes/test_bill_retrieve.yaml @@ -0,0 +1,33 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json] + User-Agent: [python-requests/2.13.0] + method: GET + uri: https://app.vindi.com.br/api/v1/bills/7064381 + response: + body: {string: "{\"bill\":{\"id\":7064381,\"code\":\"my-first-bill\",\"amount\":\"100.0\",\"installments\":1,\"status\":\"pending\",\"seen_at\":null,\"billing_at\":null,\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"url\":\"https://app.vindi.com.br/customer/bills/7064381?token=db96ea6a-561f-44ab-a040-b0909c739564\",\"created_at\":\"2017-04-21T09:18:55.000-03:00\",\"updated_at\":\"2017-04-21T09:18:56.000-03:00\",\"bill_items\":[{\"id\":8362517,\"amount\":\"100.0\",\"quantity\":null,\"pricing_range_id\":null,\"description\":null,\"pricing_schema\":null,\"product\":{\"id\":82534,\"name\":\"Product + 1\",\"code\":\"product-1\"},\"product_item\":null,\"discount\":null}],\"charges\":[{\"id\":6803582,\"amount\":\"100.0\",\"status\":\"pending\",\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"paid_at\":null,\"installments\":1,\"attempt_count\":0,\"next_attempt\":null,\"print_url\":null,\"created_at\":\"2017-04-21T09:18:56.000-03:00\",\"updated_at\":\"2017-04-21T09:18:56.000-03:00\",\"last_transaction\":null,\"payment_method\":{\"id\":17293,\"public_name\":\"Cart\xE3o + de cr\xE9dito\",\"name\":\"Cart\xE3o de cr\xE9dito\",\"code\":\"credit_card\",\"type\":\"PaymentMethod::CreditCard\"}}],\"customer\":{\"id\":2481258,\"name\":\"John + Doe\",\"email\":\"john@doe.com\",\"code\":null},\"period\":null,\"subscription\":null,\"metadata\":{},\"payment_profile\":{\"id\":2284520,\"holder_name\":\"JOHN + DOE\",\"registry_code\":null,\"bank_branch\":null,\"bank_account\":null,\"card_expiration\":\"2020-12-31T23:59:59.000-02:00\",\"card_number_first_six\":\"555555\",\"card_number_last_four\":\"5557\",\"token\":\"ba3cf5f2-143f-44df-b09e-0bc69dfb7a96\",\"created_at\":\"2017-04-20T08:59:01.000-03:00\",\"payment_company\":{\"id\":1,\"name\":\"MasterCard\",\"code\":\"mastercard\"}}}}"} + headers: + Cache-Control: ['max-age=0, private, must-revalidate'] + Connection: [keep-alive] + Content-Length: ['1561'] + Content-Type: [application/json; charset=UTF-8] + Date: ['Fri, 21 Apr 2017 12:23:05 GMT'] + ETag: [W/"4c7430bea9c7892cad07e10dbefd87cc"] + Rate-Limit-Limit: ['120'] + Rate-Limit-Remaining: ['119'] + Rate-Limit-Reset: ['1492777445'] + Server: [nginx] + Vindi-Merchant-Id: ['5963'] + X-Request-Id: [cdbd7ba3-40f3-4937-97d5-549074eac0bd] + X-Runtime: ['0.040206'] + status: {code: 200, message: OK} +version: 1 diff --git a/resources/cassettes/test_bill_update.yaml b/resources/cassettes/test_bill_update.yaml new file mode 100644 index 0000000..6e8691a --- /dev/null +++ b/resources/cassettes/test_bill_update.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: '{"code": "first-bill"}' + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['22'] + Content-Type: [application/json] + User-Agent: [python-requests/2.13.0] + method: PUT + uri: https://app.vindi.com.br/api/v1/bills/7064381 + response: + body: {string: "{\"bill\":{\"id\":7064381,\"code\":\"first-bill\",\"amount\":\"100.0\",\"installments\":1,\"status\":\"paid\",\"seen_at\":\"2017-04-21T09:25:17.000-03:00\",\"billing_at\":null,\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"url\":\"https://app.vindi.com.br/customer/bills/7064381?token=db96ea6a-561f-44ab-a040-b0909c739564\",\"created_at\":\"2017-04-21T09:18:55.000-03:00\",\"updated_at\":\"2017-04-21T11:44:02.492-03:00\",\"bill_items\":[{\"id\":8362517,\"amount\":\"100.0\",\"quantity\":null,\"pricing_range_id\":null,\"description\":null,\"pricing_schema\":null,\"product\":{\"id\":82534,\"name\":\"Product + 1\",\"code\":\"product-1\"},\"product_item\":null,\"discount\":null}],\"charges\":[{\"id\":6803582,\"amount\":\"100.0\",\"status\":\"paid\",\"due_at\":\"2017-04-24T23:59:59.000-03:00\",\"paid_at\":\"2017-04-21T10:40:52.000-03:00\",\"installments\":1,\"attempt_count\":1,\"next_attempt\":null,\"print_url\":null,\"created_at\":\"2017-04-21T09:18:56.000-03:00\",\"updated_at\":\"2017-04-21T10:40:52.000-03:00\",\"last_transaction\":{\"id\":10384095,\"transaction_type\":\"charge\",\"status\":\"success\",\"amount\":\"100.0\",\"installments\":1,\"gateway_message\":\"Transacao + aprovada\",\"gateway_response_code\":\"\",\"gateway_authorization\":\"2C2B04FE23B6958DF90E72AADEA3AD87\",\"gateway_transaction_id\":\"dacbe4d7-591c-4949-ae6e-5932aa2501be\",\"gateway_response_fields\":{\"test_auth\":\"cfa315f873c37a4cfca1\"},\"fraud_detector_score\":null,\"fraud_detector_status\":null,\"fraud_detector_id\":null,\"created_at\":\"2017-04-21T10:40:52.000-03:00\",\"gateway\":{\"id\":10371,\"connector\":\"test\"},\"payment_profile\":{\"id\":2284520,\"holder_name\":\"JOHN + DOE\",\"registry_code\":null,\"bank_branch\":null,\"bank_account\":null,\"card_expiration\":\"2020-12-31T23:59:59.000-02:00\",\"card_number_first_six\":\"555555\",\"card_number_last_four\":\"5557\",\"token\":\"ba3cf5f2-143f-44df-b09e-0bc69dfb7a96\",\"created_at\":\"2017-04-20T08:59:01.000-03:00\",\"payment_company\":{\"id\":1,\"name\":\"MasterCard\",\"code\":\"mastercard\"}}},\"payment_method\":{\"id\":17293,\"public_name\":\"Cart\xE3o + de cr\xE9dito\",\"name\":\"Cart\xE3o de cr\xE9dito\",\"code\":\"credit_card\",\"type\":\"PaymentMethod::CreditCard\"}}],\"customer\":{\"id\":2481258,\"name\":\"John + Doe\",\"email\":\"john@doe.com\",\"code\":null},\"period\":null,\"subscription\":null,\"metadata\":{},\"payment_profile\":{\"id\":2284520,\"holder_name\":\"JOHN + DOE\",\"registry_code\":null,\"bank_branch\":null,\"bank_account\":null,\"card_expiration\":\"2020-12-31T23:59:59.000-02:00\",\"card_number_first_six\":\"555555\",\"card_number_last_four\":\"5557\",\"token\":\"ba3cf5f2-143f-44df-b09e-0bc69dfb7a96\",\"created_at\":\"2017-04-20T08:59:01.000-03:00\",\"payment_company\":{\"id\":1,\"name\":\"MasterCard\",\"code\":\"mastercard\"}}}}"} + headers: + Cache-Control: ['max-age=0, private, must-revalidate'] + Connection: [keep-alive] + Content-Length: ['2510'] + Content-Type: [application/json; charset=UTF-8] + Date: ['Fri, 21 Apr 2017 14:44:02 GMT'] + ETag: [W/"6a48b84d304c981e175ebf9f46aedcc9"] + Rate-Limit-Limit: ['120'] + Rate-Limit-Remaining: ['119'] + Rate-Limit-Reset: ['1492785902'] + Server: [nginx] + Vindi-Merchant-Id: ['5963'] + X-Request-Id: [092d54bc-c315-4ee3-a0b0-7eb239f08202] + X-Runtime: ['0.099385'] + status: {code: 200, message: OK} +version: 1 diff --git a/tests/conftest.py b/tests/conftest.py index 8be68ae..5fdd1e4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -87,3 +87,21 @@ def payment_profile_data(): 'payment_company_code': 'mastercard', 'customer_id': 2481258 } + + +@pytest.fixture +def bill_data(): + return { + 'id': 7064381, + 'customer_id': 2481258, + 'code': 'my-first-bill', + 'installments': 1, + 'payment_method_code': 'credit_card', + 'bill_items': [{ + 'product_code': 'product-1', + 'amount': 100.00 + }], + 'payment_profile': { + 'id': 2284520 + } + } diff --git a/tests/test_api.py b/tests/test_api.py index 616df7a..71b0ca8 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -6,3 +6,4 @@ def test_get_api_instance(): assert api.api_root_url == 'https://app.vindi.com.br/api/v1/' assert api.headers['Authorization'] == 'Basic Og==' assert api.headers['Content-Type'] == 'application/json' + assert api.json_encode_body diff --git a/tests/test_api_resources.py b/tests/test_api_resources.py index 5da4dde..cddeb89 100644 --- a/tests/test_api_resources.py +++ b/tests/test_api_resources.py @@ -141,3 +141,45 @@ def test_payment_profiles_destroy(api, payment_profile_data): assert response.status_code == status.HTTP_200_OK assert response.body['payment_profile']['id'] == payment_profile_data['id'] assert response.body['payment_profile']['status'] == 'inactive' + + +@vcr.use_cassette() +def test_bill_create(api, bill_data): + body = bill_data + response = api.bills.create(body=body) + assert response.status_code == status.HTTP_201_CREATED + assert response.body['bill']['id'] == bill_data['id'] + + +@vcr.use_cassette() +def test_bill_list(api): + response = api.bills.list() + assert response.status_code == status.HTTP_200_OK + assert 'bills' in response.body + + +@vcr.use_cassette() +def test_bill_retrieve(api, bill_data): + response = api.bills.retrieve(bill_data['id']) + assert response.status_code == status.HTTP_200_OK + assert response.body['bill']['id'] == bill_data['id'] + + +@vcr.use_cassette() +def test_bill_update(api, bill_data): + body = { + 'code': 'first-bill' + } + response = api.bills.update(bill_data['id'], body=body) + assert response.status_code == status.HTTP_200_OK + assert response.body['bill']['id'] == bill_data['id'] + assert response.body['bill']['code'] == body['code'] + + +@vcr.use_cassette() +def test_bill_destroy(api, bill_data): + id = 7071692 + response = api.bills.destroy(id) + assert response.status_code == status.HTTP_200_OK + assert response.body['bill']['id'] == id + assert response.body['bill']['status'] == 'canceled' diff --git a/vindi/api.py b/vindi/api.py index 1d21397..ec38bdc 100644 --- a/vindi/api.py +++ b/vindi/api.py @@ -9,29 +9,80 @@ def get_api_instance(token='', timeout=3): 'Authorization': basic_http_auth(token, ''), 'Content-Type': 'application/json' } + import_batches_headers = { + 'Authorization': basic_http_auth(token, ''), + 'Content-Type': 'multipart/form-data' + } api_root_url = 'https://app.vindi.com.br/api/v1/' api = API( api_root_url=api_root_url, headers=headers, json_encode_body=True, timeout=timeout ) - api.add_resource(resource_name='customers', resource_class=resource.CustomerResource) - api.add_resource(resource_name='plans', resource_class=resource.PlanResource) - api.add_resource(resource_name='products', resource_class=resource.ProductResource) - api.add_resource(resource_name='payment_methods', resource_class=resource.PaymentMethodResource) - api.add_resource(resource_name='discounts', resource_class=resource.DiscountResource) - api.add_resource(resource_name='subscriptions', resource_class=resource.SubscriptionResource) - api.add_resource(resource_name='product_items', resource_class=resource.ProductItemResource) - api.add_resource(resource_name='periods', resource_class=resource.PeriodResource) - api.add_resource(resource_name='bills', resource_class=resource.BillResource) - api.add_resource(resource_name='bill_items', resource_class=resource.BillItemResource) - api.add_resource(resource_name='charges', resource_class=resource.ChargeResource) - api.add_resource(resource_name='transactions', resource_class=resource.TransactionResource) - api.add_resource(resource_name='payment_profiles', resource_class=resource.PaymentProfileResource) - api.add_resource(resource_name='usages', resource_class=resource.UsageResource) - api.add_resource(resource_name='invoices', resource_class=resource.InvoiceResource) - api.add_resource(resource_name='movements', resource_class=resource.MovementResource) - api.add_resource(resource_name='messages', resource_class=resource.MessageResource) - api.add_resource(resource_name='import_batches', resource_class=resource.ImportBatchResource) - api.add_resource(resource_name='merchant', resource_class=resource.MerchantResource) - api.add_resource(resource_name='issues', resource_class=resource.IssueResource) + api.add_resource( + resource_name='customers', resource_class=resource.CustomerResource + ) + api.add_resource( + resource_name='plans', resource_class=resource.PlanResource + ) + api.add_resource( + resource_name='products', resource_class=resource.ProductResource + ) + api.add_resource( + resource_name='payment_methods', + resource_class=resource.PaymentMethodResource + ) + api.add_resource( + resource_name='discounts', resource_class=resource.DiscountResource + ) + api.add_resource( + resource_name='subscriptions', + resource_class=resource.SubscriptionResource + ) + api.add_resource( + resource_name='product_items', + resource_class=resource.ProductItemResource + ) + api.add_resource( + resource_name='periods', resource_class=resource.PeriodResource + ) + api.add_resource( + resource_name='bills', resource_class=resource.BillResource + ) + api.add_resource( + resource_name='bill_items', resource_class=resource.BillItemResource + ) + api.add_resource( + resource_name='charges', resource_class=resource.ChargeResource + ) + api.add_resource( + resource_name='transactions', + resource_class=resource.TransactionResource + ) + api.add_resource( + resource_name='payment_profiles', + resource_class=resource.PaymentProfileResource + ) + api.add_resource( + resource_name='usages', resource_class=resource.UsageResource + ) + api.add_resource( + resource_name='invoices', resource_class=resource.InvoiceResource + ) + api.add_resource( + resource_name='movements', resource_class=resource.MovementResource + ) + api.add_resource( + resource_name='messages', resource_class=resource.MessageResource + ) + api.add_resource( + resource_name='import_batches', + resource_class=resource.ImportBatchResource, + json_encode_body=False, headers=import_batches_headers + ) + api.add_resource( + resource_name='merchant', resource_class=resource.MerchantResource + ) + api.add_resource( + resource_name='issues', resource_class=resource.IssueResource + ) return api