Skip to content

Commit 2213b5f

Browse files
Update logic of case 1 and case 2
1 parent d73f2ee commit 2213b5f

File tree

11 files changed

+194
-84
lines changed

11 files changed

+194
-84
lines changed

DocuSign.Workspaces/DocuSign.Workspaces/ClientApp/src/components/RequestFormPhysician.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export const RequestFormPhysician = ({
337337
disabled={
338338
requesting ||
339339
!selectedPhysician ||
340-
!uploadedFiles.some((f) => f.isForSignature) ||
340+
uploadedFiles.length === 0 ||
341341
!request.email ||
342342
errors.email
343343
}

DocuSign.Workspaces/DocuSign.Workspaces/ClientApp/src/components/SelectDocuments.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,34 @@ const listToSign = [
99
id: 21,
1010
name: 'Engagement Agreement.pdf',
1111
path: '/Engagement Agreement placeholder.pdf',
12+
isForSignature: true,
1213
},
1314
{
1415
id: 22,
1516
name: 'IRA Products Agreement.pdf',
1617
path: '/IRA Products Agreement.pdf',
18+
isForSignature: true,
1719
},
1820
{
1921
id: 23,
2022
name: 'ETF Products Agreement.pdf',
2123
path: '/ETF PRODUCTS AGREEMENT.pdf',
24+
isForSignature: true,
2225
},
2326
];
2427
const uploadRequest = [
25-
{ id: 11, name: 'Pay Stub.pdf', path: '/Tax Return.pdf' },
26-
{ id: 12, name: 'Tax Return.pdf', path: '/Pay Statement.pdf' },
28+
{
29+
id: 11,
30+
name: 'Pay Stub.pdf',
31+
path: '/Tax Return.pdf',
32+
isForSignature: false
33+
},
34+
{
35+
id: 12,
36+
name: 'Tax Return.pdf',
37+
path: '/Pay Statement.pdf',
38+
isForSignature: false
39+
},
2740
];
2841

2942
export const SelectDocuments = ({ onAddDocuments, requesting = false, onPrevious }) => {

DocuSign.Workspaces/DocuSign.Workspaces/ClientApp/src/pages/UseCaseOne/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export const UseCaseOnePage = () => {
7979
body: JSON.stringify(payload),
8080
});
8181
if (!res.ok) {
82-
toast.error(`${t('Common.ServerError')}${res.status}`);
83-
throw new Error(`${t('Common.ServerError')}${res.status}`);
82+
const message = await res.text();
83+
throw new Error(message || `${t('Common.ServerError')}${res.status}`);
8484
}
8585
const workspaceId = await res.text();
8686

DocuSign.Workspaces/DocuSign.Workspaces/ClientApp/src/pages/UseCaseTwo/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export const UseCaseTwoPage = () => {
6363
});
6464

6565
if (!res.ok) {
66-
throw new Error(`${t('Common.ServerError')}${res.status}`);
66+
const message = await res.text();
67+
throw new Error(message || `${t('Common.ServerError')}${res.status}`);
6768
}
6869
const physician = await res.json();
6970
setListPhysician(physician);

DocuSign.Workspaces/DocuSign.Workspaces/Controllers/CarePlans/CarePlansController.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,28 @@ public class CarePlansController(ICarePlansService carePlansService) : Controlle
1313
{
1414
[HttpGet]
1515
[Route("/api/care-plans/physicians")]
16-
public async Task<List<PhysicianModel>> GetPhysicians()
16+
public async Task<IActionResult> GetPhysicians()
1717
{
18-
var physicians = await carePlansService.GetPhysician();
19-
return physicians;
18+
try
19+
{
20+
var physicians = await carePlansService.GetPhysician();
21+
return Ok(physicians);
22+
}
23+
catch (ApplicationApiException ex)
24+
{
25+
var message = ex.Details?.ErrorDescription ?? ex.Details?.Error ?? ex.Message;
26+
return BadRequest(message);
27+
}
28+
catch (Docusign.IAM.SDK.Models.Errors.ErrorDetails e)
29+
{
30+
return e.StatusCode == 401 ?
31+
BadRequest("Please check that the default account has access to the workspaces.") :
32+
BadRequest(e.Message);
33+
}
34+
catch (Exception e)
35+
{
36+
return BadRequest(e.Message);
37+
}
2038
}
2139

2240
[HttpPost]
Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Threading.Tasks;
34
using DocuSign.Workspaces.Domain.Workspaces;
45
using DocuSign.Workspaces.Domain.Workspaces.Models;
6+
using DocuSign.Workspaces.Infrastructure.Exceptions;
57
using Microsoft.AspNetCore.Mvc;
68

79
namespace DocuSign.Workspaces.Controllers.WealthManagement;
@@ -10,17 +12,51 @@ public class WealthManagementClientController(IWealthManagementClient wealthMana
1012
{
1113
[HttpPost]
1214
[Route("/api/workspaces/create")]
13-
public async Task<string> CreateWorkspaces([FromBody] CreateWorkspacesModel workspacesModel)
15+
public async Task<IActionResult> CreateWorkspaces([FromBody] CreateWorkspacesModel workspacesModel)
1416
{
15-
var workspaceId = await wealthManagementClient.CreateWorkspaces(workspacesModel);
16-
return workspaceId;
17+
try
18+
{
19+
var workspaceId = await wealthManagementClient.CreateWorkspaces(workspacesModel);
20+
return Ok(workspaceId);
21+
}
22+
catch (ApplicationApiException ex)
23+
{
24+
var message = ex.Details?.ErrorDescription ?? ex.Details?.Error ?? ex.Message;
25+
return BadRequest(message);
26+
}
27+
catch (Docusign.IAM.SDK.Models.Errors.ErrorDetails e)
28+
{
29+
return e.StatusCode == 401 ?
30+
BadRequest("Please check that the default account has access to the workspaces.") :
31+
BadRequest(e.Message);
32+
}
33+
catch (Exception e)
34+
{
35+
return BadRequest(e.Message);
36+
}
1737
}
1838

1939
[HttpPost]
2040
[Route("/api/workspaces/add-selected-documents")]
21-
public async Task<List<EnvelopeModel>> AddSelectedDocuments([FromBody] WorkspaceAddDocumentsModel model)
41+
public async Task<IActionResult> AddSelectedDocuments([FromBody] HandleDocumentsModel model)
2242
{
23-
var envelopes = await wealthManagementClient.AddSelectedDocumentsForClientPackage(model);
24-
return envelopes;
43+
try
44+
{
45+
var envelopes = await wealthManagementClient.HandleDocuments(model);
46+
return Ok(envelopes);
47+
}
48+
catch (ApplicationApiException ex)
49+
{
50+
var message = ex.Details?.ErrorDescription ?? ex.Details?.Error ?? ex.Message;
51+
return BadRequest(message);
52+
}
53+
catch (Docusign.IAM.SDK.Models.Errors.ErrorDetails e)
54+
{
55+
return BadRequest(e.Message);
56+
}
57+
catch (Exception e)
58+
{
59+
return BadRequest(e.Message);
60+
}
2561
}
2662
}

DocuSign.Workspaces/DocuSign.Workspaces/Domain/Workspaces/IWealthManagementClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ public interface IWealthManagementClient
88
{
99
Task<string> CreateWorkspaces(CreateWorkspacesModel createWorkspacesModel);
1010

11-
Task<List<EnvelopeModel>> AddSelectedDocumentsForClientPackage(WorkspaceAddDocumentsModel createModel);
11+
Task<List<ResponseWealthManagementModel>> HandleDocuments(HandleDocumentsModel createModel);
1212
}

DocuSign.Workspaces/DocuSign.Workspaces/Domain/Workspaces/Models/EnvelopeModel.cs

Lines changed: 0 additions & 3 deletions
This file was deleted.

DocuSign.Workspaces/DocuSign.Workspaces/Domain/Workspaces/Models/WorkspaceAddDocumentsModel.cs renamed to DocuSign.Workspaces/DocuSign.Workspaces/Domain/Workspaces/Models/HandleDocumentsModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace DocuSign.Workspaces.Domain.Workspaces.Models;
44

5-
public class WorkspaceAddDocumentsModel
5+
public class HandleDocumentsModel
66
{
77
public string WorkspaceId { get; set; }
88
public List<Document> Documents { get; set; }
@@ -18,4 +18,5 @@ public class Document
1818
{
1919
public string Base64String { get; set; }
2020
public string Name { get; set; }
21+
public bool IsForSignature { get; set; }
2122
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace DocuSign.Workspaces.Domain.Workspaces.Models;
2+
3+
public record ResponseWealthManagementModel(string Name, string Status);

0 commit comments

Comments
 (0)