Class for CartMandate with specific functionality Uses JWT for merchant_authorization as per AP2 specification
new
CartMandateClass(data: CartMandate,options?: { id?: string; createdAt?: Date; status?: MandateStatus; signature?: string; merchantAuthorization?: string; },)
private
optional
_merchantAuthorization: string
private
serializer: CartMandateSerializer
private
validator: CartMandateValidator
getMerchantAuthorization(): string | undefined
Get merchant authorization JWT token
isSigned(): boolean
Check if mandate is signed (overrides base class for JWT support)
sign(): Promise<void>
Sign mandate using JWT with merchant authorization Creates a JWT with cart hash for integrity verification
toString(): string
protected
validate(): Promise<void>
verify(publicKey: string,keyConfig?: Partial<JWTKeyConfig>,expectedMerchantId?: string,expectedAudience?: string,): Promise<boolean>
Verify mandate signature using JWT
createNew(data: CartMandate,options?: { id?: string; createdAt?: Date; status?: MandateStatus; signature?: string; merchantAuthorization?: string; },signingOptions?: { privateKey: string; algorithm: JWTAlgorithm; merchantId: string; },): Promise<CartMandateClass>
Create a new CartMandate
fromSigned(signedMandate: CartMandate & { merchant_authorization?: string; },publicKey?: string,validateSignature?: boolean,keyConfig?: Partial<JWTKeyConfig>,expectedMerchantId?: string,expectedAudience?: string,): Promise<CartMandateClass>
Create from existing signed mandate