Skip to content

Commit 64bb31f

Browse files
authored
Merge pull request #269 from kontist/krp-2205-fix-issue-on-update-instant-limits
KRP-2205 Fix issue on updateInstantLimits
2 parents 46cefa1 + d872477 commit 64bb31f

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

npm-shrinkwrap.json

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kontist/mock-solaris",
3-
"version": "1.0.177",
3+
"version": "1.0.178",
44
"description": "Mock Service for Solaris API",
55
"main": "dist/src/index.js",
66
"types": "dist/src/index.d.ts",

src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ router.get(
933933
"/accounts/:accountId/sepa_instant_limits",
934934
safeRequestHandler(instantCreditTransferAPI.getInstantLimits)
935935
);
936-
router.post(
936+
router.patch(
937937
"/accounts/:accountId/sepa_instant_limits",
938938
safeRequestHandler(instantCreditTransferAPI.updateInstantLimits)
939939
);

src/routes/instantCreditTransfer.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,19 @@ export const updateInstantLimits = async (req, res) => {
244244
throw new Error("Account not found");
245245
}
246246

247-
if (!daily_limit && !per_transaction_limit) {
247+
if (daily_limit === undefined && per_transaction_limit === undefined) {
248248
throw new Error("Daily limit or per transaction limit are required");
249249
}
250250

251+
if (per_transaction_limit === null) {
252+
throw new Error("Per transaction limit cannot be null");
253+
}
254+
251255
return res.send({
252-
daily_limit: daily_limit || {
253-
value: 1000000,
254-
unit: "cents",
255-
currency: "EUR",
256-
},
256+
daily_limit:
257+
daily_limit === undefined
258+
? { value: 1000000, unit: "cents", currency: "EUR" }
259+
: daily_limit,
257260
daily_used: { value: 350000, unit: "cents", currency: "EUR" },
258261
daily_remaining: { value: 650000, unit: "cents", currency: "EUR" },
259262
per_transaction_limit: per_transaction_limit || {

0 commit comments

Comments
 (0)