Table of Contents

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

db IAppDbContext
provider ICertificateProvider
guard EntityGuard
events IEventPublisher
clock BusinessClock
audit AdminAuditLog
options IOptions<CertificateOptions>
logger ILogger<CertificateService>

Methods

CancelAsync(Guid, CancellationToken)

Cancels an open certificate request.

public Task<CertificateRequestDto> CancelAsync(Guid requestId, CancellationToken ct)

Parameters

requestId Guid
ct CancellationToken

Returns

Task<CertificateRequestDto>

DownloadAsync(string, int, CancellationToken)

The certificate's PDF or image.

public Task<CertificateFile> DownloadAsync(string entityId, int certificateId, CancellationToken ct)

Parameters

entityId string
certificateId int
ct CancellationToken

Returns

Task<CertificateFile>

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

entityId string
customerCode string
request CertificateInviteRequest
ct CancellationToken

Returns

Task<CertificateRequestDto>

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

entityId string
type PartyType
code string
ct CancellationToken

Returns

Task<IReadOnlyList<CertificateDto>>

OutstandingResaleAsync(string, CancellationToken)

Outstanding resale certificate requests (the "committed POs without certificates" report).

public Task<IReadOnlyList<CertificateRequestDto>> OutstandingResaleAsync(string entityId, CancellationToken ct)

Parameters

entityId string
ct CancellationToken

Returns

Task<IReadOnlyList<CertificateRequestDto>>

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

request ResaleCertificateRequest
ct CancellationToken

Returns

Task<(CertificateRequestDto Request, bool Created)>

WatchAsync(CancellationToken)

Job: re-checks outstanding resale requests and announces expiring customer certificates.

public Task WatchAsync(CancellationToken ct)

Parameters

ct CancellationToken

Returns

Task