@@ -9,6 +9,8 @@ import { Target } from "../typings/balancePlatform/target";
99import { TransferRouteRequest } from "../typings/balancePlatform/transferRouteRequest" ;
1010import { IbanAccountIdentification } from "../typings/balancePlatform/ibanAccountIdentification" ;
1111import { Condition } from "../typings/balancePlatform/condition" ;
12+ import { Scope } from "../typings/balancePlatform/scope" ;
13+ import { TransferType } from "../typings/balancePlatform/transferType" ;
1214
1315let client : Client ;
1416let balancePlatformService : BalancePlatform ;
@@ -33,6 +35,7 @@ describe("Balance Platform", (): void => {
3335 const paymentInstrumentId = "PI32272223222B5CMD3MQ3HXX" ;
3436 const paymentInstrumentGroupId = "PG3227C223222B5CMD3FJFKGZ" ;
3537 const transactionRuleId = "TR3227C223222B5FCB756DV9H" ;
38+ const transferLimitId = "TL3227C223222B5CMD3FJFKGZ" ;
3639
3740 describe ( "AccountHolders" , ( ) : void => {
3841 it ( "should support POST /accountHolders" , async ( ) : Promise < void > => {
@@ -1190,4 +1193,134 @@ describe("Balance Platform", (): void => {
11901193 expect ( response . currency ) . toBe ( "USD" ) ;
11911194 } ) ;
11921195
1196+ describe ( "TransferLimitsBalanceAccountLevelApi" , ( ) : void => {
1197+
1198+ it ( "should support POST /balanceAccounts/{id}/transferLimits/approve" , async ( ) : Promise < void > => {
1199+ scope . post ( `/balanceAccounts/${ balanceAccountId } /transferLimits/approve` )
1200+ . reply ( 204 ) ;
1201+ const request : balancePlatform . ApproveTransferLimitRequest = {
1202+ transferLimitIds : [ transferLimitId ]
1203+ } ;
1204+
1205+ await balancePlatformService . TransferLimitsBalanceAccountLevelApi . approvePendingTransferLimits ( balanceAccountId , request ) ;
1206+ } ) ;
1207+
1208+ it ( "should support POST /balanceAccounts/{id}/transferLimits" , async ( ) : Promise < void > => {
1209+
1210+ const mockResponse = {
1211+ "amount" : {
1212+ "value" : 10000 ,
1213+ "currency" : "EUR"
1214+ } ,
1215+ "id" : "TRLI00000000000000000000000001" ,
1216+ "scope" : "perTransaction" ,
1217+ "reference" : "Your reference for the transfer limit" ,
1218+ "scaInformation" : {
1219+ "status" : "pending"
1220+ } ,
1221+ "startsAt" : "2025-08-15T06:36:20+01:00" ,
1222+ "endsAt" : "2026-08-13T23:00:00+01:00" ,
1223+ "limitStatus" : "pendingSCA" ,
1224+ "transferType" : "all"
1225+ } ;
1226+
1227+ scope . post ( `/balanceAccounts/${ balanceAccountId } /transferLimits` )
1228+ . reply ( 200 , mockResponse ) ;
1229+
1230+ const request : balancePlatform . CreateTransferLimitRequest = {
1231+ "amount" : {
1232+ "currency" : "EUR" ,
1233+ "value" : 10000
1234+ } ,
1235+ "reference" : "Your reference for the transfer limit" ,
1236+ "scaInformation" : {
1237+ "scaOnApproval" : true
1238+ } ,
1239+ "scope" : Scope . PerTransaction ,
1240+ "startsAt" : new Date ( "2025-08-15T06:36:20+01:00" ) ,
1241+ "endsAt" : new Date ( "2026-08-14T00:00:00+01:00" ) ,
1242+ "transferType" : TransferType . All
1243+ } ;
1244+
1245+ const response : balancePlatform . TransferLimit = await balancePlatformService . TransferLimitsBalanceAccountLevelApi . createTransferLimit ( balanceAccountId , request ) ;
1246+
1247+ expect ( response . id ) . toBe ( "TRLI00000000000000000000000001" ) ;
1248+ expect ( response . limitStatus ) . toBe ( "pendingSCA" ) ;
1249+ expect ( response . amount . value ) . toBe ( 10000 ) ;
1250+ } ) ;
1251+
1252+ it ( "should support DELETE /balanceAccounts/{id}/transferLimits/{transferLimitId}" , async ( ) : Promise < void > => {
1253+ scope . delete ( `/balanceAccounts/${ balanceAccountId } /transferLimits/${ transferLimitId } ` ) . reply ( 204 ) ;
1254+
1255+ await balancePlatformService . TransferLimitsBalanceAccountLevelApi . deletePendingTransferLimit ( transferLimitId , balanceAccountId ) ;
1256+ } ) ;
1257+
1258+ it ( "should support GET /balanceAccounts/{id}/transferLimits/current" , async ( ) : Promise < void > => {
1259+
1260+ const mockResponse = {
1261+ "transferLimits" : [
1262+ {
1263+ "id" : transferLimitId ,
1264+ "limit" : {
1265+ "currency" : "EUR" ,
1266+ "value" : 10000
1267+ } ,
1268+ "type" : "maxUsage" ,
1269+ "counterparty" : {
1270+ "balanceAccountId" : "BA3227C223222B5CMD3FJFKGZ"
1271+ }
1272+ }
1273+ ]
1274+ }
1275+
1276+ scope . get ( `/balanceAccounts/${ balanceAccountId } /transferLimits/current?scope=perTransaction&transferType=instant` )
1277+ . reply ( 200 , mockResponse ) ;
1278+
1279+ const response : balancePlatform . TransferLimitListResponse = await balancePlatformService . TransferLimitsBalanceAccountLevelApi . getCurrentTransferLimits ( balanceAccountId , balancePlatform . Scope . PerTransaction , balancePlatform . TransferType . Instant ) ;
1280+
1281+ expect ( response . transferLimits . length ) . toBe ( 1 ) ;
1282+ expect ( response . transferLimits [ 0 ] . id ) . toBe ( transferLimitId ) ;
1283+ } ) ;
1284+
1285+ it ( "should support GET /balanceAccounts/{id}/transferLimits/{transferLimitId}" , async ( ) : Promise < void > => {
1286+
1287+ const mockResponse = {
1288+ "id" : transferLimitId ,
1289+ "limit" : {
1290+ "currency" : "EUR" ,
1291+ "value" : 10000
1292+ } ,
1293+ "type" : "maxUsage" ,
1294+ "counterparty" : {
1295+ "balanceAccountId" : "BA3227C223222B5CMD3FJFKGZ"
1296+ }
1297+ }
1298+
1299+ scope . get ( `/balanceAccounts/${ balanceAccountId } /transferLimits/${ transferLimitId } ` )
1300+ . reply ( 200 , mockResponse ) ;
1301+
1302+ const response : balancePlatform . TransferLimit = await balancePlatformService . TransferLimitsBalanceAccountLevelApi . getSpecificTransferLimit ( transferLimitId , balanceAccountId ) ;
1303+
1304+ expect ( response . id ) . toBe ( transferLimitId ) ;
1305+ } ) ;
1306+
1307+ it ( "should support GET /balanceAccounts/{id}/transferLimits" , async ( ) : Promise < void > => {
1308+
1309+ const mockResponse = {
1310+ "transferLimits" : [
1311+ {
1312+ "id" : transferLimitId ,
1313+ }
1314+ ]
1315+ }
1316+ scope . get ( `/balanceAccounts/${ balanceAccountId } /transferLimits?scope=perTransaction&transferType=instant&status=active` )
1317+ . reply ( 200 , mockResponse ) ;
1318+
1319+ const response : balancePlatform . TransferLimitListResponse = await balancePlatformService . TransferLimitsBalanceAccountLevelApi . getTransferLimits ( balanceAccountId , balancePlatform . Scope . PerTransaction , balancePlatform . TransferType . Instant , balancePlatform . LimitStatus . Active ) ;
1320+
1321+ expect ( response . transferLimits . length ) . toBe ( 1 ) ;
1322+ expect ( response . transferLimits [ 0 ] . id ) . toBe ( transferLimitId ) ;
1323+ } ) ;
1324+ } ) ;
1325+
11931326} ) ;
0 commit comments