@financeable/aggregation 0.8.3 → 0.9.1
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/FUNCTIONS.md +153 -36
- package/README.md +475 -94
- package/docs/sdks/applications/README.md +9 -15
- package/docs/sdks/oauthtoken/README.md +5 -9
- package/docs/sdks/supportingdocuments/README.md +9 -16
- package/funcs/applicationsCreate.d.ts +3 -3
- package/funcs/applicationsCreate.d.ts.map +1 -1
- package/funcs/applicationsCreate.js +4 -6
- package/funcs/applicationsCreate.js.map +1 -1
- package/funcs/oauthTokenGet.d.ts +3 -2
- package/funcs/oauthTokenGet.d.ts.map +1 -1
- package/funcs/oauthTokenGet.js +4 -2
- package/funcs/oauthTokenGet.js.map +1 -1
- package/funcs/supportingDocumentsCreate.d.ts +3 -3
- package/funcs/supportingDocumentsCreate.d.ts.map +1 -1
- package/funcs/supportingDocumentsCreate.js +5 -8
- package/funcs/supportingDocumentsCreate.js.map +1 -1
- package/hooks/types.d.ts +2 -0
- package/hooks/types.d.ts.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +7 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/lib/files.d.ts +5 -0
- package/lib/files.d.ts.map +1 -1
- package/lib/files.js +41 -0
- package/lib/files.js.map +1 -1
- package/lib/matchers.d.ts +3 -10
- package/lib/matchers.d.ts.map +1 -1
- package/lib/matchers.js +33 -31
- package/lib/matchers.js.map +1 -1
- package/lib/sdks.d.ts +1 -0
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +3 -3
- package/lib/sdks.js.map +1 -1
- package/lib/security.d.ts +2 -2
- package/lib/security.d.ts.map +1 -1
- package/models/components/addressattributes.d.ts +8 -8
- package/models/components/addressattributes.d.ts.map +1 -1
- package/models/components/addressattributes.js +14 -13
- package/models/components/addressattributes.js.map +1 -1
- package/models/components/badrequesterror.d.ts +24 -24
- package/models/components/badrequesterror.d.ts.map +1 -1
- package/models/components/badrequesterror.js +37 -38
- package/models/components/badrequesterror.js.map +1 -1
- package/models/components/commercialsecuredapplicationpayload.d.ts +8 -8
- package/models/components/commercialsecuredapplicationpayload.d.ts.map +1 -1
- package/models/components/commercialsecuredapplicationpayload.js +13 -14
- package/models/components/commercialsecuredapplicationpayload.js.map +1 -1
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts +90 -90
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts.map +1 -1
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js +116 -118
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js.map +1 -1
- package/models/components/customerattributes.d.ts +12 -1
- package/models/components/customerattributes.d.ts.map +1 -1
- package/models/components/customerattributes.js +5 -0
- package/models/components/customerattributes.js.map +1 -1
- package/models/components/forbiddenerror.d.ts +16 -16
- package/models/components/forbiddenerror.d.ts.map +1 -1
- package/models/components/forbiddenerror.js +25 -25
- package/models/components/forbiddenerror.js.map +1 -1
- package/models/components/loandetailsattributes.d.ts +8 -8
- package/models/components/loandetailsattributes.d.ts.map +1 -1
- package/models/components/loandetailsattributes.js +8 -8
- package/models/components/loandetailsattributes.js.map +1 -1
- package/models/components/supportingdocumentrelationships.d.ts +45 -45
- package/models/components/supportingdocumentrelationships.d.ts.map +1 -1
- package/models/components/supportingdocumentrelationships.js +54 -54
- package/models/components/supportingdocumentrelationships.js.map +1 -1
- package/models/components/supportingdocumentresource.d.ts +8 -8
- package/models/components/supportingdocumentresource.d.ts.map +1 -1
- package/models/components/supportingdocumentresource.js +13 -13
- package/models/components/supportingdocumentresource.js.map +1 -1
- package/models/errors/apierror.d.ts +8 -6
- package/models/errors/apierror.d.ts.map +1 -1
- package/models/errors/apierror.js +23 -10
- package/models/errors/apierror.js.map +1 -1
- package/models/errors/financeableerror.d.ts +19 -0
- package/models/errors/financeableerror.d.ts.map +1 -0
- package/models/errors/financeableerror.js +20 -0
- package/models/errors/financeableerror.js.map +1 -0
- package/models/errors/index.d.ts +1 -2
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +1 -2
- package/models/errors/index.js.map +1 -1
- package/models/errors/responsevalidationerror.d.ts +26 -0
- package/models/errors/responsevalidationerror.d.ts.map +1 -0
- package/models/errors/responsevalidationerror.js +66 -0
- package/models/errors/responsevalidationerror.js.map +1 -0
- package/models/errors/sdkvalidationerror.d.ts +1 -0
- package/models/errors/sdkvalidationerror.d.ts.map +1 -1
- package/models/errors/sdkvalidationerror.js +14 -0
- package/models/errors/sdkvalidationerror.js.map +1 -1
- package/models/operations/createapplication.d.ts +107 -30
- package/models/operations/createapplication.d.ts.map +1 -1
- package/models/operations/createapplication.js +125 -44
- package/models/operations/createapplication.js.map +1 -1
- package/models/operations/supportingdocumentscreate.d.ts +144 -0
- package/models/operations/supportingdocumentscreate.d.ts.map +1 -1
- package/models/operations/supportingdocumentscreate.js +186 -1
- package/models/operations/supportingdocumentscreate.js.map +1 -1
- package/package.json +1 -1
- package/sdk/applications.d.ts +1 -1
- package/sdk/applications.d.ts.map +1 -1
- package/sdk/sdk.d.ts +2 -2
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +3 -3
- package/sdk/sdk.js.map +1 -1
- package/sdk/supportingdocuments.d.ts +1 -1
- package/sdk/supportingdocuments.d.ts.map +1 -1
- package/src/funcs/applicationsCreate.ts +30 -40
- package/src/funcs/oauthTokenGet.ts +24 -20
- package/src/funcs/supportingDocumentsCreate.ts +31 -42
- package/src/hooks/types.ts +2 -0
- package/src/index.ts +2 -0
- package/src/lib/config.ts +7 -3
- package/src/lib/files.ts +42 -0
- package/src/lib/matchers.ts +44 -41
- package/src/lib/sdks.ts +10 -4
- package/src/lib/security.ts +2 -2
- package/src/models/components/addressattributes.ts +14 -18
- package/src/models/components/badrequesterror.ts +48 -44
- package/src/models/components/commercialsecuredapplicationpayload.ts +15 -20
- package/src/models/components/commercialsecuredloancommercialapplicationrelationships.ts +178 -238
- package/src/models/components/customerattributes.ts +20 -1
- package/src/models/components/forbiddenerror.ts +30 -32
- package/src/models/components/loandetailsattributes.ts +16 -16
- package/src/models/components/supportingdocumentrelationships.ts +117 -82
- package/src/models/components/supportingdocumentresource.ts +18 -15
- package/src/models/errors/apierror.ts +29 -16
- package/src/models/errors/financeableerror.ts +35 -0
- package/src/models/errors/index.ts +1 -2
- package/src/models/errors/responsevalidationerror.ts +50 -0
- package/src/models/errors/sdkvalidationerror.ts +12 -0
- package/src/models/operations/createapplication.ts +299 -64
- package/src/models/operations/supportingdocumentscreate.ts +386 -0
- package/src/sdk/applications.ts +1 -1
- package/src/sdk/sdk.ts +7 -7
- package/src/sdk/supportingdocuments.ts +1 -1
- package/src/types/constdatetime.ts +1 -1
- package/types/constdatetime.js +1 -1
- package/models/errors/createapplication.d.ts +0 -73
- package/models/errors/createapplication.d.ts.map +0 -1
- package/models/errors/createapplication.js +0 -120
- package/models/errors/createapplication.js.map +0 -1
- package/models/errors/supportingdocumentscreate.d.ts +0 -143
- package/models/errors/supportingdocumentscreate.d.ts.map +0 -1
- package/models/errors/supportingdocumentscreate.js +0 -225
- package/models/errors/supportingdocumentscreate.js.map +0 -1
- package/src/models/errors/createapplication.ts +0 -149
- package/src/models/errors/supportingdocumentscreate.ts +0 -342
package/README.md
CHANGED
|
@@ -379,20 +379,154 @@ const financeable = new Financeable({
|
|
|
379
379
|
});
|
|
380
380
|
|
|
381
381
|
async function run() {
|
|
382
|
-
const result = await financeable.
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
382
|
+
const result = await financeable.applications.create({
|
|
383
|
+
data: {
|
|
384
|
+
type: "entities",
|
|
385
|
+
attributes: {
|
|
386
|
+
applicationType: "consumerSecured",
|
|
387
|
+
associatedBrokerEmail: "<value>",
|
|
388
|
+
},
|
|
389
|
+
relationships: {
|
|
390
|
+
customers: {
|
|
391
|
+
data: [
|
|
392
|
+
{
|
|
393
|
+
type: "customers",
|
|
394
|
+
attributes: {
|
|
395
|
+
title: "Mr",
|
|
396
|
+
firstName: "Courtney",
|
|
397
|
+
lastName: "Greenfelder",
|
|
398
|
+
dateOfBirth: "1981-06-22",
|
|
399
|
+
idExpiryDate: "<value>",
|
|
400
|
+
},
|
|
401
|
+
relationships: {
|
|
402
|
+
addresses: {
|
|
403
|
+
data: [
|
|
404
|
+
{
|
|
405
|
+
type: "addresses",
|
|
406
|
+
attributes: {
|
|
407
|
+
id: "12345678901",
|
|
408
|
+
addressType: "residential",
|
|
409
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
410
|
+
city: "Sydney",
|
|
411
|
+
postCode: "2000",
|
|
412
|
+
streetAddress: "42 Wallaby Way",
|
|
413
|
+
addressLine2: "",
|
|
414
|
+
streetNumber: "42",
|
|
415
|
+
streetType: "Way",
|
|
416
|
+
street: "Wallaby",
|
|
417
|
+
state: "NSW",
|
|
418
|
+
country: "Australia",
|
|
419
|
+
status: "current",
|
|
420
|
+
monthsAt: 24,
|
|
421
|
+
yearsAt: 2,
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
],
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
type: "customers",
|
|
430
|
+
attributes: {
|
|
431
|
+
title: "Mr",
|
|
432
|
+
firstName: "Courtney",
|
|
433
|
+
lastName: "Greenfelder",
|
|
434
|
+
dateOfBirth: "1981-06-22",
|
|
435
|
+
idExpiryDate: "<value>",
|
|
436
|
+
},
|
|
437
|
+
relationships: {
|
|
438
|
+
addresses: {
|
|
439
|
+
data: [
|
|
440
|
+
{
|
|
441
|
+
type: "addresses",
|
|
442
|
+
attributes: {
|
|
443
|
+
id: "12345678901",
|
|
444
|
+
addressType: "residential",
|
|
445
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
446
|
+
city: "Sydney",
|
|
447
|
+
postCode: "2000",
|
|
448
|
+
streetAddress: "42 Wallaby Way",
|
|
449
|
+
addressLine2: "",
|
|
450
|
+
streetNumber: "42",
|
|
451
|
+
streetType: "Way",
|
|
452
|
+
street: "Wallaby",
|
|
453
|
+
state: "NSW",
|
|
454
|
+
country: "Australia",
|
|
455
|
+
status: "current",
|
|
456
|
+
monthsAt: 24,
|
|
457
|
+
yearsAt: 2,
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
],
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
type: "customers",
|
|
466
|
+
attributes: {
|
|
467
|
+
title: "Mr",
|
|
468
|
+
firstName: "Courtney",
|
|
469
|
+
lastName: "Greenfelder",
|
|
470
|
+
dateOfBirth: "1981-06-22",
|
|
471
|
+
idExpiryDate: "<value>",
|
|
472
|
+
},
|
|
473
|
+
relationships: {
|
|
474
|
+
addresses: {
|
|
475
|
+
data: [
|
|
476
|
+
{
|
|
477
|
+
type: "addresses",
|
|
478
|
+
attributes: {
|
|
479
|
+
id: "12345678901",
|
|
480
|
+
addressType: "residential",
|
|
481
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
482
|
+
city: "Sydney",
|
|
483
|
+
postCode: "2000",
|
|
484
|
+
streetAddress: "42 Wallaby Way",
|
|
485
|
+
addressLine2: "",
|
|
486
|
+
streetNumber: "42",
|
|
487
|
+
streetType: "Way",
|
|
488
|
+
street: "Wallaby",
|
|
489
|
+
state: "NSW",
|
|
490
|
+
country: "Australia",
|
|
491
|
+
status: "current",
|
|
492
|
+
monthsAt: 24,
|
|
493
|
+
yearsAt: 2,
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
],
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
},
|
|
500
|
+
],
|
|
390
501
|
},
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
id: "
|
|
502
|
+
asset: {
|
|
503
|
+
data: {
|
|
504
|
+
type: "assets",
|
|
505
|
+
attributes: {
|
|
506
|
+
id: "12345678901",
|
|
507
|
+
ageOfAsset: 3,
|
|
508
|
+
ageOfAssetAtEnd: 8,
|
|
509
|
+
condition: "USED",
|
|
510
|
+
assetType: "CARAVAN",
|
|
511
|
+
assetValue: "35000.00",
|
|
512
|
+
make: "Toyota",
|
|
513
|
+
assetModel: "Camry",
|
|
514
|
+
registrationNumber: "ABC123",
|
|
515
|
+
registrationState: "VIC",
|
|
516
|
+
vin: "1HGCM82633A123456",
|
|
517
|
+
supplierName: "Mr and Mrs Smith",
|
|
518
|
+
supplierABN: "12345678901",
|
|
519
|
+
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
520
|
+
supplierPhone: "0412345678",
|
|
521
|
+
supplierContactName: "John Smith",
|
|
522
|
+
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
523
|
+
privateSale: false,
|
|
524
|
+
typeOfSale: "AUTHORISED_SELLER",
|
|
525
|
+
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
526
|
+
netAssetValue: "32000.00",
|
|
527
|
+
isLuxury: false,
|
|
528
|
+
additionalFees: "995.00",
|
|
529
|
+
additionalTaxes: "0.00",
|
|
396
530
|
},
|
|
397
531
|
},
|
|
398
532
|
},
|
|
@@ -411,7 +545,6 @@ async function run() {
|
|
|
411
545
|
},
|
|
412
546
|
});
|
|
413
547
|
|
|
414
|
-
// Handle the result
|
|
415
548
|
console.log(result);
|
|
416
549
|
}
|
|
417
550
|
|
|
@@ -438,20 +571,154 @@ const financeable = new Financeable({
|
|
|
438
571
|
});
|
|
439
572
|
|
|
440
573
|
async function run() {
|
|
441
|
-
const result = await financeable.
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
574
|
+
const result = await financeable.applications.create({
|
|
575
|
+
data: {
|
|
576
|
+
type: "entities",
|
|
577
|
+
attributes: {
|
|
578
|
+
applicationType: "consumerSecured",
|
|
579
|
+
associatedBrokerEmail: "<value>",
|
|
580
|
+
},
|
|
581
|
+
relationships: {
|
|
582
|
+
customers: {
|
|
583
|
+
data: [
|
|
584
|
+
{
|
|
585
|
+
type: "customers",
|
|
586
|
+
attributes: {
|
|
587
|
+
title: "Mr",
|
|
588
|
+
firstName: "Courtney",
|
|
589
|
+
lastName: "Greenfelder",
|
|
590
|
+
dateOfBirth: "1981-06-22",
|
|
591
|
+
idExpiryDate: "<value>",
|
|
592
|
+
},
|
|
593
|
+
relationships: {
|
|
594
|
+
addresses: {
|
|
595
|
+
data: [
|
|
596
|
+
{
|
|
597
|
+
type: "addresses",
|
|
598
|
+
attributes: {
|
|
599
|
+
id: "12345678901",
|
|
600
|
+
addressType: "residential",
|
|
601
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
602
|
+
city: "Sydney",
|
|
603
|
+
postCode: "2000",
|
|
604
|
+
streetAddress: "42 Wallaby Way",
|
|
605
|
+
addressLine2: "",
|
|
606
|
+
streetNumber: "42",
|
|
607
|
+
streetType: "Way",
|
|
608
|
+
street: "Wallaby",
|
|
609
|
+
state: "NSW",
|
|
610
|
+
country: "Australia",
|
|
611
|
+
status: "current",
|
|
612
|
+
monthsAt: 24,
|
|
613
|
+
yearsAt: 2,
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
],
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
type: "customers",
|
|
622
|
+
attributes: {
|
|
623
|
+
title: "Mr",
|
|
624
|
+
firstName: "Courtney",
|
|
625
|
+
lastName: "Greenfelder",
|
|
626
|
+
dateOfBirth: "1981-06-22",
|
|
627
|
+
idExpiryDate: "<value>",
|
|
628
|
+
},
|
|
629
|
+
relationships: {
|
|
630
|
+
addresses: {
|
|
631
|
+
data: [
|
|
632
|
+
{
|
|
633
|
+
type: "addresses",
|
|
634
|
+
attributes: {
|
|
635
|
+
id: "12345678901",
|
|
636
|
+
addressType: "residential",
|
|
637
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
638
|
+
city: "Sydney",
|
|
639
|
+
postCode: "2000",
|
|
640
|
+
streetAddress: "42 Wallaby Way",
|
|
641
|
+
addressLine2: "",
|
|
642
|
+
streetNumber: "42",
|
|
643
|
+
streetType: "Way",
|
|
644
|
+
street: "Wallaby",
|
|
645
|
+
state: "NSW",
|
|
646
|
+
country: "Australia",
|
|
647
|
+
status: "current",
|
|
648
|
+
monthsAt: 24,
|
|
649
|
+
yearsAt: 2,
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
],
|
|
653
|
+
},
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
type: "customers",
|
|
658
|
+
attributes: {
|
|
659
|
+
title: "Mr",
|
|
660
|
+
firstName: "Courtney",
|
|
661
|
+
lastName: "Greenfelder",
|
|
662
|
+
dateOfBirth: "1981-06-22",
|
|
663
|
+
idExpiryDate: "<value>",
|
|
664
|
+
},
|
|
665
|
+
relationships: {
|
|
666
|
+
addresses: {
|
|
667
|
+
data: [
|
|
668
|
+
{
|
|
669
|
+
type: "addresses",
|
|
670
|
+
attributes: {
|
|
671
|
+
id: "12345678901",
|
|
672
|
+
addressType: "residential",
|
|
673
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
674
|
+
city: "Sydney",
|
|
675
|
+
postCode: "2000",
|
|
676
|
+
streetAddress: "42 Wallaby Way",
|
|
677
|
+
addressLine2: "",
|
|
678
|
+
streetNumber: "42",
|
|
679
|
+
streetType: "Way",
|
|
680
|
+
street: "Wallaby",
|
|
681
|
+
state: "NSW",
|
|
682
|
+
country: "Australia",
|
|
683
|
+
status: "current",
|
|
684
|
+
monthsAt: 24,
|
|
685
|
+
yearsAt: 2,
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
],
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
},
|
|
692
|
+
],
|
|
449
693
|
},
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
id: "
|
|
694
|
+
asset: {
|
|
695
|
+
data: {
|
|
696
|
+
type: "assets",
|
|
697
|
+
attributes: {
|
|
698
|
+
id: "12345678901",
|
|
699
|
+
ageOfAsset: 3,
|
|
700
|
+
ageOfAssetAtEnd: 8,
|
|
701
|
+
condition: "USED",
|
|
702
|
+
assetType: "CARAVAN",
|
|
703
|
+
assetValue: "35000.00",
|
|
704
|
+
make: "Toyota",
|
|
705
|
+
assetModel: "Camry",
|
|
706
|
+
registrationNumber: "ABC123",
|
|
707
|
+
registrationState: "VIC",
|
|
708
|
+
vin: "1HGCM82633A123456",
|
|
709
|
+
supplierName: "Mr and Mrs Smith",
|
|
710
|
+
supplierABN: "12345678901",
|
|
711
|
+
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
712
|
+
supplierPhone: "0412345678",
|
|
713
|
+
supplierContactName: "John Smith",
|
|
714
|
+
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
715
|
+
privateSale: false,
|
|
716
|
+
typeOfSale: "AUTHORISED_SELLER",
|
|
717
|
+
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
718
|
+
netAssetValue: "32000.00",
|
|
719
|
+
isLuxury: false,
|
|
720
|
+
additionalFees: "995.00",
|
|
721
|
+
additionalTaxes: "0.00",
|
|
455
722
|
},
|
|
456
723
|
},
|
|
457
724
|
},
|
|
@@ -459,7 +726,6 @@ async function run() {
|
|
|
459
726
|
},
|
|
460
727
|
});
|
|
461
728
|
|
|
462
|
-
// Handle the result
|
|
463
729
|
console.log(result);
|
|
464
730
|
}
|
|
465
731
|
|
|
@@ -471,47 +737,175 @@ run();
|
|
|
471
737
|
<!-- Start Error Handling [errors] -->
|
|
472
738
|
## Error Handling
|
|
473
739
|
|
|
474
|
-
|
|
740
|
+
[`FinanceableError`](./src/models/errors/financeableerror.ts) is the base class for all HTTP error responses. It has the following properties:
|
|
475
741
|
|
|
476
|
-
|
|
|
477
|
-
|
|
|
478
|
-
|
|
|
479
|
-
|
|
|
480
|
-
|
|
|
481
|
-
|
|
|
482
|
-
|
|
483
|
-
If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
|
|
742
|
+
| Property | Type | Description |
|
|
743
|
+
| ------------------- | ---------- | ------------------------------------------------------ |
|
|
744
|
+
| `error.message` | `string` | Error message |
|
|
745
|
+
| `error.statusCode` | `number` | HTTP response status code eg `404` |
|
|
746
|
+
| `error.headers` | `Headers` | HTTP response headers |
|
|
747
|
+
| `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
|
|
748
|
+
| `error.rawResponse` | `Response` | Raw HTTP response |
|
|
484
749
|
|
|
750
|
+
### Example
|
|
485
751
|
```typescript
|
|
486
752
|
import { Financeable } from "@financeable/aggregation";
|
|
487
|
-
import
|
|
488
|
-
One,
|
|
489
|
-
SDKValidationError,
|
|
490
|
-
SupportingDocumentsCreateResponseBody,
|
|
491
|
-
Two,
|
|
492
|
-
} from "@financeable/aggregation/models/errors";
|
|
753
|
+
import * as errors from "@financeable/aggregation/models/errors";
|
|
493
754
|
|
|
494
755
|
const financeable = new Financeable({
|
|
495
756
|
clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
|
|
496
757
|
});
|
|
497
758
|
|
|
498
759
|
async function run() {
|
|
499
|
-
let result;
|
|
500
760
|
try {
|
|
501
|
-
result = await financeable.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
761
|
+
const result = await financeable.applications.create({
|
|
762
|
+
data: {
|
|
763
|
+
type: "entities",
|
|
764
|
+
attributes: {
|
|
765
|
+
applicationType: "consumerSecured",
|
|
766
|
+
associatedBrokerEmail: "<value>",
|
|
767
|
+
},
|
|
768
|
+
relationships: {
|
|
769
|
+
customers: {
|
|
770
|
+
data: [
|
|
771
|
+
{
|
|
772
|
+
type: "customers",
|
|
773
|
+
attributes: {
|
|
774
|
+
title: "Mr",
|
|
775
|
+
firstName: "Courtney",
|
|
776
|
+
lastName: "Greenfelder",
|
|
777
|
+
dateOfBirth: "1981-06-22",
|
|
778
|
+
idExpiryDate: "<value>",
|
|
779
|
+
},
|
|
780
|
+
relationships: {
|
|
781
|
+
addresses: {
|
|
782
|
+
data: [
|
|
783
|
+
{
|
|
784
|
+
type: "addresses",
|
|
785
|
+
attributes: {
|
|
786
|
+
id: "12345678901",
|
|
787
|
+
addressType: "residential",
|
|
788
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
789
|
+
city: "Sydney",
|
|
790
|
+
postCode: "2000",
|
|
791
|
+
streetAddress: "42 Wallaby Way",
|
|
792
|
+
addressLine2: "",
|
|
793
|
+
streetNumber: "42",
|
|
794
|
+
streetType: "Way",
|
|
795
|
+
street: "Wallaby",
|
|
796
|
+
state: "NSW",
|
|
797
|
+
country: "Australia",
|
|
798
|
+
status: "current",
|
|
799
|
+
monthsAt: 24,
|
|
800
|
+
yearsAt: 2,
|
|
801
|
+
},
|
|
802
|
+
},
|
|
803
|
+
],
|
|
804
|
+
},
|
|
805
|
+
},
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
type: "customers",
|
|
809
|
+
attributes: {
|
|
810
|
+
title: "Mr",
|
|
811
|
+
firstName: "Courtney",
|
|
812
|
+
lastName: "Greenfelder",
|
|
813
|
+
dateOfBirth: "1981-06-22",
|
|
814
|
+
idExpiryDate: "<value>",
|
|
815
|
+
},
|
|
816
|
+
relationships: {
|
|
817
|
+
addresses: {
|
|
818
|
+
data: [
|
|
819
|
+
{
|
|
820
|
+
type: "addresses",
|
|
821
|
+
attributes: {
|
|
822
|
+
id: "12345678901",
|
|
823
|
+
addressType: "residential",
|
|
824
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
825
|
+
city: "Sydney",
|
|
826
|
+
postCode: "2000",
|
|
827
|
+
streetAddress: "42 Wallaby Way",
|
|
828
|
+
addressLine2: "",
|
|
829
|
+
streetNumber: "42",
|
|
830
|
+
streetType: "Way",
|
|
831
|
+
street: "Wallaby",
|
|
832
|
+
state: "NSW",
|
|
833
|
+
country: "Australia",
|
|
834
|
+
status: "current",
|
|
835
|
+
monthsAt: 24,
|
|
836
|
+
yearsAt: 2,
|
|
837
|
+
},
|
|
838
|
+
},
|
|
839
|
+
],
|
|
840
|
+
},
|
|
841
|
+
},
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
type: "customers",
|
|
845
|
+
attributes: {
|
|
846
|
+
title: "Mr",
|
|
847
|
+
firstName: "Courtney",
|
|
848
|
+
lastName: "Greenfelder",
|
|
849
|
+
dateOfBirth: "1981-06-22",
|
|
850
|
+
idExpiryDate: "<value>",
|
|
851
|
+
},
|
|
852
|
+
relationships: {
|
|
853
|
+
addresses: {
|
|
854
|
+
data: [
|
|
855
|
+
{
|
|
856
|
+
type: "addresses",
|
|
857
|
+
attributes: {
|
|
858
|
+
id: "12345678901",
|
|
859
|
+
addressType: "residential",
|
|
860
|
+
fullAddress: "42 Wallaby Way, Sydney NSW 2000",
|
|
861
|
+
city: "Sydney",
|
|
862
|
+
postCode: "2000",
|
|
863
|
+
streetAddress: "42 Wallaby Way",
|
|
864
|
+
addressLine2: "",
|
|
865
|
+
streetNumber: "42",
|
|
866
|
+
streetType: "Way",
|
|
867
|
+
street: "Wallaby",
|
|
868
|
+
state: "NSW",
|
|
869
|
+
country: "Australia",
|
|
870
|
+
status: "current",
|
|
871
|
+
monthsAt: 24,
|
|
872
|
+
yearsAt: 2,
|
|
873
|
+
},
|
|
874
|
+
},
|
|
875
|
+
],
|
|
876
|
+
},
|
|
877
|
+
},
|
|
878
|
+
},
|
|
879
|
+
],
|
|
509
880
|
},
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
id: "
|
|
881
|
+
asset: {
|
|
882
|
+
data: {
|
|
883
|
+
type: "assets",
|
|
884
|
+
attributes: {
|
|
885
|
+
id: "12345678901",
|
|
886
|
+
ageOfAsset: 3,
|
|
887
|
+
ageOfAssetAtEnd: 8,
|
|
888
|
+
condition: "USED",
|
|
889
|
+
assetType: "CARAVAN",
|
|
890
|
+
assetValue: "35000.00",
|
|
891
|
+
make: "Toyota",
|
|
892
|
+
assetModel: "Camry",
|
|
893
|
+
registrationNumber: "ABC123",
|
|
894
|
+
registrationState: "VIC",
|
|
895
|
+
vin: "1HGCM82633A123456",
|
|
896
|
+
supplierName: "Mr and Mrs Smith",
|
|
897
|
+
supplierABN: "12345678901",
|
|
898
|
+
supplierAddress: "123 Car Street, Melbourne VIC 3000",
|
|
899
|
+
supplierPhone: "0412345678",
|
|
900
|
+
supplierContactName: "John Smith",
|
|
901
|
+
supplierEmail: "john.smith@mrandmrssmith.com.au",
|
|
902
|
+
privateSale: false,
|
|
903
|
+
typeOfSale: "AUTHORISED_SELLER",
|
|
904
|
+
description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
|
|
905
|
+
netAssetValue: "32000.00",
|
|
906
|
+
isLuxury: false,
|
|
907
|
+
additionalFees: "995.00",
|
|
908
|
+
additionalTaxes: "0.00",
|
|
515
909
|
},
|
|
516
910
|
},
|
|
517
911
|
},
|
|
@@ -519,35 +913,13 @@ async function run() {
|
|
|
519
913
|
},
|
|
520
914
|
});
|
|
521
915
|
|
|
522
|
-
// Handle the result
|
|
523
916
|
console.log(result);
|
|
524
|
-
} catch (
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
// Raw value may also be inspected
|
|
531
|
-
console.error(err.rawValue);
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
case (err instanceof SupportingDocumentsCreateResponseBody): {
|
|
535
|
-
// Handle err.data$: SupportingDocumentsCreateResponseBodyData
|
|
536
|
-
console.error(err);
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
case (err instanceof One): {
|
|
540
|
-
// Handle err.data$: OneData
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
case (err instanceof Two): {
|
|
544
|
-
// Handle err.data$: TwoData
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
default: {
|
|
548
|
-
// Other errors such as network errors, see HTTPClientErrors for more details
|
|
549
|
-
throw err;
|
|
550
|
-
}
|
|
917
|
+
} catch (error) {
|
|
918
|
+
if (error instanceof errors.FinanceableError) {
|
|
919
|
+
console.log(error.message);
|
|
920
|
+
console.log(error.statusCode);
|
|
921
|
+
console.log(error.body);
|
|
922
|
+
console.log(error.headers);
|
|
551
923
|
}
|
|
552
924
|
}
|
|
553
925
|
}
|
|
@@ -556,17 +928,26 @@ run();
|
|
|
556
928
|
|
|
557
929
|
```
|
|
558
930
|
|
|
559
|
-
|
|
931
|
+
### Error Classes
|
|
932
|
+
**Primary error:**
|
|
933
|
+
* [`FinanceableError`](./src/models/errors/financeableerror.ts): The base class for HTTP error responses.
|
|
560
934
|
|
|
561
|
-
|
|
935
|
+
<details><summary>Less common errors (6)</summary>
|
|
562
936
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
937
|
+
<br />
|
|
938
|
+
|
|
939
|
+
**Network errors:**
|
|
940
|
+
* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
|
|
941
|
+
* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
|
|
942
|
+
* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
|
|
943
|
+
* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
|
|
944
|
+
* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
**Inherit from [`FinanceableError`](./src/models/errors/financeableerror.ts)**:
|
|
948
|
+
* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
|
|
949
|
+
|
|
950
|
+
</details>
|
|
570
951
|
<!-- End Error Handling [errors] -->
|
|
571
952
|
|
|
572
953
|
<!-- No Server Selection [server] -->
|
|
@@ -176,7 +176,6 @@ async function run() {
|
|
|
176
176
|
},
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
-
// Handle the result
|
|
180
179
|
console.log(result);
|
|
181
180
|
}
|
|
182
181
|
|
|
@@ -352,15 +351,12 @@ async function run() {
|
|
|
352
351
|
},
|
|
353
352
|
},
|
|
354
353
|
});
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
354
|
+
if (res.ok) {
|
|
355
|
+
const { value: result } = res;
|
|
356
|
+
console.log(result);
|
|
357
|
+
} else {
|
|
358
|
+
console.log("applicationsCreate failed:", res.error);
|
|
358
359
|
}
|
|
359
|
-
|
|
360
|
-
const { value: result } = res;
|
|
361
|
-
|
|
362
|
-
// Handle the result
|
|
363
|
-
console.log(result);
|
|
364
360
|
}
|
|
365
361
|
|
|
366
362
|
run();
|
|
@@ -377,12 +373,10 @@ run();
|
|
|
377
373
|
|
|
378
374
|
### Response
|
|
379
375
|
|
|
380
|
-
**Promise\<[operations.
|
|
376
|
+
**Promise\<[operations.CreateApplicationResponse](../../models/operations/createapplicationresponse.md)\>**
|
|
381
377
|
|
|
382
378
|
### Errors
|
|
383
379
|
|
|
384
|
-
| Error Type
|
|
385
|
-
|
|
|
386
|
-
| errors.
|
|
387
|
-
| errors.CreateApplicationApplicationsResponseBody | 404 | application/json |
|
|
388
|
-
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
380
|
+
| Error Type | Status Code | Content Type |
|
|
381
|
+
| --------------- | --------------- | --------------- |
|
|
382
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|