Class CertificateService
- Namespace
- Integrations.Application.Parties
- Assembly
- Integrations.Application.dll
Exemption certificates (customers, sell side) and resale certificates (vendors, buy side).
AvaTax does not decide whether PVC needs a resale certificate; PVC Connect does (from jurisdiction, work type and whether the work is subcontracted) and calls RequestResaleAsync(ResaleCertificateRequest, CancellationToken). The certificate itself is sent from Avalara's certificate manager. This service records the need and watches Avalara until a matching certificate is on file, which feeds the "committed POs without certificates" report.
public sealed class CertificateService
- Inheritance
-
CertificateService
- Inherited Members
Constructors
CertificateService(IAppDbContext, ICertificateProvider, EntityGuard, IEventPublisher, BusinessClock, AdminAuditLog, IOptions<CertificateOptions>, ILogger<CertificateService>)
Exemption certificates (customers, sell side) and resale certificates (vendors, buy side).
AvaTax does not decide whether PVC needs a resale certificate; PVC Connect does (from jurisdiction, work type and whether the work is subcontracted) and calls RequestResaleAsync(ResaleCertificateRequest, CancellationToken). The certificate itself is sent from Avalara's certificate manager. This service records the need and watches Avalara until a matching certificate is on file, which feeds the "committed POs without certificates" report.
public CertificateService(IAppDbContext db, ICertificateProvider provider, EntityGuard guard, IEventPublisher events, BusinessClock clock, AdminAuditLog audit, IOptions<CertificateOptions> options, ILogger<CertificateService> logger)
Parameters
dbIAppDbContextproviderICertificateProviderguardEntityGuardeventsIEventPublisherclockBusinessClockauditAdminAuditLogoptionsIOptions<CertificateOptions>loggerILogger<CertificateService>
Methods
CancelAsync(Guid, CancellationToken)
Cancels an open certificate request.
public Task<CertificateRequestDto> CancelAsync(Guid requestId, CancellationToken ct)
Parameters
requestIdGuidctCancellationToken
Returns
DownloadAsync(string, int, CancellationToken)
The certificate's PDF or image.
public Task<CertificateFile> DownloadAsync(string entityId, int certificateId, CancellationToken ct)
Parameters
entityIdstringcertificateIdintctCancellationToken
Returns
InviteCustomerAsync(string, string, CertificateInviteRequest, CancellationToken)
Emails the customer a CertExpress link to upload an exemption certificate, and records the request.
public Task<CertificateRequestDto> InviteCustomerAsync(string entityId, string customerCode, CertificateInviteRequest request, CancellationToken ct)
Parameters
entityIdstringcustomerCodestringrequestCertificateInviteRequestctCancellationToken
Returns
ListAsync(string, PartyType, string, CancellationToken)
Certificates on file at the provider for a customer or vendor.
public Task<IReadOnlyList<CertificateDto>> ListAsync(string entityId, PartyType type, string code, CancellationToken ct)
Parameters
entityIdstringtypePartyTypecodestringctCancellationToken
Returns
OutstandingResaleAsync(string, CancellationToken)
Outstanding resale certificate requests (the "committed POs without certificates" report).
public Task<IReadOnlyList<CertificateRequestDto>> OutstandingResaleAsync(string entityId, CancellationToken ct)
Parameters
entityIdstringctCancellationToken
Returns
RequestResaleAsync(ResaleCertificateRequest, CancellationToken)
Records that the vendor needs PVC's resale certificate for this PO/region. Idempotent per vendor + PO + region.
public Task<(CertificateRequestDto Request, bool Created)> RequestResaleAsync(ResaleCertificateRequest request, CancellationToken ct)
Parameters
requestResaleCertificateRequestctCancellationToken
Returns
WatchAsync(CancellationToken)
Job: re-checks outstanding resale requests and announces expiring customer certificates.
public Task WatchAsync(CancellationToken ct)