From 12cb73ee7b10f91f5a0f0b32404d01a88bec2219 Mon Sep 17 00:00:00 2001 From: rodriusp Date: Tue, 5 Feb 2019 10:09:19 -0300 Subject: [PATCH 01/24] add prescripton --- __tests__/index.test.js | 23 +++++++++ package-lock.json | 24 +++++++--- src/api/prescriptions/items.js | 22 +++++++++ src/api/prescriptions/prescriptions.js | 65 ++++++++++++++++++++++++++ src/api/prescriptions/statuses.js | 26 +++++++++++ src/api/prescriptions/transactions.js | 25 ++++++++++ src/index.js | 10 ++++ 7 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 src/api/prescriptions/items.js create mode 100644 src/api/prescriptions/prescriptions.js create mode 100644 src/api/prescriptions/statuses.js create mode 100644 src/api/prescriptions/transactions.js diff --git a/__tests__/index.test.js b/__tests__/index.test.js index a56a699..39f2dca 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -85,6 +85,29 @@ test('api structure', () => { expect(typeof api.orderStatuses.create).toBe('function'); expect(typeof api.orderStatuses.update).toBe('function'); expect(typeof api.orderStatuses.delete).toBe('function'); + expect(typeof api.prescriptions.list).toBe('function'); + expect(typeof api.prescriptions.retrieve).toBe('function'); + expect(typeof api.prescriptions.create).toBe('function'); + expect(typeof api.prescriptions.update).toBe('function'); + expect(typeof api.prescriptions.delete).toBe('function'); + expect(typeof api.prescriptions.estimate).toBe('function'); + expect(typeof api.prescriptions.checkout).toBe('function'); + expect(typeof api.prescriptions.cancel).toBe('function'); + expect(typeof api.prescriptions.close).toBe('function'); + expect(typeof api.prescriptions.updateBillingAddress).toBe('function'); + expect(typeof api.prescriptions.updateShippingAddress).toBe('function'); + expect(typeof api.prescriptions.getPaymentFormSettings).toBe('function'); + expect(typeof api.prescriptions.transactions.create).toBe('function'); + expect(typeof api.prescriptions.transactions.update).toBe('function'); + expect(typeof api.prescriptions.transactions.delete).toBe('function'); + expect(typeof api.prescriptions.items.create).toBe('function'); + expect(typeof api.prescriptions.items.update).toBe('function'); + expect(typeof api.prescriptions.items.delete).toBe('function'); + expect(typeof api.prescriptionStatuses.list).toBe('function'); + expect(typeof api.prescriptionStatuses.retrieve).toBe('function'); + expect(typeof api.prescriptionStatuses.create).toBe('function'); + expect(typeof api.prescriptionStatuses.update).toBe('function'); + expect(typeof api.prescriptionStatuses.delete).toBe('function'); expect(typeof api.shippingMethods.list).toBe('function'); expect(typeof api.shippingMethods.retrieve).toBe('function'); expect(typeof api.shippingMethods.create).toBe('function'); diff --git a/package-lock.json b/package-lock.json index 1103ed8..302be3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2742,7 +2742,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3157,7 +3158,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3213,6 +3215,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3256,12 +3259,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -7382,12 +7387,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7407,7 +7414,8 @@ "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", @@ -7529,7 +7537,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -7555,6 +7564,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } diff --git a/src/api/prescriptions/items.js b/src/api/prescriptions/items.js new file mode 100644 index 0000000..7f3eb6a --- /dev/null +++ b/src/api/prescriptions/items.js @@ -0,0 +1,22 @@ +export default class PrescriptionItems { + constructor(client) { + this.client = client; + } + + create(prescriptionId, data) { + return this.client.post(`/prescriptions/${prescriptionId}/items`, data); + } + + update(prescriptionId, itemId, data) { + return this.client.put( + `/prescriptions/${prescriptionId}/items/${itemId}`, + data + ); + } + + delete(prescriptionId, itemId) { + return this.client.delete( + `/prescriptions/${prescriptionId}/items/${itemId}` + ); + } +} diff --git a/src/api/prescriptions/prescriptions.js b/src/api/prescriptions/prescriptions.js new file mode 100644 index 0000000..07f8aae --- /dev/null +++ b/src/api/prescriptions/prescriptions.js @@ -0,0 +1,65 @@ +export default class Prescriptions { + constructor(client) { + this.client = client; + this.resourceUrl = '/prescriptions'; + } + + list(filter) { + return this.client.get(this.resourceUrl, filter); + } + + retrieve(prescriptionId, filter) { + return this.client.get(`${this.resourceUrl}/${prescriptionId}`, filter); + } + + create(data) { + return this.client.post(this.resourceUrl, data); + } + + update(prescriptionId, data) { + return this.client.put(`${this.resourceUrl}/${prescriptionId}`, data); + } + + delete(prescriptionId) { + return this.client.delete(`${this.resourceUrl}/${prescriptionId}`); + } + + estimate(prescriptionId, data) { + return this.client.put( + `${this.resourceUrl}/${prescriptionId}/estimate`, + data + ); + } + + checkout(prescriptionId) { + return this.client.put(`${this.resourceUrl}/${prescriptionId}/checkout`); + } + + cancel(prescriptionId) { + return this.client.put(`${this.resourceUrl}/${prescriptionId}/cancel`); + } + + close(prescriptionId) { + return this.client.put(`${this.resourceUrl}/${prescriptionId}/close`); + } + + updateBillingAddress(prescriptionId, address) { + return this.client.put( + `${this.resourceUrl}/${prescriptionId}/billing_address`, + address + ); + } + + updateShippingAddress(prescriptionId, address) { + return this.client.put( + `${this.resourceUrl}/${prescriptionId}/shipping_address`, + address + ); + } + + getPaymentFormSettings(prescriptionId) { + return this.client.get( + `${this.resourceUrl}/${prescriptionId}/payment_form_settings` + ); + } +} diff --git a/src/api/prescriptions/statuses.js b/src/api/prescriptions/statuses.js new file mode 100644 index 0000000..be97181 --- /dev/null +++ b/src/api/prescriptions/statuses.js @@ -0,0 +1,26 @@ +export default class PrescriptionStatuses { + constructor(client) { + this.client = client; + this.resourceUrl = '/order_statuses'; + } + + list(filter) { + return this.client.get(this.resourceUrl, filter); + } + + retrieve(id, filter) { + return this.client.get(`${this.resourceUrl}/${id}`, filter); + } + + create(data) { + return this.client.post(this.resourceUrl, data); + } + + update(id, data) { + return this.client.put(`${this.resourceUrl}/${id}`, data); + } + + delete(id) { + return this.client.delete(`${this.resourceUrl}/${id}`); + } +} diff --git a/src/api/prescriptions/transactions.js b/src/api/prescriptions/transactions.js new file mode 100644 index 0000000..af10882 --- /dev/null +++ b/src/api/prescriptions/transactions.js @@ -0,0 +1,25 @@ +export default class PrescriptionTransactions { + constructor(client) { + this.client = client; + } + + create(prescriptionId, data) { + return this.client.post( + `/prescriptions/${prescriptionId}/transactions`, + data + ); + } + + update(prescriptionId, transactionId, data) { + return this.client.put( + `/prescriptions/${prescriptionId}/transactions/${transactionId}`, + data + ); + } + + delete(prescriptionId, transactionId) { + return this.client.delete( + `/prescriptions/${prescriptionId}/transactions/${transactionId}` + ); + } +} diff --git a/src/index.js b/src/index.js index da39438..d4abddf 100644 --- a/src/index.js +++ b/src/index.js @@ -16,6 +16,10 @@ import CustomerGroups from './api/customerGroups'; import Customers from './api/customers'; import AjaxCart from './api/ajaxCart'; import Orders from './api/orders/orders'; +import Prescriptions from './api/prescriptions/prescriptions'; +import PrescriptionItems from './api/prescriptions/items'; +import PrescriptionStatuses from './api/prescriptions/statuses'; +import PrescriptionTransactions from './api/prescriptions/transactions'; import OrderDiscounts from './api/orders/discounts'; import OrderTransactions from './api/orders/transactions'; import OrderItems from './api/orders/items'; @@ -69,6 +73,12 @@ export default class Client { this.orders.transactions = new OrderTransactions(apiClient); this.orders.items = new OrderItems(apiClient); this.orderStatuses = new OrderStatuses(apiClient); + // prescriptions + this.prescriptions = new Prescriptions(apiClient); + this.prescriptions.items = new PrescriptionItems(apiClient); + this.prescriptions.transactions = new PrescriptionTransactions(apiClient); + this.prescriptionStatuses = new PrescriptionStatuses(apiClient); + this.shippingMethods = new ShippingMethods(apiClient); this.paymentMethods = new PaymentMethods(apiClient); this.paymentGateways = new PaymentGateways(apiClient); From 2204e88d1fd616e5a4d1e05916f6013784b80f98 Mon Sep 17 00:00:00 2001 From: rodriusp Date: Tue, 5 Feb 2019 10:22:10 -0300 Subject: [PATCH 02/24] change package --- package.json | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index d47ff6e..db62366 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,22 @@ { - "name": "cezerin-client", - "version": "0.34.0", - "description": "Cezerin API client library. Work on browser and server.", + "name": "natal-client", + "version": "1.0.0", + "description": "Natal API client library. Work on browser and server.", "keywords": [ - "cezerin", - "cezerin api", - "cezerin ajax", - "cezerin web store", + "natal", + "natal api", + "natal ajax", + "natal web store", "ecommerce api", "shopping cart api" ], - "homepage": "https://cezerin.com", - "bugs": "https://github.com/cezerin/client/issues", + "homepage": "https://natal.com.ar", + "bugs": "https://github.com/rodriperez/client/issues", "license": "MIT", "author": { - "name": "Restmount ", - "url": "https://github.com/restmount" + "name": "Rodrigo ", + "url": "https://github.com/rodriperez" }, - "contributors": [ - { - "name": "Restmount ", - "url": "https://github.com/restmount" - }, - { - "name": "Sergey Onufrienko ", - "url": "https://github.com/sonufrienko" - } - ], "main": "lib/index.js", "repository": { "type": "git", From 03fc7e0b67a726d62dd4b6edb9a2013ccd7c3169 Mon Sep 17 00:00:00 2001 From: rodriusp Date: Sat, 9 Feb 2019 12:48:30 -0300 Subject: [PATCH 03/24] add status on prescription --- src/api/prescriptions/prescriptions.js | 4 ++++ src/api/prescriptions/statuses.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/prescriptions/prescriptions.js b/src/api/prescriptions/prescriptions.js index 07f8aae..7bb6683 100644 --- a/src/api/prescriptions/prescriptions.js +++ b/src/api/prescriptions/prescriptions.js @@ -62,4 +62,8 @@ export default class Prescriptions { `${this.resourceUrl}/${prescriptionId}/payment_form_settings` ); } + + confirm(prescriptionId) { + return this.client.put(`${this.resourceUrl}/${prescriptionId}/confirm`); + } } diff --git a/src/api/prescriptions/statuses.js b/src/api/prescriptions/statuses.js index be97181..0336e61 100644 --- a/src/api/prescriptions/statuses.js +++ b/src/api/prescriptions/statuses.js @@ -1,7 +1,7 @@ export default class PrescriptionStatuses { constructor(client) { this.client = client; - this.resourceUrl = '/order_statuses'; + this.resourceUrl = '/prescription_statuses'; } list(filter) { From dcbd7762b71be83a70d247edd44be8ab601741fa Mon Sep 17 00:00:00 2001 From: rodriusp Date: Sat, 9 Feb 2019 12:49:07 -0300 Subject: [PATCH 04/24] change version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index db62366..8c60aa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.0.0", + "version": "1.1.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", From c8392598719a2d41ead3ee762c53a3cde0934088 Mon Sep 17 00:00:00 2001 From: Rodrigo Perez Date: Thu, 28 Feb 2019 16:07:24 -0300 Subject: [PATCH 05/24] add subsidiaries --- __tests__/index.test.js | 7 +++++ package-lock.json | 38 ++++++++++++++++++-------- src/api/ajaxShippingMethods.js | 4 +++ src/api/orders/orders.js | 7 +++++ src/api/prescriptions/prescriptions.js | 7 +++++ src/api/subsidiaries.js | 26 ++++++++++++++++++ src/index.js | 2 ++ 7 files changed, 80 insertions(+), 11 deletions(-) create mode 100644 src/api/subsidiaries.js diff --git a/__tests__/index.test.js b/__tests__/index.test.js index 39f2dca..a47c2b7 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -70,6 +70,7 @@ test('api structure', () => { expect(typeof api.orders.close).toBe('function'); expect(typeof api.orders.updateBillingAddress).toBe('function'); expect(typeof api.orders.updateShippingAddress).toBe('function'); + expect(typeof api.orders.updateSubsidiary).toBe('function'); expect(typeof api.orders.getPaymentFormSettings).toBe('function'); expect(typeof api.orders.discounts.create).toBe('function'); expect(typeof api.orders.discounts.update).toBe('function'); @@ -96,6 +97,7 @@ test('api structure', () => { expect(typeof api.prescriptions.close).toBe('function'); expect(typeof api.prescriptions.updateBillingAddress).toBe('function'); expect(typeof api.prescriptions.updateShippingAddress).toBe('function'); + expect(typeof api.prescriptions.updateSubsidiary).toBe('function'); expect(typeof api.prescriptions.getPaymentFormSettings).toBe('function'); expect(typeof api.prescriptions.transactions.create).toBe('function'); expect(typeof api.prescriptions.transactions.update).toBe('function'); @@ -113,6 +115,11 @@ test('api structure', () => { expect(typeof api.shippingMethods.create).toBe('function'); expect(typeof api.shippingMethods.update).toBe('function'); expect(typeof api.shippingMethods.delete).toBe('function'); + expect(typeof api.subsidiaries.list).toBe('function'); + expect(typeof api.subsidiaries.retrieve).toBe('function'); + expect(typeof api.subsidiaries.create).toBe('function'); + expect(typeof api.subsidiaries.update).toBe('function'); + expect(typeof api.subsidiaries.delete).toBe('function'); expect(typeof api.paymentMethods.list).toBe('function'); expect(typeof api.paymentMethods.retrieve).toBe('function'); expect(typeof api.paymentMethods.create).toBe('function'); diff --git a/package-lock.json b/package-lock.json index 302be3b..e6287fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "cezerin-client", - "version": "0.34.0", + "name": "natal-client", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -247,6 +247,7 @@ "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -5852,7 +5853,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true + "dev": true, + "optional": true }, "loose-envify": { "version": "1.3.1", @@ -7366,7 +7368,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -7409,7 +7412,8 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -7420,7 +7424,8 @@ "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -7550,6 +7555,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7572,12 +7578,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -7596,6 +7604,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -7676,7 +7685,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7688,6 +7698,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7773,7 +7784,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7809,6 +7821,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7828,6 +7841,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7871,12 +7885,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/src/api/ajaxShippingMethods.js b/src/api/ajaxShippingMethods.js index b4dba9c..5b4f657 100644 --- a/src/api/ajaxShippingMethods.js +++ b/src/api/ajaxShippingMethods.js @@ -6,4 +6,8 @@ export default class AjaxShippingMethods { list() { return this.client.get('/shipping_methods'); } + + getSubsidiaries() { + return this.client.get('/subsidiaries'); + } } diff --git a/src/api/orders/orders.js b/src/api/orders/orders.js index 922f57b..b542d08 100644 --- a/src/api/orders/orders.js +++ b/src/api/orders/orders.js @@ -54,6 +54,13 @@ export default class Orders { ); } + updateSubsidiary(orderId, subsidiary) { + return this.client.put( + `${this.resourceUrl}/${orderId}/subsidiary`, + subsidiary + ); + } + getPaymentFormSettings(orderId) { return this.client.get( `${this.resourceUrl}/${orderId}/payment_form_settings` diff --git a/src/api/prescriptions/prescriptions.js b/src/api/prescriptions/prescriptions.js index 7bb6683..7e6fc69 100644 --- a/src/api/prescriptions/prescriptions.js +++ b/src/api/prescriptions/prescriptions.js @@ -57,6 +57,13 @@ export default class Prescriptions { ); } + updateSubsidiary(prescriptionId, subsidiary) { + return this.client.put( + `${this.resourceUrl}/${prescriptionId}/subsidiary`, + subsidiary + ); + } + getPaymentFormSettings(prescriptionId) { return this.client.get( `${this.resourceUrl}/${prescriptionId}/payment_form_settings` diff --git a/src/api/subsidiaries.js b/src/api/subsidiaries.js new file mode 100644 index 0000000..7cad981 --- /dev/null +++ b/src/api/subsidiaries.js @@ -0,0 +1,26 @@ +export default class Subsidiaries { + constructor(client) { + this.client = client; + this.resourceUrl = '/subsidiaries'; + } + + list(filter) { + return this.client.get(this.resourceUrl, filter); + } + + retrieve(id, filter) { + return this.client.get(`${this.resourceUrl}/${id}`, filter); + } + + create(data) { + return this.client.post(`${this.resourceUrl}`, data); + } + + update(id, data) { + return this.client.put(`${this.resourceUrl}/${id}`, data); + } + + delete(id) { + return this.client.delete(`${this.resourceUrl}/${id}`); + } +} diff --git a/src/index.js b/src/index.js index d4abddf..73e7968 100644 --- a/src/index.js +++ b/src/index.js @@ -46,6 +46,7 @@ import WebStoreServices from './webstore/services'; import WebStoreServiceSettings from './webstore/serviceSettings'; import WebStoreServiceActions from './webstore/serviceActions'; import WebStoreServiceLogs from './webstore/serviceLogs'; +import Subsidiaries from './api/subsidiaries'; export default class Client { constructor(options = {}) { @@ -80,6 +81,7 @@ export default class Client { this.prescriptionStatuses = new PrescriptionStatuses(apiClient); this.shippingMethods = new ShippingMethods(apiClient); + this.subsidiaries = new Subsidiaries(apiClient); this.paymentMethods = new PaymentMethods(apiClient); this.paymentGateways = new PaymentGateways(apiClient); this.customerGroups = new CustomerGroups(apiClient); From 6244da608660a86cad12be5903d22ec158897fde Mon Sep 17 00:00:00 2001 From: Rodrigo Perez Date: Thu, 28 Feb 2019 16:09:46 -0300 Subject: [PATCH 06/24] Update version --- package.json | 4 ++-- src/api/ajaxCart.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8c60aa4..78fc398 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.1.0", + "version": "1.2.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", @@ -20,7 +20,7 @@ "main": "lib/index.js", "repository": { "type": "git", - "url": "https://github.com/cezerin/client" + "url": "https://github.com/rodriperez/client" }, "scripts": { "build": "babel src -d lib", diff --git a/src/api/ajaxCart.js b/src/api/ajaxCart.js index fb14d39..7acbf2e 100644 --- a/src/api/ajaxCart.js +++ b/src/api/ajaxCart.js @@ -23,6 +23,10 @@ export default class AjaxCart { return this.client.put(`/cart/shipping_address`, address); } + updateSubsidiary(subsidiary) { + return this.client.put(`/cart/subsidiary`, subsidiary); + } + addItem(data) { return this.client.post(`/cart/items`, data); } From ccda893544f51d0c2d3c3937ba8a3265a9de0e6f Mon Sep 17 00:00:00 2001 From: rodriusp Date: Mon, 25 Mar 2019 23:33:40 -0300 Subject: [PATCH 07/24] add password --- package.json | 2 +- src/apiClient.js | 4 ++-- src/index.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8c60aa4..5c72b92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.1.0", + "version": "1.2.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/apiClient.js b/src/apiClient.js index 2243ac7..454ab7f 100644 --- a/src/apiClient.js +++ b/src/apiClient.js @@ -2,13 +2,13 @@ import fetch from 'cross-fetch'; import RestClient from './restClient'; export default class ApiClient extends RestClient { - static authorize = (baseUrl, email) => { + static authorize = (baseUrl, email, password) => { const config = { method: 'post', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ email }) + body: JSON.stringify({ email, password }) }; return fetch(`${baseUrl}/authorize`, config).then( RestClient.returnStatusAndJson diff --git a/src/index.js b/src/index.js index d4abddf..f77a048 100644 --- a/src/index.js +++ b/src/index.js @@ -122,7 +122,8 @@ export default class Client { this.webstore.services.logs = new WebStoreServiceLogs(webstoreClient); } - static authorize = (baseUrl, email) => ApiClient.authorize(baseUrl, email); + static authorize = (baseUrl, email, password) => + ApiClient.authorize(baseUrl, email, password); static authorizeInWebStore = (email, adminUrl) => WebStoreClient.authorize(email, adminUrl); From adb396a04e12fdf286a57bc519ce847d16c5a1c3 Mon Sep 17 00:00:00 2001 From: rodriusp Date: Mon, 25 Mar 2019 23:41:08 -0300 Subject: [PATCH 08/24] move version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 78fc398..cbd922a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.2.0", + "version": "1.3.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", From 05bf82258ed9ebb087fb1a6d350a473e8dad4d13 Mon Sep 17 00:00:00 2001 From: rodriusp Date: Sun, 14 Apr 2019 22:23:39 -0300 Subject: [PATCH 09/24] Add prescription ajax router@ g --- package.json | 2 +- src/api/ajaxPaymentMethods.js | 4 ++++ src/api/ajaxPrescription.js | 37 ++++++++++++++++++++++++++++++++++ src/api/ajaxShippingMethods.js | 4 ++++ src/index.js | 2 ++ 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/api/ajaxPrescription.js diff --git a/package.json b/package.json index cbd922a..f8a60c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.3.0", + "version": "1.4.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/ajaxPaymentMethods.js b/src/api/ajaxPaymentMethods.js index 0db471f..cf2d401 100644 --- a/src/api/ajaxPaymentMethods.js +++ b/src/api/ajaxPaymentMethods.js @@ -6,4 +6,8 @@ export default class AjaxPaymentMethods { list() { return this.client.get('/payment_methods'); } + + prescriptions() { + return this.client.get('/payment_methods/prescriptions'); + } } diff --git a/src/api/ajaxPrescription.js b/src/api/ajaxPrescription.js new file mode 100644 index 0000000..f797f80 --- /dev/null +++ b/src/api/ajaxPrescription.js @@ -0,0 +1,37 @@ +export default class AjaxPrescription { + constructor(client) { + this.client = client; + } + + create() { + return this.client.post(`/prescription`); + } + + update(orderId, data) { + return this.client.put(`/prescription/${orderId}`, data); + } + + checkout(orderId, data) { + return this.client.put(`/prescription/${orderId}/checkout`, data); + } + + confirmPrescription(orderId) { + return this.client.put(`/prescription/${orderId}/confirm`); + } + + uploadPrescription(orderId, data) { + return this.client.postFormData(`/prescription/${orderId}/items`, data); + } + + uploadLicense(orderId, data) { + return this.client.postFormData(`/prescription/${orderId}/licenses`, data); + } + + deleteLicense(orderId, fileId) { + return this.client.delete(`/prescription/${orderId}/licenses/${fileId}`); + } + + deleteFile(orderId, fileId) { + return this.client.delete(`/prescription/${orderId}/items/${fileId}`); + } +} diff --git a/src/api/ajaxShippingMethods.js b/src/api/ajaxShippingMethods.js index 5b4f657..b280035 100644 --- a/src/api/ajaxShippingMethods.js +++ b/src/api/ajaxShippingMethods.js @@ -7,6 +7,10 @@ export default class AjaxShippingMethods { return this.client.get('/shipping_methods'); } + prescriptions() { + return this.client.get('/shipping_methods/prescriptions'); + } + getSubsidiaries() { return this.client.get('/subsidiaries'); } diff --git a/src/index.js b/src/index.js index eb6d926..6818aa0 100644 --- a/src/index.js +++ b/src/index.js @@ -47,6 +47,7 @@ import WebStoreServiceSettings from './webstore/serviceSettings'; import WebStoreServiceActions from './webstore/serviceActions'; import WebStoreServiceLogs from './webstore/serviceLogs'; import Subsidiaries from './api/subsidiaries'; +import AjaxPrescription from './api/ajaxPrescription'; export default class Client { constructor(options = {}) { @@ -107,6 +108,7 @@ export default class Client { this.ajax.products = new Products(ajaxClient); this.ajax.sitemap = new Sitemap(ajaxClient); this.ajax.cart = new AjaxCart(ajaxClient); + this.ajax.prescription = new AjaxPrescription(ajaxClient); this.ajax.countries = new Countries(ajaxClient); this.ajax.currencies = new Currencies(ajaxClient); this.ajax.shippingMethods = new AjaxShippingMethods(ajaxClient); From 667aab077feaa6216c9da4bad5e22d51e1e04f65 Mon Sep 17 00:00:00 2001 From: rodriusp Date: Sun, 14 Apr 2019 23:17:36 -0300 Subject: [PATCH 10/24] adding methods to update items --- package.json | 2 +- src/api/prescriptions/items.js | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index f8a60c9..8df3080 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.4.0", + "version": "1.4.1", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/prescriptions/items.js b/src/api/prescriptions/items.js index 7f3eb6a..82a0b9e 100644 --- a/src/api/prescriptions/items.js +++ b/src/api/prescriptions/items.js @@ -3,20 +3,29 @@ export default class PrescriptionItems { this.client = client; } - create(prescriptionId, data) { - return this.client.post(`/prescriptions/${prescriptionId}/items`, data); + uploadPrescription(prescriptionId, data) { + return this.client.postFormData( + `/prescriptions/${prescriptionId}/items`, + data + ); } - update(prescriptionId, itemId, data) { - return this.client.put( - `/prescriptions/${prescriptionId}/items/${itemId}`, + uploadLicense(prescriptionId, data) { + return this.client.postFormData( + `/prescriptions/${prescriptionId}/licenses`, data ); } - delete(prescriptionId, itemId) { + deleteLicense(prescriptionId, fileId) { + return this.client.delete( + `/prescriptions/${prescriptionId}/licenses/${fileId}` + ); + } + + deletePrescription(prescriptionId, fileId) { return this.client.delete( - `/prescriptions/${prescriptionId}/items/${itemId}` + `/prescriptions/${prescriptionId}/items/${fileId}` ); } } From 1bc6f828e12dac6f36efecb0e2e76c0fe6d2c8d0 Mon Sep 17 00:00:00 2001 From: rodriusp Date: Thu, 25 Apr 2019 23:00:52 -0300 Subject: [PATCH 11/24] fixing about client --- package.json | 2 +- src/api/prescriptions/prescriptions.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8df3080..fa0debd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.4.1", + "version": "1.4.2", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/prescriptions/prescriptions.js b/src/api/prescriptions/prescriptions.js index 7e6fc69..b6bfab5 100644 --- a/src/api/prescriptions/prescriptions.js +++ b/src/api/prescriptions/prescriptions.js @@ -31,8 +31,11 @@ export default class Prescriptions { ); } - checkout(prescriptionId) { - return this.client.put(`${this.resourceUrl}/${prescriptionId}/checkout`); + checkout(prescriptionId, data) { + return this.client.put( + `${this.resourceUrl}/${prescriptionId}/checkout`, + data + ); } cancel(prescriptionId) { From 361099774c323b9ceaa1bed7af07bfdb9e1e515e Mon Sep 17 00:00:00 2001 From: rodriusp Date: Sat, 4 May 2019 15:28:57 -0300 Subject: [PATCH 12/24] add endpoint --- package.json | 2 +- src/api/prescriptions/prescriptions.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fa0debd..98dfb84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.4.2", + "version": "1.4.3", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/prescriptions/prescriptions.js b/src/api/prescriptions/prescriptions.js index b6bfab5..8d9bc61 100644 --- a/src/api/prescriptions/prescriptions.js +++ b/src/api/prescriptions/prescriptions.js @@ -76,4 +76,8 @@ export default class Prescriptions { confirm(prescriptionId) { return this.client.put(`${this.resourceUrl}/${prescriptionId}/confirm`); } + + sendEmail(prescriptionId) { + return this.client.post(`${this.resourceUrl}/${prescriptionId}/email`); + } } From 8ac1566262a1e3bc1a25c43f55c5987fe1b85fc1 Mon Sep 17 00:00:00 2001 From: Rodrigo Perez Date: Tue, 6 Aug 2019 15:11:19 -0300 Subject: [PATCH 13/24] confirm times to get products or prescriptions --- package.json | 2 +- src/api/orders/orders.js | 7 +++++++ src/api/prescriptions/prescriptions.js | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 98dfb84..7991e1f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.4.3", + "version": "1.5.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/orders/orders.js b/src/api/orders/orders.js index b542d08..dcc1e30 100644 --- a/src/api/orders/orders.js +++ b/src/api/orders/orders.js @@ -47,6 +47,13 @@ export default class Orders { ); } + updateAvailability(orderId, available) { + return this.client.put( + `${this.resourceUrl}/${orderId}/confim_availability`, + available + ); + } + updateShippingAddress(orderId, address) { return this.client.put( `${this.resourceUrl}/${orderId}/shipping_address`, diff --git a/src/api/prescriptions/prescriptions.js b/src/api/prescriptions/prescriptions.js index 8d9bc61..7e3bb85 100644 --- a/src/api/prescriptions/prescriptions.js +++ b/src/api/prescriptions/prescriptions.js @@ -53,6 +53,13 @@ export default class Prescriptions { ); } + updateAvailability(prescriptionId, available) { + return this.client.put( + `${this.resourceUrl}/${prescriptionId}/confim_availability`, + available + ); + } + updateShippingAddress(prescriptionId, address) { return this.client.put( `${this.resourceUrl}/${prescriptionId}/shipping_address`, From 733eaaced822f1e1403fd84a69b25cf965d71e71 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sun, 6 Oct 2019 18:52:29 -0300 Subject: [PATCH 14/24] add import products --- package.json | 2 +- src/api/products/products.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7991e1f..39f90ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.5.0", + "version": "1.6.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/products/products.js b/src/api/products/products.js index 071c6e1..d444f62 100644 --- a/src/api/products/products.js +++ b/src/api/products/products.js @@ -16,6 +16,10 @@ export default class Products { return this.client.post(this.resourceUrl, data); } + import(formData) { + return this.client.postFormData(`${this.resourceUrl}/import`, formData); + } + update(id, data) { return this.client.put(`${this.resourceUrl}/${id}`, data); } From 566d78e85f009d7efb7149d159e15e78ce0c704a Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Wed, 4 Nov 2020 21:06:27 -0300 Subject: [PATCH 15/24] add medicines --- package-lock.json | 2 +- package.json | 2 +- src/api/ajaxPrescription.js | 4 ++++ src/api/prescriptions/medicines.js | 26 ++++++++++++++++++++++++++ src/index.js | 2 ++ 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/api/prescriptions/medicines.js diff --git a/package-lock.json b/package-lock.json index e6287fa..ab1229d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.1.0", + "version": "1.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 39f90ae..7f11cbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.6.0", + "version": "1.7.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/ajaxPrescription.js b/src/api/ajaxPrescription.js index f797f80..eba5664 100644 --- a/src/api/ajaxPrescription.js +++ b/src/api/ajaxPrescription.js @@ -3,6 +3,10 @@ export default class AjaxPrescription { this.client = client; } + retrieve(orderId) { + return this.client.get(`/prescription/${orderId}`); + } + create() { return this.client.post(`/prescription`); } diff --git a/src/api/prescriptions/medicines.js b/src/api/prescriptions/medicines.js new file mode 100644 index 0000000..51f0a8f --- /dev/null +++ b/src/api/prescriptions/medicines.js @@ -0,0 +1,26 @@ +export default class Medicines { + constructor(client) { + this.client = client; + this.resourceUrl = '/medicines'; + } + + list(filter) { + return this.client.get(this.resourceUrl, filter); + } + + retrieve(id, filter) { + return this.client.get(`${this.resourceUrl}/${id}`, filter); + } + + create(data) { + return this.client.post(this.resourceUrl, data); + } + + update(id, data) { + return this.client.put(`${this.resourceUrl}/${id}`, data); + } + + delete(id) { + return this.client.delete(`${this.resourceUrl}/${id}`); + } +} diff --git a/src/index.js b/src/index.js index 6818aa0..2f9b0a4 100644 --- a/src/index.js +++ b/src/index.js @@ -48,6 +48,7 @@ import WebStoreServiceActions from './webstore/serviceActions'; import WebStoreServiceLogs from './webstore/serviceLogs'; import Subsidiaries from './api/subsidiaries'; import AjaxPrescription from './api/ajaxPrescription'; +import Medicines from './api/prescriptions/medicines'; export default class Client { constructor(options = {}) { @@ -80,6 +81,7 @@ export default class Client { this.prescriptions.items = new PrescriptionItems(apiClient); this.prescriptions.transactions = new PrescriptionTransactions(apiClient); this.prescriptionStatuses = new PrescriptionStatuses(apiClient); + this.medicines = new Medicines(apiClient); this.shippingMethods = new ShippingMethods(apiClient); this.subsidiaries = new Subsidiaries(apiClient); From 7f4096346ee3a51feb791e1e5963340e959d0287 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Wed, 18 Nov 2020 22:42:27 -0300 Subject: [PATCH 16/24] fixing about upload --- package.json | 2 +- src/api/prescriptions/items.js | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7f11cbe..10de82f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.7.0", + "version": "1.7.1", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/prescriptions/items.js b/src/api/prescriptions/items.js index 82a0b9e..ad58abf 100644 --- a/src/api/prescriptions/items.js +++ b/src/api/prescriptions/items.js @@ -3,9 +3,26 @@ export default class PrescriptionItems { this.client = client; } + create(prescriptionId, data) { + return this.client.post(`/prescriptions/${prescriptionId}/items`, data); + } + + update(prescriptionId, itemId, data) { + return this.client.put( + `/prescriptions/${prescriptionId}/items/${itemId}`, + data + ); + } + + delete(prescriptionId, itemId) { + return this.client.delete( + `/prescriptions/${prescriptionId}/items/${itemId}` + ); + } + uploadPrescription(prescriptionId, data) { return this.client.postFormData( - `/prescriptions/${prescriptionId}/items`, + `/prescriptions/${prescriptionId}/medications`, data ); } @@ -25,7 +42,7 @@ export default class PrescriptionItems { deletePrescription(prescriptionId, fileId) { return this.client.delete( - `/prescriptions/${prescriptionId}/items/${fileId}` + `/prescriptions/${prescriptionId}/medications/${fileId}` ); } } From 2f7d02442f294ab656850f2fff55ee29da7ce823 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Tue, 8 Dec 2020 17:05:32 -0300 Subject: [PATCH 17/24] add medicines imports endpoints --- package.json | 2 +- src/api/prescriptions/medicines.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 10de82f..0126609 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.7.1", + "version": "1.8.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/prescriptions/medicines.js b/src/api/prescriptions/medicines.js index 51f0a8f..e038fe3 100644 --- a/src/api/prescriptions/medicines.js +++ b/src/api/prescriptions/medicines.js @@ -23,4 +23,12 @@ export default class Medicines { delete(id) { return this.client.delete(`${this.resourceUrl}/${id}`); } + + import(formData) { + return this.client.postFormData(`${this.resourceUrl}/import`, formData); + } + + download() { + return this.client.get(`${this.resourceUrl}/export`); + } } From f5dbc1c14fc3ced6d8f3fd413d470718e4cca25b Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Wed, 16 Dec 2020 20:57:26 -0300 Subject: [PATCH 18/24] add shipping rules --- package.json | 2 +- src/api/shippingRules.js | 26 ++++++++++++++++++++++++++ src/index.js | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/api/shippingRules.js diff --git a/package.json b/package.json index 0126609..f1323f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.8.0", + "version": "1.9.0", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/shippingRules.js b/src/api/shippingRules.js new file mode 100644 index 0000000..273c6fe --- /dev/null +++ b/src/api/shippingRules.js @@ -0,0 +1,26 @@ +export default class ShippingRules { + constructor(client) { + this.client = client; + this.resourceUrl = '/shipping_rules'; + } + + list(filter) { + return this.client.get(this.resourceUrl, filter); + } + + retrieve(id, filter) { + return this.client.get(`${this.resourceUrl}/${id}`, filter); + } + + create(data) { + return this.client.post(`${this.resourceUrl}`, data); + } + + update(id, data) { + return this.client.put(`${this.resourceUrl}/${id}`, data); + } + + delete(id) { + return this.client.delete(`${this.resourceUrl}/${id}`); + } +} diff --git a/src/index.js b/src/index.js index 2f9b0a4..f0ed3fd 100644 --- a/src/index.js +++ b/src/index.js @@ -49,6 +49,7 @@ import WebStoreServiceLogs from './webstore/serviceLogs'; import Subsidiaries from './api/subsidiaries'; import AjaxPrescription from './api/ajaxPrescription'; import Medicines from './api/prescriptions/medicines'; +import ShippingRules from './api/shippingRules'; export default class Client { constructor(options = {}) { @@ -84,6 +85,7 @@ export default class Client { this.medicines = new Medicines(apiClient); this.shippingMethods = new ShippingMethods(apiClient); + this.shippingRules = new ShippingRules(apiClient); this.subsidiaries = new Subsidiaries(apiClient); this.paymentMethods = new PaymentMethods(apiClient); this.paymentGateways = new PaymentGateways(apiClient); From 1aad4663b1858ca3e4808835a7b5305d5a6204e3 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Tue, 16 Feb 2021 15:01:54 -0300 Subject: [PATCH 19/24] add download endpoint --- package.json | 2 +- src/api/prescriptions/medicines.js | 2 +- src/restClient.js | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f1323f3..ec96df5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.9.0", + "version": "1.9.1", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/prescriptions/medicines.js b/src/api/prescriptions/medicines.js index e038fe3..a67704d 100644 --- a/src/api/prescriptions/medicines.js +++ b/src/api/prescriptions/medicines.js @@ -29,6 +29,6 @@ export default class Medicines { } download() { - return this.client.get(`${this.resourceUrl}/export`); + return this.client.download(`${this.resourceUrl}/export`); } } diff --git a/src/restClient.js b/src/restClient.js index 72626f6..8d09cc8 100644 --- a/src/restClient.js +++ b/src/restClient.js @@ -73,4 +73,15 @@ export default class RestClient { this.returnStatusAndJson ); } + + download(endpoint) { + const config = { + method: 'get', + headers: { + Authorization: `Bearer ${this.token}` + }, + responseType: 'arraybuffer' + }; + return fetch(`${this.baseUrl}${endpoint}`, config); + } } From f7fc994edabef060ebd0d428c37eeced0e845381 Mon Sep 17 00:00:00 2001 From: Luciano Date: Thu, 29 Apr 2021 20:59:47 -0300 Subject: [PATCH 20/24] Adding endpoint to download orders by dates --- package.json | 2 +- src/api/orders/orders.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ec96df5..ee20ce2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "natal-client", - "version": "1.9.1", + "version": "1.9.2", "description": "Natal API client library. Work on browser and server.", "keywords": [ "natal", diff --git a/src/api/orders/orders.js b/src/api/orders/orders.js index dcc1e30..ba5bfd6 100644 --- a/src/api/orders/orders.js +++ b/src/api/orders/orders.js @@ -73,4 +73,8 @@ export default class Orders { `${this.resourceUrl}/${orderId}/payment_form_settings` ); } + + download(dates) { + return this.client.download(`${this.resourceUrl}/download`, dates); + } } From 6175640c15a534be70488bec9aaa912d7e185db8 Mon Sep 17 00:00:00 2001 From: Luciano Valenzuela <48654818+lucianoo95@users.noreply.github.com> Date: Fri, 7 May 2021 21:02:10 -0300 Subject: [PATCH 21/24] Update orders.js --- src/api/orders/orders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/orders/orders.js b/src/api/orders/orders.js index ba5bfd6..94012a6 100644 --- a/src/api/orders/orders.js +++ b/src/api/orders/orders.js @@ -75,6 +75,6 @@ export default class Orders { } download(dates) { - return this.client.download(`${this.resourceUrl}/download`, dates); + return this.client.download(`${this.resourceUrl}/shipping_address/download`, dates); } } From 584c602a31aa52f76ce00699cedfd7aec160c93e Mon Sep 17 00:00:00 2001 From: Luciano Valenzuela <48654818+lucianoo95@users.noreply.github.com> Date: Mon, 10 May 2021 16:31:44 -0300 Subject: [PATCH 22/24] Change endpoint url --- src/api/orders/orders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/orders/orders.js b/src/api/orders/orders.js index 94012a6..49b1b20 100644 --- a/src/api/orders/orders.js +++ b/src/api/orders/orders.js @@ -75,6 +75,6 @@ export default class Orders { } download(dates) { - return this.client.download(`${this.resourceUrl}/shipping_address/download`, dates); + return this.client.download(`${this.resourceUrl}/export`, dates); } } From 092e237a0bf95730b4e1fd8fc90a143bb351132d Mon Sep 17 00:00:00 2001 From: Luciano Valenzuela <48654818+lucianoo95@users.noreply.github.com> Date: Tue, 11 May 2021 18:18:14 -0300 Subject: [PATCH 23/24] Update restClient.js --- src/restClient.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/restClient.js b/src/restClient.js index 8d09cc8..c026957 100644 --- a/src/restClient.js +++ b/src/restClient.js @@ -74,7 +74,7 @@ export default class RestClient { ); } - download(endpoint) { + download(endpoint, data) { const config = { method: 'get', headers: { @@ -82,6 +82,6 @@ export default class RestClient { }, responseType: 'arraybuffer' }; - return fetch(`${this.baseUrl}${endpoint}`, config); + return fetch(`${this.baseUrl}${endpoint}?${queryString.stringify(data)}`, config); } } From 6bce855ea53c339247139e1c385a99fc38aaf37f Mon Sep 17 00:00:00 2001 From: Luciano Valenzuela <48654818+lucianoo95@users.noreply.github.com> Date: Wed, 12 May 2021 18:43:21 -0300 Subject: [PATCH 24/24] Update restClient.js --- src/restClient.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/restClient.js b/src/restClient.js index c026957..c1d1be4 100644 --- a/src/restClient.js +++ b/src/restClient.js @@ -74,7 +74,7 @@ export default class RestClient { ); } - download(endpoint, data) { + download(endpoint, data = {}) { const config = { method: 'get', headers: {