tlolkus | Posts: 20

Receiving Extra Attachment Reject Emails when rejecting attachments using the .Net API

0 votes

We have integrated with OneSpan using your .Net SDK (version 11.12.0.0 ).  We have built out logic to reject attachments but we have come across a scenario where if a sender has multiple attachments that are rejected, when we reject those attachments using the AttachmentRequirementService.RejectAttachment call, the recipient is receiving a rejection notification twice for the second attachment. 

Here is our scenario:

1) Create a Package where a Recipient has 3 attachments

2) The packages is signed and all 3 attachments are provided

3) The sender rejects 2 attachments and clicks a Save and Notify Button in our application

In our code we make a call to AttachmentRequirementService.RejectAttachment for each attachment.  What we see is that when we call this for Attachment 1, the reject notification email goes out for attachment 1.  When we then call that same service for the second attachment, OneSpan is sending out 2 emails.  An email for Attachment 1 and 2.  As a result the recipient gets 3 emails.  They get 2 emails for attachment 1.  Let me know if we are doing something incorrectly or if that is potentially an issue with the SDK call.  

I have attached a snippet of our code if that is helpful.

 

 


Attachments
Duo_Liang | Posts: 3776

Reply to: Receiving Extra Attachment Reject Emails when rejecting attachments using the .Net API

0 votes

Hi Tricia,

 

Does it happen every time when you came across this scenario or just very occasionally? I used the same workflow with the same version of .NET SDK, but not yet successfully reproduced the issue. However, codewise, I do have some suggestions if you are rejection multiple attachment.

If you look at the source code behind function RejectAttachment (link here)

public void RejectAttachment(PackageId packageId, Signer signer, String attachmentName, String senderComment)

{

            signer.GetAttachmentRequirement(attachmentName).SenderComment = senderComment;

            signer.GetAttachmentRequirement(attachmentName).Status = RequirementStatus.REJECTED;

            packageService.UpdateSigner(packageId, signer);

}

It sends out a sender update API every time when you invoke this function. Therefore in order to save outbound API calls, instead of calling .RejectAttachment() function repeatly:

            eslClient.AttachmentRequirementService.RejectAttachment(packageId, signer, "attachment1", "reject attachment1");
            eslClient.AttachmentRequirementService.RejectAttachment(packageId, signer, "attachment2", "reject attachment2");

You can use this code instead:

            signer.GetAttachmentRequirement("attachment1").SenderComment = "reject attachment1";
            signer.GetAttachmentRequirement("attachment1").Status = RequirementStatus.REJECTED;

            signer.GetAttachmentRequirement("attachment2").SenderComment = "reject attachment2";
            signer.GetAttachmentRequirement("attachment2").Status = RequirementStatus.REJECTED;
            eslClient.PackageService.UpdateSigner(packageId, signer);

 

Still, I can't be sure it's related to your issue, but worth a try from my opinion.

 

Duo


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off