@@ -1444,5 +1444,190 @@ describe("Balance Platform", (): void => {
14441444 } ) ;
14451445 } ) ;
14461446
1447+ describe ( "SCAAssociationManagementApi" , ( ) : void => {
1448+ it ( "should support PATCH /scaAssociations" , async ( ) : Promise < void > => {
1449+ scope . patch ( "/scaAssociations" )
1450+ . reply ( 200 , {
1451+ "scaAssociations" : [
1452+ {
1453+ "scaDeviceId" : "BSDR42XV3223223S5N6CDQDGH53M8H" ,
1454+ "entityType" : "accountHolder" ,
1455+ "entityId" : "AH00000000000000000000001" ,
1456+ "status" : "active"
1457+ }
1458+ ]
1459+ } ) ;
1460+
1461+ const request : Types . balancePlatform . ApproveAssociationRequest = {
1462+ "status" : Types . balancePlatform . AssociationStatus . Active ,
1463+ "entityType" : Types . balancePlatform . ScaEntityType . AccountHolder ,
1464+ "entityId" : "AH00000000000000000000001" ,
1465+ "scaDeviceIds" : [
1466+ "BSDR42XV3223223S5N6CDQDGH53M8H"
1467+ ]
1468+ } ;
1469+
1470+ const response : Types . balancePlatform . ApproveAssociationResponse = await balancePlatformService . SCAAssociationManagementApi . approveAssociation ( request ) ;
1471+
1472+ expect ( response . scaAssociations ) . toBeTruthy ( ) ;
1473+ expect ( response . scaAssociations ?. length ) . toBe ( 1 ) ;
1474+ expect ( response . scaAssociations ! [ 0 ] . scaDeviceId ) . toBe ( "BSDR42XV3223223S5N6CDQDGH53M8H" ) ;
1475+ expect ( response . scaAssociations ! [ 0 ] . entityType ) . toBe ( "accountHolder" ) ;
1476+ expect ( response . scaAssociations ! [ 0 ] . entityId ) . toBe ( "AH00000000000000000000001" ) ;
1477+ expect ( response . scaAssociations ! [ 0 ] . status ) . toBe ( "active" ) ;
1478+ } ) ;
1479+
1480+ it ( "should support GET /scaAssociations" , async ( ) : Promise < void > => {
1481+ const entityType = Types . balancePlatform . ScaEntityType . AccountHolder ;
1482+ const entityId = "AH3227J223222D5HHM4779X6X" ;
1483+ const pageSize = 10 ;
1484+ const pageNumber = 0 ;
1485+
1486+ scope . get ( `/scaAssociations?entityType=${ entityType } &entityId=${ entityId } &pageSize=${ pageSize } ` )
1487+ . reply ( 200 , {
1488+ "_links" : {
1489+ "self" : {
1490+ "href" : `https://exampledomain.com/bcl/api/v2/scaAssociations?pageNumber=${ pageNumber } &entityType=${ entityType } &pageSize=${ pageSize } &entityId=${ entityId } `
1491+ }
1492+ } ,
1493+ "itemsTotal" : 2 ,
1494+ "pagesTotal" : 1 ,
1495+ "data" : [
1496+ {
1497+ "scaDeviceId" : "BSDR11111111111A1AAA1AAAAA1AA1" ,
1498+ "scaDeviceName" : "Device 1" ,
1499+ "scaDeviceType" : "ios" ,
1500+ "entityType" : "accountHolder" ,
1501+ "entityId" : "AH00000000000000000000001" ,
1502+ "status" : "active" ,
1503+ "createdAt" : "2025-09-02T14:39:17.232Z"
1504+ } ,
1505+ {
1506+ "scaDeviceId" : "BSDR22222222222B2BBB2BBBBB2BB2" ,
1507+ "scaDeviceName" : "Device 2" ,
1508+ "scaDeviceType" : "ios" ,
1509+ "entityType" : "accountHolder" ,
1510+ "entityId" : "AH00000000000000000000001" ,
1511+ "status" : "pendingApproval" ,
1512+ "createdAt" : "2025-09-02T14:39:17.232Z"
1513+ }
1514+ ]
1515+ } ) ;
1516+
1517+ const response : Types . balancePlatform . ListAssociationsResponse = await balancePlatformService . SCAAssociationManagementApi . listAssociations ( entityType , entityId , pageSize , pageNumber ) ;
1518+
1519+ expect ( response ) . toBeTruthy ( ) ;
1520+ expect ( response . itemsTotal ) . toBe ( 2 ) ;
1521+ expect ( response . pagesTotal ) . toBe ( 1 ) ;
1522+ expect ( response . data ) . toBeTruthy ( ) ;
1523+ expect ( response . data ?. length ) . toBe ( 2 ) ;
1524+ expect ( response . data ! [ 0 ] . scaDeviceId ) . toBe ( "BSDR11111111111A1AAA1AAAAA1AA1" ) ;
1525+ expect ( response . data ! [ 0 ] . scaDeviceName ) . toBe ( "Device 1" ) ;
1526+ expect ( response . data ! [ 0 ] . status ) . toBe ( "active" ) ;
1527+ expect ( response . data ! [ 1 ] . scaDeviceId ) . toBe ( "BSDR22222222222B2BBB2BBBBB2BB2" ) ;
1528+ expect ( response . data ! [ 1 ] . status ) . toBe ( "pendingApproval" ) ;
1529+ } ) ;
1530+
1531+ it ( "should support DELETE /scaAssociations" , async ( ) : Promise < void > => {
1532+ scope . delete ( "/scaAssociations" )
1533+ . reply ( 204 ) ;
1534+
1535+ const request : Types . balancePlatform . RemoveAssociationRequest = {
1536+ "entityType" : Types . balancePlatform . ScaEntityType . AccountHolder ,
1537+ "entityId" : "AH00000000000000000000001" ,
1538+ "scaDeviceIds" : [ "BSDR11111111111A1AAA1AAAAA1AA1" ]
1539+ } ;
1540+
1541+ await balancePlatformService . SCAAssociationManagementApi . removeAssociation ( request ) ;
1542+
1543+ expect ( scope . isDone ( ) ) . toBeTruthy ( ) ;
1544+ } ) ;
1545+ } ) ;
1546+
1547+ describe ( "SCADeviceManagementApi" , ( ) : void => {
1548+ it ( "should support POST /scaDevices" , async ( ) : Promise < void > => {
1549+ scope . post ( "/scaDevices" )
1550+ . reply ( 200 , {
1551+ "scaDevice" : {
1552+ "id" : "BSDR42XV3223223S5N6CDQDGH53M8H" ,
1553+ "name" : "My Device" ,
1554+ "type" : "ios"
1555+ } ,
1556+ "sdkInput" : "eyJjaGFsbGVuZ2UiOiJVWEZaTURONGNXWjZUVFExUlhWV2JuaEJPVzVzTm05cVVEUktUbFZtZGtrPSJ9"
1557+ } ) ;
1558+
1559+ const request : Types . balancePlatform . BeginScaDeviceRegistrationRequest = {
1560+ "name" : "My Device" ,
1561+ "sdkOutput" : "eyJjaGFsbGVuZ2UiOiJVWEZaTURONGNXWjZUVFExUlhWV2JuaEJPVzVzTm05cVVEUktUbFZtZGtrPSJ9"
1562+ } ;
1563+
1564+ const response : Types . balancePlatform . BeginScaDeviceRegistrationResponse = await balancePlatformService . SCADeviceManagementApi . beginScaDeviceRegistration ( request ) ;
1565+
1566+ expect ( response ) . toBeTruthy ( ) ;
1567+ expect ( response . scaDevice ) . toBeTruthy ( ) ;
1568+ expect ( response . scaDevice ?. id ) . toBe ( "BSDR42XV3223223S5N6CDQDGH53M8H" ) ;
1569+ expect ( response . scaDevice ?. name ) . toBe ( "My Device" ) ;
1570+ expect ( response . scaDevice ?. type ) . toBe ( "ios" ) ;
1571+ expect ( response . sdkInput ) . toBe ( "eyJjaGFsbGVuZ2UiOiJVWEZaTURONGNXWjZUVFExUlhWV2JuaEJPVzVzTm05cVVEUktUbFZtZGtrPSJ9" ) ;
1572+ } ) ;
1573+
1574+ it ( "should support PATCH /scaDevices/{deviceId}" , async ( ) : Promise < void > => {
1575+ const deviceId = "BSDR42XV3223223S5N6CDQDGH53M8H" ;
1576+ scope . patch ( `/scaDevices/${ deviceId } ` )
1577+ . reply ( 200 , {
1578+ "scaDevice" : {
1579+ "id" : "BSDR42XV3223223S5N6CDQDGH53M8H" ,
1580+ "name" : "Device" ,
1581+ "type" : "ios"
1582+ }
1583+ } ) ;
1584+
1585+ const request : Types . balancePlatform . FinishScaDeviceRegistrationRequest = {
1586+ "sdkOutput" : "eyJjaGFsbGVuZ2UiOiJVWEZaTURONGNXWjZUVFExUlhWV2JuaEJPVzVzTm05cVVEUktUbFZtZGtrPSJ9"
1587+ } ;
1588+
1589+ const response : Types . balancePlatform . FinishScaDeviceRegistrationResponse = await balancePlatformService . SCADeviceManagementApi . finishScaDeviceRegistration ( deviceId , request ) ;
1590+
1591+ expect ( response ) . toBeTruthy ( ) ;
1592+ expect ( response . scaDevice ) . toBeTruthy ( ) ;
1593+ expect ( response . scaDevice ?. id ) . toBe ( "BSDR42XV3223223S5N6CDQDGH53M8H" ) ;
1594+ expect ( response . scaDevice ?. name ) . toBe ( "Device" ) ;
1595+ expect ( response . scaDevice ?. type ) . toBe ( "ios" ) ;
1596+ } ) ;
1597+
1598+ it ( "should support POST /scaDevices/{deviceId}/scaAssociations" , async ( ) : Promise < void > => {
1599+ const deviceId = "BSDR42XV3223223S5N6CDQDGH53M8H" ;
1600+ scope . post ( `/scaDevices/${ deviceId } /scaAssociations` )
1601+ . reply ( 200 , {
1602+ "scaAssociations" : [
1603+ {
1604+ "scaDeviceId" : "BSDR11111111111A1AAA1AAAAA1AA1" ,
1605+ "entityType" : "accountHolder" ,
1606+ "entityId" : "AH00000000000000000000001" ,
1607+ "status" : "pendingApproval"
1608+ }
1609+ ]
1610+ } ) ;
1611+
1612+ const request : Types . balancePlatform . SubmitScaAssociationRequest = {
1613+ "entities" : [
1614+ {
1615+ "type" : Types . balancePlatform . ScaEntityType . AccountHolder ,
1616+ "id" : "AH00000000000000000000001"
1617+ }
1618+ ]
1619+ } ;
1620+
1621+ const response : Types . balancePlatform . SubmitScaAssociationResponse = await balancePlatformService . SCADeviceManagementApi . submitScaAssociation ( deviceId , request ) ;
1622+
1623+ expect ( response ) . toBeTruthy ( ) ;
1624+ expect ( response . scaAssociations ) . toBeTruthy ( ) ;
1625+ expect ( response . scaAssociations ?. length ) . toBe ( 1 ) ;
1626+ expect ( response . scaAssociations ! [ 0 ] . scaDeviceId ) . toBe ( "BSDR11111111111A1AAA1AAAAA1AA1" ) ;
1627+ expect ( response . scaAssociations ! [ 0 ] . entityType ) . toBe ( "accountHolder" ) ;
1628+ expect ( response . scaAssociations ! [ 0 ] . entityId ) . toBe ( "AH00000000000000000000001" ) ;
1629+ expect ( response . scaAssociations ! [ 0 ] . status ) . toBe ( "pendingApproval" ) ;
1630+ } ) ;
1631+ } ) ;
14471632
14481633} ) ;
0 commit comments