Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #870 from Shopify/add_202204_fix_typing
Browse files Browse the repository at this point in the history
Restoring REST resources for 2022-04, fixes other resources
  • Loading branch information
mkevinosullivan authored May 11, 2023
2 parents 2ac6aa0 + 39e5fd2 commit d16d9c5
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-paws-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/shopify-api': patch
---

Restoring REST resources for 2022-04, updates to certain resources for other API versions
2 changes: 1 addition & 1 deletion rest/admin/2022-04/order_risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export class OrderRisk extends Base {
public message: string | null;
public order_id: number | null;
public recommendation: string | null;
public score: number | null;
public score: string | null;
public source: string | null;
}
2 changes: 1 addition & 1 deletion rest/admin/2022-07/order_risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export class OrderRisk extends Base {
public message: string | null;
public order_id: number | null;
public recommendation: string | null;
public score: number | null;
public score: string | null;
public source: string | null;
}
2 changes: 1 addition & 1 deletion rest/admin/2022-10/order_risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export class OrderRisk extends Base {
public message: string | null;
public order_id: number | null;
public recommendation: string | null;
public score: number | null;
public score: string | null;
public source: string | null;
}
2 changes: 1 addition & 1 deletion rest/admin/2023-01/order_risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export class OrderRisk extends Base {
public message: string | null;
public order_id: number | null;
public recommendation: string | null;
public score: number | null;
public score: string | null;
public source: string | null;
}
2 changes: 1 addition & 1 deletion rest/admin/2023-04/order_risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export class OrderRisk extends Base {
public message: string | null;
public order_id: number | null;
public recommendation: string | null;
public score: number | null;
public score: string | null;
public source: string | null;
}
12 changes: 6 additions & 6 deletions rest/admin/__tests__/2022-04/order_risk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
session.accessToken = 'this_is_a_test_token';

it('test_1', async () => {
queueMockResponse(JSON.stringify({"risk": {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));
queueMockResponse(JSON.stringify({"risk": {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));

const order_risk = new shopify.rest.OrderRisk({session: session});
order_risk.order_id = 450789469;
order_risk.message = "This order came from an anonymous proxy";
order_risk.recommendation = "cancel";
order_risk.score = 1.0;
order_risk.score = "1.0";
order_risk.source = "External";
order_risk.cause_cancel = true;
order_risk.display = true;
Expand All @@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2022-04/orders/450789469/risks.json',
query: '',
headers,
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
}).toMatchMadeHttpRequest();
});

it('test_2', async () => {
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));

await shopify.rest.OrderRisk.all({
session: session,
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
order_risk.recommendation = "accept";
order_risk.source = "External";
order_risk.cause_cancel = false;
order_risk.score = 0.0;
order_risk.score = "0.0";
await order_risk.save({});

expect({
Expand All @@ -109,7 +109,7 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2022-04/orders/450789469/risks/284138680.json',
query: '',
headers,
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": 0.0} }
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": "0.0"} }
}).toMatchMadeHttpRequest();
});

Expand Down
12 changes: 6 additions & 6 deletions rest/admin/__tests__/2022-07/order_risk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
session.accessToken = 'this_is_a_test_token';

it('test_1', async () => {
queueMockResponse(JSON.stringify({"risk": {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));
queueMockResponse(JSON.stringify({"risk": {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));

const order_risk = new shopify.rest.OrderRisk({session: session});
order_risk.order_id = 450789469;
order_risk.message = "This order came from an anonymous proxy";
order_risk.recommendation = "cancel";
order_risk.score = 1.0;
order_risk.score = "1.0";
order_risk.source = "External";
order_risk.cause_cancel = true;
order_risk.display = true;
Expand All @@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2022-07/orders/450789469/risks.json',
query: '',
headers,
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
}).toMatchMadeHttpRequest();
});

it('test_2', async () => {
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));

await shopify.rest.OrderRisk.all({
session: session,
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
order_risk.recommendation = "accept";
order_risk.source = "External";
order_risk.cause_cancel = false;
order_risk.score = 0.0;
order_risk.score = "0.0";
await order_risk.save({});

expect({
Expand All @@ -109,7 +109,7 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2022-07/orders/450789469/risks/284138680.json',
query: '',
headers,
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": 0.0} }
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": "0.0"} }
}).toMatchMadeHttpRequest();
});

Expand Down
12 changes: 6 additions & 6 deletions rest/admin/__tests__/2022-10/order_risk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
session.accessToken = 'this_is_a_test_token';

it('test_1', async () => {
queueMockResponse(JSON.stringify({"risk": {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));
queueMockResponse(JSON.stringify({"risk": {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));

const order_risk = new shopify.rest.OrderRisk({session: session});
order_risk.order_id = 450789469;
order_risk.message = "This order came from an anonymous proxy";
order_risk.recommendation = "cancel";
order_risk.score = 1.0;
order_risk.score = "1.0";
order_risk.source = "External";
order_risk.cause_cancel = true;
order_risk.display = true;
Expand All @@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2022-10/orders/450789469/risks.json',
query: '',
headers,
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
}).toMatchMadeHttpRequest();
});

it('test_2', async () => {
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));

await shopify.rest.OrderRisk.all({
session: session,
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
order_risk.recommendation = "accept";
order_risk.source = "External";
order_risk.cause_cancel = false;
order_risk.score = 0.0;
order_risk.score = "0.0";
await order_risk.save({});

expect({
Expand All @@ -109,7 +109,7 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2022-10/orders/450789469/risks/284138680.json',
query: '',
headers,
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": 0.0} }
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": "0.0"} }
}).toMatchMadeHttpRequest();
});

Expand Down
12 changes: 6 additions & 6 deletions rest/admin/__tests__/2023-01/order_risk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
session.accessToken = 'this_is_a_test_token';

it('test_1', async () => {
queueMockResponse(JSON.stringify({"risk": {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));
queueMockResponse(JSON.stringify({"risk": {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}}));

const order_risk = new shopify.rest.OrderRisk({session: session});
order_risk.order_id = 450789469;
order_risk.message = "This order came from an anonymous proxy";
order_risk.recommendation = "cancel";
order_risk.score = 1.0;
order_risk.score = "1.0";
order_risk.source = "External";
order_risk.cause_cancel = true;
order_risk.display = true;
Expand All @@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2023-01/orders/450789469/risks.json',
query: '',
headers,
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
}).toMatchMadeHttpRequest();
});

it('test_2', async () => {
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151490, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));
queueMockResponse(JSON.stringify({"risks": [{"id": 284138680, "order_id": 450789469, "checkout_id": null, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order was placed from a proxy IP", "merchant_message": "This order was placed from a proxy IP"}, {"id": 1029151489, "order_id": 450789469, "checkout_id": 901414060, "source": "External", "score": "1.0", "recommendation": "cancel", "display": true, "cause_cancel": true, "message": "This order came from an anonymous proxy", "merchant_message": "This order came from an anonymous proxy"}]}));

await shopify.rest.OrderRisk.all({
session: session,
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
order_risk.recommendation = "accept";
order_risk.source = "External";
order_risk.cause_cancel = false;
order_risk.score = 0.0;
order_risk.score = "0.0";
await order_risk.save({});

expect({
Expand All @@ -109,7 +109,7 @@ describe('OrderRisk resource', () => {
path: '/admin/api/2023-01/orders/450789469/risks/284138680.json',
query: '',
headers,
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": 0.0} }
data: { "risk": {"message": "After further review, this is a legitimate order", "recommendation": "accept", "source": "External", "cause_cancel": false, "score": "0.0"} }
}).toMatchMadeHttpRequest();
});

Expand Down
Loading

0 comments on commit d16d9c5

Please sign in to comment.