btrz-api-client 8.21.0 → 8.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -71,7 +71,8 @@ function getnetTerminalFactory({client, internalAuthTokenProvider}) {
|
|
|
71
71
|
data: {
|
|
72
72
|
getnetTerminal: {
|
|
73
73
|
name: getnetTerminal.name,
|
|
74
|
-
serialNumber: getnetTerminal.serialNumber
|
|
74
|
+
serialNumber: getnetTerminal.serialNumber,
|
|
75
|
+
stationId: getnetTerminal.stationId
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
});
|
|
@@ -59,6 +59,24 @@ describe("inventory/getnet-terminals", () => {
|
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
+
it("should create a new Getnet terminal with stationId (location)", async () => {
|
|
63
|
+
const getnetTerminal = {
|
|
64
|
+
name: "Getnet Terminal at Station",
|
|
65
|
+
serialNumber: "SN-001",
|
|
66
|
+
stationId: "5f243d100617680712e78dd7"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
axiosMock.onPost("/getnet-terminals").reply(expectRequest({
|
|
70
|
+
statusCode: 200, token, jwtToken, body: {getnetTerminal}
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
return api.inventory.getnetTerminals.create({
|
|
74
|
+
jwtToken,
|
|
75
|
+
token,
|
|
76
|
+
getnetTerminal
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
62
80
|
it("should delete a Getnet terminal", () => {
|
|
63
81
|
const getnetTerminalId = "1234";
|
|
64
82
|
|
|
@@ -82,7 +100,8 @@ describe("inventory/getnet-terminals", () => {
|
|
|
82
100
|
|
|
83
101
|
const getnetTerminalFieldsToUpdate = {
|
|
84
102
|
name: getnetTerminal.name,
|
|
85
|
-
serialNumber: getnetTerminal.serialNumber
|
|
103
|
+
serialNumber: getnetTerminal.serialNumber,
|
|
104
|
+
stationId: getnetTerminal.stationId
|
|
86
105
|
};
|
|
87
106
|
|
|
88
107
|
axiosMock.onPut(`/getnet-terminals/${getnetTerminal._id}`).reply(expectRequest({
|
|
@@ -95,4 +114,60 @@ describe("inventory/getnet-terminals", () => {
|
|
|
95
114
|
getnetTerminal
|
|
96
115
|
});
|
|
97
116
|
});
|
|
117
|
+
|
|
118
|
+
it("should update an existing Getnet terminal with stationId (location)", async () => {
|
|
119
|
+
const getnetTerminalId = "terminal-id-456";
|
|
120
|
+
const getnetTerminal = {
|
|
121
|
+
_id: getnetTerminalId,
|
|
122
|
+
name: "Terminal at Station",
|
|
123
|
+
serialNumber: "SN-789",
|
|
124
|
+
stationId: "5f243d100617680712e78dd7"
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const expectedBody = {
|
|
128
|
+
getnetTerminal: {
|
|
129
|
+
name: getnetTerminal.name,
|
|
130
|
+
serialNumber: getnetTerminal.serialNumber,
|
|
131
|
+
stationId: getnetTerminal.stationId
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
axiosMock.onPut(`/getnet-terminals/${getnetTerminalId}`).reply(expectRequest({
|
|
136
|
+
statusCode: 200, token, jwtToken, body: expectedBody
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
return api.inventory.getnetTerminals.update({
|
|
140
|
+
jwtToken,
|
|
141
|
+
token,
|
|
142
|
+
getnetTerminalId,
|
|
143
|
+
getnetTerminal
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("should update an existing Getnet terminal with empty stationId", async () => {
|
|
148
|
+
const getnetTerminal = {
|
|
149
|
+
_id: "terminal-id-999",
|
|
150
|
+
name: "Terminal No Location",
|
|
151
|
+
serialNumber: "SN-999",
|
|
152
|
+
stationId: ""
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const expectedBody = {
|
|
156
|
+
getnetTerminal: {
|
|
157
|
+
name: getnetTerminal.name,
|
|
158
|
+
serialNumber: getnetTerminal.serialNumber,
|
|
159
|
+
stationId: ""
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
axiosMock.onPut(`/getnet-terminals/${getnetTerminal._id}`).reply(expectRequest({
|
|
164
|
+
statusCode: 200, token, jwtToken, body: expectedBody
|
|
165
|
+
}));
|
|
166
|
+
|
|
167
|
+
return api.inventory.getnetTerminals.update({
|
|
168
|
+
jwtToken,
|
|
169
|
+
token,
|
|
170
|
+
getnetTerminal
|
|
171
|
+
});
|
|
172
|
+
});
|
|
98
173
|
});
|