Skip to content

Commit 339d4f5

Browse files
committed
Requested changes done
1 parent d3f634d commit 339d4f5

File tree

4 files changed

+91
-12
lines changed

4 files changed

+91
-12
lines changed

components/remote_retrieval/actions/create-order/create-order.mjs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,29 @@ export default {
137137
},
138138

139139
async run({ $ }) {
140+
console.log({
141+
typeOfEquipment: this.typeOfEquipment,
142+
orderType: this.orderType,
143+
email: this.email,
144+
name: this.name,
145+
addressLine1: this.addressLine1,
146+
addressLine2: this.addressLine2,
147+
addressCity: this.addressCity,
148+
addressState: this.addressState,
149+
addressCountry: this.addressCountry,
150+
addressZip: this.addressZip,
151+
phone: this.phone,
152+
returnPersonName: this.returnPersonName,
153+
returnCompanyName: this.returnCompanyName,
154+
returnAddressLine1: this.returnAddressLine1,
155+
returnAddressLine2: this.returnAddressLine2,
156+
returnAddressCity: this.returnAddressCity,
157+
returnAddressState: this.returnAddressState,
158+
returnAddressCountry: this.returnAddressCountry,
159+
returnAddressZip: this.returnAddressZip,
160+
companyEmail: this.companyEmail,
161+
companyPhone: this.companyPhone,
162+
});
140163
const response = await this.app.createOrder({
141164
$,
142165
data: {
@@ -148,7 +171,7 @@ export default {
148171
email: this.email,
149172
name: this.name,
150173
address_line_1: this.addressLine1,
151-
address_line_2: this.addressLine2,
174+
address_line_2: this.addressLine2 || "",
152175
address_city: this.addressCity,
153176
address_state: this.addressState,
154177
address_country: this.addressCountry,
@@ -159,7 +182,7 @@ export default {
159182
return_person_name: this.returnPersonName,
160183
return_company_name: this.returnCompanyName,
161184
return_address_line_1: this.returnAddressLine1,
162-
return_address_line_2: this.returnAddressLine2,
185+
return_address_line_2: this.returnAddressLine2 || "",
163186
return_address_city: this.returnAddressCity,
164187
return_address_state: this.returnAddressState,
165188
return_address_country: this.returnAddressCountry,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import app from "../../remote_retrieval.app.mjs";
2+
3+
export default {
4+
key: "remote_retrieval-get-order-details",
5+
name: "Get Order Details",
6+
description: "Get the details of the specified order. [See the documentation](https://www.remoteretrieval.com/api-documentation/#order-detail)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
orderId: {
12+
propDefinition: [
13+
app,
14+
"orderId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.getOrderDetails({
20+
$,
21+
params: {
22+
ORDER_ID: this.orderId,
23+
},
24+
});
25+
$.export("$summary", `Successfully retrieved details of order with ID '${this.orderId}'`);
26+
return response;
27+
},
28+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import app from "../../remote_retrieval.app.mjs";
2+
3+
export default {
4+
key: "remote_retrieval-get-orders",
5+
name: "Get Orders",
6+
description: "Get a list of all orders. [See the documentation](https://www.remoteretrieval.com/api-documentation/#all-orders)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
},
12+
async run({ $ }) {
13+
const response = await this.app.getOrders({
14+
$,
15+
});
16+
$.export("$summary", `Successfully retrieved ${response.results.length} orders`);
17+
return response;
18+
},
19+
};

components/remote_retrieval/remote_retrieval.app.mjs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ export default {
55
type: "app",
66
app: "remote_retrieval",
77
propDefinitions: {
8+
orderId: {
9+
type: "string",
10+
label: "Order ID",
11+
description: "ID of the Order",
12+
async options() {
13+
const response = await this.getOrders();
14+
const orderIds = response.results;
15+
return orderIds.map(({
16+
order_id, employee_info,
17+
}) => ({
18+
value: order_id,
19+
label: employee_info.name,
20+
}));
21+
},
22+
},
823
typeOfEquipment: {
924
type: "string",
1025
label: "Type of Equipment",
@@ -114,12 +129,6 @@ export default {
114129
label: "Company Phone",
115130
description: "Company phone",
116131
},
117-
page: {
118-
type: "string",
119-
label: "Page",
120-
description: "Results are paginated up to 25 per page",
121-
optional: true,
122-
},
123132
},
124133
methods: {
125134
_baseUrl() {
@@ -148,15 +157,15 @@ export default {
148157
...args,
149158
});
150159
},
151-
async getNewOrders(args = {}) {
160+
async getOrders(args = {}) {
152161
return this._makeRequest({
153-
path: "/new-orders",
162+
path: "/orders",
154163
...args,
155164
});
156165
},
157-
async getCompletedOrders(args = {}) {
166+
async getOrderDetails(args = {}) {
158167
return this._makeRequest({
159-
path: "/completed-orders",
168+
path: "/device_returns",
160169
...args,
161170
});
162171
},

0 commit comments

Comments
 (0)