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

Commit d16d9c5

Browse files
Merge pull request #870 from Shopify/add_202204_fix_typing
Restoring REST resources for 2022-04, fixes other resources
2 parents 2ac6aa0 + 39e5fd2 commit d16d9c5

File tree

11 files changed

+40
-35
lines changed

11 files changed

+40
-35
lines changed

.changeset/sour-paws-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/shopify-api': patch
3+
---
4+
5+
Restoring REST resources for 2022-04, updates to certain resources for other API versions

rest/admin/2022-04/order_risk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ export class OrderRisk extends Base {
100100
public message: string | null;
101101
public order_id: number | null;
102102
public recommendation: string | null;
103-
public score: number | null;
103+
public score: string | null;
104104
public source: string | null;
105105
}

rest/admin/2022-07/order_risk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ export class OrderRisk extends Base {
100100
public message: string | null;
101101
public order_id: number | null;
102102
public recommendation: string | null;
103-
public score: number | null;
103+
public score: string | null;
104104
public source: string | null;
105105
}

rest/admin/2022-10/order_risk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ export class OrderRisk extends Base {
100100
public message: string | null;
101101
public order_id: number | null;
102102
public recommendation: string | null;
103-
public score: number | null;
103+
public score: string | null;
104104
public source: string | null;
105105
}

rest/admin/2023-01/order_risk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ export class OrderRisk extends Base {
100100
public message: string | null;
101101
public order_id: number | null;
102102
public recommendation: string | null;
103-
public score: number | null;
103+
public score: string | null;
104104
public source: string | null;
105105
}

rest/admin/2023-04/order_risk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ export class OrderRisk extends Base {
100100
public message: string | null;
101101
public order_id: number | null;
102102
public recommendation: string | null;
103-
public score: number | null;
103+
public score: string | null;
104104
public source: string | null;
105105
}

rest/admin/__tests__/2022-04/order_risk.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
3131
session.accessToken = 'this_is_a_test_token';
3232

3333
it('test_1', async () => {
34-
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"}}));
34+
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"}}));
3535

3636
const order_risk = new shopify.rest.OrderRisk({session: session});
3737
order_risk.order_id = 450789469;
3838
order_risk.message = "This order came from an anonymous proxy";
3939
order_risk.recommendation = "cancel";
40-
order_risk.score = 1.0;
40+
order_risk.score = "1.0";
4141
order_risk.source = "External";
4242
order_risk.cause_cancel = true;
4343
order_risk.display = true;
@@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
4949
path: '/admin/api/2022-04/orders/450789469/risks.json',
5050
query: '',
5151
headers,
52-
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
52+
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
5353
}).toMatchMadeHttpRequest();
5454
});
5555

5656
it('test_2', async () => {
57-
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"}]}));
57+
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"}]}));
5858

5959
await shopify.rest.OrderRisk.all({
6060
session: session,
@@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
100100
order_risk.recommendation = "accept";
101101
order_risk.source = "External";
102102
order_risk.cause_cancel = false;
103-
order_risk.score = 0.0;
103+
order_risk.score = "0.0";
104104
await order_risk.save({});
105105

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

rest/admin/__tests__/2022-07/order_risk.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
3131
session.accessToken = 'this_is_a_test_token';
3232

3333
it('test_1', async () => {
34-
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"}}));
34+
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"}}));
3535

3636
const order_risk = new shopify.rest.OrderRisk({session: session});
3737
order_risk.order_id = 450789469;
3838
order_risk.message = "This order came from an anonymous proxy";
3939
order_risk.recommendation = "cancel";
40-
order_risk.score = 1.0;
40+
order_risk.score = "1.0";
4141
order_risk.source = "External";
4242
order_risk.cause_cancel = true;
4343
order_risk.display = true;
@@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
4949
path: '/admin/api/2022-07/orders/450789469/risks.json',
5050
query: '',
5151
headers,
52-
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
52+
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
5353
}).toMatchMadeHttpRequest();
5454
});
5555

5656
it('test_2', async () => {
57-
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"}]}));
57+
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"}]}));
5858

5959
await shopify.rest.OrderRisk.all({
6060
session: session,
@@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
100100
order_risk.recommendation = "accept";
101101
order_risk.source = "External";
102102
order_risk.cause_cancel = false;
103-
order_risk.score = 0.0;
103+
order_risk.score = "0.0";
104104
await order_risk.save({});
105105

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

rest/admin/__tests__/2022-10/order_risk.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
3131
session.accessToken = 'this_is_a_test_token';
3232

3333
it('test_1', async () => {
34-
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"}}));
34+
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"}}));
3535

3636
const order_risk = new shopify.rest.OrderRisk({session: session});
3737
order_risk.order_id = 450789469;
3838
order_risk.message = "This order came from an anonymous proxy";
3939
order_risk.recommendation = "cancel";
40-
order_risk.score = 1.0;
40+
order_risk.score = "1.0";
4141
order_risk.source = "External";
4242
order_risk.cause_cancel = true;
4343
order_risk.display = true;
@@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
4949
path: '/admin/api/2022-10/orders/450789469/risks.json',
5050
query: '',
5151
headers,
52-
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
52+
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
5353
}).toMatchMadeHttpRequest();
5454
});
5555

5656
it('test_2', async () => {
57-
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"}]}));
57+
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"}]}));
5858

5959
await shopify.rest.OrderRisk.all({
6060
session: session,
@@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
100100
order_risk.recommendation = "accept";
101101
order_risk.source = "External";
102102
order_risk.cause_cancel = false;
103-
order_risk.score = 0.0;
103+
order_risk.score = "0.0";
104104
await order_risk.save({});
105105

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

rest/admin/__tests__/2023-01/order_risk.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ describe('OrderRisk resource', () => {
3131
session.accessToken = 'this_is_a_test_token';
3232

3333
it('test_1', async () => {
34-
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"}}));
34+
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"}}));
3535

3636
const order_risk = new shopify.rest.OrderRisk({session: session});
3737
order_risk.order_id = 450789469;
3838
order_risk.message = "This order came from an anonymous proxy";
3939
order_risk.recommendation = "cancel";
40-
order_risk.score = 1.0;
40+
order_risk.score = "1.0";
4141
order_risk.source = "External";
4242
order_risk.cause_cancel = true;
4343
order_risk.display = true;
@@ -49,12 +49,12 @@ describe('OrderRisk resource', () => {
4949
path: '/admin/api/2023-01/orders/450789469/risks.json',
5050
query: '',
5151
headers,
52-
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": 1.0, "source": "External", "cause_cancel": true, "display": true} }
52+
data: { "risk": {"message": "This order came from an anonymous proxy", "recommendation": "cancel", "score": "1.0", "source": "External", "cause_cancel": true, "display": true} }
5353
}).toMatchMadeHttpRequest();
5454
});
5555

5656
it('test_2', async () => {
57-
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"}]}));
57+
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"}]}));
5858

5959
await shopify.rest.OrderRisk.all({
6060
session: session,
@@ -100,7 +100,7 @@ describe('OrderRisk resource', () => {
100100
order_risk.recommendation = "accept";
101101
order_risk.source = "External";
102102
order_risk.cause_cancel = false;
103-
order_risk.score = 0.0;
103+
order_risk.score = "0.0";
104104
await order_risk.save({});
105105

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

0 commit comments

Comments
 (0)