Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New endpoint to download orders #9

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -85,11 +86,40 @@ 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.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');
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');
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');
Expand Down
62 changes: 44 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 12 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
{
"name": "cezerin-client",
"version": "0.34.0",
"description": "Cezerin API client library. Work on browser and server.",
"name": "natal-client",
"version": "1.9.2",
"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 <jsonmount@gmail.com>",
"url": "https://github.com/restmount"
"name": "Rodrigo <rodri.dpf@gmail.com>",
"url": "https://github.com/rodriperez"
},
"contributors": [
{
"name": "Restmount <[email protected]>",
"url": "https://github.com/restmount"
},
{
"name": "Sergey Onufrienko <[email protected]>",
"url": "https://github.com/sonufrienko"
}
],
"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",
Expand Down
4 changes: 4 additions & 0 deletions src/api/ajaxCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/api/ajaxPaymentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ export default class AjaxPaymentMethods {
list() {
return this.client.get('/payment_methods');
}

prescriptions() {
return this.client.get('/payment_methods/prescriptions');
}
}
41 changes: 41 additions & 0 deletions src/api/ajaxPrescription.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export default class AjaxPrescription {
constructor(client) {
this.client = client;
}

retrieve(orderId) {
return this.client.get(`/prescription/${orderId}`);
}

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}`);
}
}
Loading