list-discounts.rst (2154B)
1 .. ts:op:: listDiscounts 2 :read-only: 3 4 List discount tokens stored in the wallet. Listed tokens are grouped 5 by token family. Only tokens that are within their validity period 6 and not currently in use by a transaction are listed. 7 8 **Request:** 9 10 The request arguments must be a `ListDiscountsRequest` object. 11 Omitted filter fields do not restrict the result. 12 13 **Response:** 14 15 On success, the result is a `ListDiscountsResponse` object. 16 17 .. ts:def:: ListDiscountsRequest 18 19 interface ListDiscountsRequest { 20 // Filter by hash of token issue public key. 21 tokenIssuePubHash?: string; 22 23 // Filter by merchant base URL. 24 merchantBaseUrl?: string; 25 } 26 27 .. ts:def:: ListDiscountsResponse 28 29 interface ListDiscountsResponse { 30 discounts: DiscountListDetail[]; 31 } 32 33 .. ts:def:: DiscountListDetail 34 35 interface DiscountListDetail { 36 // Hash of token family info. 37 tokenFamilyHash: string; 38 39 // Hash of token issue public key. 40 tokenIssuePubHash: string; 41 42 // URL of the merchant issuing the token. 43 merchantBaseUrl: string; 44 45 // Information about the merchant issuing the token. 46 merchantInfo?: MerchantInfo; 47 48 // Human-readable name for the token family. 49 name: string; 50 51 // Human-readable description for the token family. 52 description: string; 53 54 // Optional map from IETF BCP 47 language tags to localized descriptions. 55 descriptionI18n: any | undefined; 56 57 // Start time of the token's validity period. 58 validityStart: Timestamp; 59 60 // End time of the token's validity period. 61 validityEnd: Timestamp; 62 63 // Number of tokens available to use. 64 tokensAvailable: number; 65 } 66 67 .. ts:def:: MerchantInfo 68 69 interface MerchantInfo { 70 // The merchant's legal name of business. 71 name: string; 72 73 // Contact email address of the merchant. 74 email?: string; 75 76 // Website of the merchant. 77 website?: string; 78 79 // An optional base64-encoded product image. 80 logo?: ImageDataUrl; 81 82 // Business address of the merchant. 83 address?: Location; 84 85 // Jurisdiction for disputes; some typical location fields may be absent. 86 jurisdiction?: Location; 87 }