diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/declaration.d.ts')
-rw-r--r-- | packages/merchant-backoffice-ui/src/declaration.d.ts | 420 |
1 files changed, 248 insertions, 172 deletions
diff --git a/packages/merchant-backoffice-ui/src/declaration.d.ts b/packages/merchant-backoffice-ui/src/declaration.d.ts index db3122266..5ca9c1e09 100644 --- a/packages/merchant-backoffice-ui/src/declaration.d.ts +++ b/packages/merchant-backoffice-ui/src/declaration.d.ts @@ -25,6 +25,8 @@ type EddsaSignature = string; type WireTransferIdentifierRawP = string; type RelativeTime = Duration; type ImageDataUrl = string; +type MerchantUserType = "business" | "individual"; + export interface WithId { id: string; @@ -312,46 +314,8 @@ export namespace MerchantBackend { // header. token?: string; } - type FacadeCredentials = NoFacadeCredentials | BasicAuthFacadeCredentials; - - interface NoFacadeCredentials { - type: "none"; - } - - interface BasicAuthFacadeCredentials { - type: "basic"; - - // Username to use to authenticate - username: string; - - // Password to use to authenticate - password: string; - } - - interface MerchantBankAccount { - // The payto:// URI where the wallet will send coins. - payto_uri: string; - - // Optional base URL for a facade where the - // merchant backend can see incoming wire - // transfers to reconcile its accounting - // with that of the exchange. Used by - // taler-merchant-wirewatch. - credit_facade_url?: string; - - // Credentials for accessing the credit facade. - credit_facade_credentials?: FacadeCredentials; - } //POST /private/instances interface InstanceConfigurationMessage { - // Bank accounts of the merchant. A merchant may have - // multiple accounts, thus this is an array. Note that by - // removing accounts from this list the respective account is set to - // inactive and thus unavailable for new contracts, but preserved - // in the database as existing offers and contracts may still refer - // to it. - accounts: MerchantBankAccount[]; - // Name of the merchant instance to create (will become $INSTANCE). id: string; @@ -361,12 +325,16 @@ export namespace MerchantBackend { // Type of the user (business or individual). // Defaults to 'business'. Should become mandatory field // in the future, left as optional for API compatibility for now. - user_type?: string; + user_type?: MerchantUserType; + + // Merchant email for customer contact. + email?: string; + + // Merchant public website. + website?: string; - email: string; - website: string; - // An optional base64-encoded logo image - logo: ImageDataUrl; + // Merchant logo. + logo?: ImageDataUrl; // "Authentication" header required to authorize management access the instance. // Optional, if not given authentication will be disabled for @@ -381,17 +349,10 @@ export namespace MerchantBackend { // (to be put into contracts). jurisdiction: Location; - // Maximum wire fee this instance is willing to pay. - // Can be overridden by the frontend on a per-order basis. - default_max_wire_fee: Amount; - - // Default factor for wire fee amortization calculations. - // Can be overridden by the frontend on a per-order basis. - default_wire_fee_amortization: Integer; - - // Maximum deposit fee (sum over all coins) this instance is willing to pay. - // Can be overridden by the frontend on a per-order basis. - default_max_deposit_fee: Amount; + // Use STEFAN curves to determine default fees? + // If false, no fees are allowed by default. + // Can always be overridden by the frontend on a per-order basis. + use_stefan: boolean; // If the frontend does NOT specify an execution date, how long should // we tell the exchange to wait to aggregate transactions before @@ -406,11 +367,6 @@ export namespace MerchantBackend { // PATCH /private/instances/$INSTANCE interface InstanceReconfigurationMessage { - // Bank accounts of the merchant. A merchant may have - // multiple accounts, thus this is an array. Note that removing - // URIs from this list deactivates the specified accounts - // (they will no longer be used for future contracts). - accounts: MerchantBankAccount[]; // Merchant name corresponding to this instance. name: string; @@ -418,7 +374,16 @@ export namespace MerchantBackend { // Type of the user (business or individual). // Defaults to 'business'. Should become mandatory field // in the future, left as optional for API compatibility for now. - user_type?: string; + user_type?: MerchantUserType; + + // Merchant email for customer contact. + email?: string; + + // Merchant public website. + website?: string; + + // Merchant logo. + logo?: ImageDataUrl; // The merchant's physical address (to be put into contracts). address: Location; @@ -427,17 +392,10 @@ export namespace MerchantBackend { // (to be put into contracts). jurisdiction: Location; - // Maximum wire fee this instance is willing to pay. - // Can be overridden by the frontend on a per-order basis. - default_max_wire_fee: Amount; - - // Default factor for wire fee amortization calculations. - // Can be overridden by the frontend on a per-order basis. - default_wire_fee_amortization: Integer; - - // Maximum deposit fee (sum over all coins) this instance is willing to pay. - // Can be overridden by the frontend on a per-order basis. - default_max_deposit_fee: Amount; + // Use STEFAN curves to determine default fees? + // If false, no fees are allowed by default. + // Can always be overridden by the frontend on a per-order basis. + use_stefan: boolean; // If the frontend does NOT specify an execution date, how long should // we tell the exchange to wait to aggregate transactions before @@ -460,7 +418,14 @@ export namespace MerchantBackend { // Merchant name corresponding to this instance. name: string; - deleted?: boolean; + // Type of the user ("business" or "individual"). + user_type: MerchantUserType; + + // Merchant public website. + website?: string; + + // Merchant logo. + logo?: ImageDataUrl; // Merchant instance this response is about ($INSTANCE) id: string; @@ -472,8 +437,63 @@ export namespace MerchantBackend { // specify the desired payment target in /order requests. Note that // front-ends do not have to support wallets selecting payment targets. payment_targets: string[]; + + // Has this instance been deleted (but not purged)? + deleted: boolean; } + //GET /private/instances/$INSTANCE + interface QueryInstancesResponse { + + // Merchant name corresponding to this instance. + name: string; + // Type of the user ("business" or "individual"). + user_type: MerchantUserType; + + // Merchant email for customer contact. + email?: string; + + // Merchant public website. + website?: string; + + // Merchant logo. + logo?: ImageDataUrl; + + // Public key of the merchant/instance, in Crockford Base32 encoding. + merchant_pub: EddsaPublicKey; + + // The merchant's physical address (to be put into contracts). + address: Location; + + // The jurisdiction under which the merchant conducts its business + // (to be put into contracts). + jurisdiction: Location; + + // Use STEFAN curves to determine default fees? + // If false, no fees are allowed by default. + // Can always be overridden by the frontend on a per-order basis. + use_stefan: boolean; + + // If the frontend does NOT specify an execution date, how long should + // we tell the exchange to wait to aggregate transactions before + // executing the wire transfer? This delay is added to the current + // time when we generate the advisory execution time for the exchange. + default_wire_transfer_delay: RelativeTime; + + // If the frontend does NOT specify a payment deadline, how long should + // offers we make be valid by default? + default_pay_delay: RelativeTime; + + // Authentication configuration. + // Does not contain the token when token auth is configured. + auth: { + method: "external" | "token"; + }; + } + // DELETE /private/instances/$INSTANCE + } + + namespace KYC { //GET /private/instances/$INSTANCE/kyc interface AccountKycRedirects { // Array of pending KYCs. @@ -513,56 +533,76 @@ export namespace MerchantBackend { exchange_http_status: number; } - //GET /private/instances/$INSTANCE - interface QueryInstancesResponse { - // The URI where the wallet will send coins. A merchant may have - // multiple accounts, thus this is an array. - accounts: MerchantAccount[]; + } - // Merchant name corresponding to this instance. - name: string; + namespace BankAccounts { - // Public key of the merchant/instance, in Crockford Base32 encoding. - merchant_pub: EddsaPublicKey; + interface AccountAddDetails { - // The merchant's physical address (to be put into contracts). - address: Location; + // payto:// URI of the account. + payto_uri: string; - // The jurisdiction under which the merchant conducts its business - // (to be put into contracts). - jurisdiction: Location; + // URL from where the merchant can download information + // about incoming wire transfers to this account. + credit_facade_url?: string; - // Maximum wire fee this instance is willing to pay. - // Can be overridden by the frontend on a per-order basis. - default_max_wire_fee: Amount; + // Credentials to use when accessing the credit facade. + // Never returned on a GET (as this may be somewhat + // sensitive data). Can be set in POST + // or PATCH requests to update (or delete) credentials. + // To really delete credentials, set them to the type: "none". + credit_facade_credentials?: FacadeCredentials; - // Default factor for wire fee amortization calculations. - // Can be overridden by the frontend on a per-order basis. - default_wire_fee_amortization: Integer; + } - // Maximum deposit fee (sum over all coins) this instance is willing to pay. - // Can be overridden by the frontend on a per-order basis. - default_max_deposit_fee: Amount; + type FacadeCredentials = + | NoFacadeCredentials + | BasicAuthFacadeCredentials; - // If the frontend does NOT specify an execution date, how long should - // we tell the exchange to wait to aggregate transactions before - // executing the wire transfer? This delay is added to the current - // time when we generate the advisory execution time for the exchange. - default_wire_transfer_delay: RelativeTime; + interface NoFacadeCredentials { + type: "none"; + } - // If the frontend does NOT specify a payment deadline, how long should - // offers we make be valid by default? - default_pay_delay: RelativeTime; + interface BasicAuthFacadeCredentials { + type: "basic"; - // Authentication configuration. - // Does not contain the token when token auth is configured. - auth: { - method: "external" | "token"; - token?: string; - }; + // Username to use to authenticate + username: string; + + // Password to use to authenticate + password: string; + } + + interface AccountAddResponse { + // Hash over the wire details (including over the salt). + h_wire: HashCode; + + // Salt used to compute h_wire. + salt: HashCode; + } + + interface AccountPatchDetails { + + // URL from where the merchant can download information + // about incoming wire transfers to this account. + credit_facade_url?: string; + + // Credentials to use when accessing the credit facade. + // Never returned on a GET (as this may be somewhat + // sensitive data). Can be set in POST + // or PATCH requests to update (or delete) credentials. + // To really delete credentials, set them to the type: "none". + credit_facade_credentials?: FacadeCredentials; } - interface MerchantAccount { + + interface AccountsSummaryResponse { + + // List of accounts that are known for the instance. + accounts: BankAccountEntry[]; + } + + interface BankAccountEntry { // payto:// URI of the account. payto_uri: string; @@ -587,7 +627,6 @@ export namespace MerchantBackend { active: boolean; } - // DELETE /private/instances/$INSTANCE } namespace Products { @@ -957,6 +996,10 @@ export namespace MerchantBackend { // high entropy to prevent adversarial claims (like it is // if the backend auto-generates one). Default is 'true'. create_token?: boolean; + + // OTP device ID to associate with the order. + // This parameter is optional. + otp_id?: string; } type Order = MinimalOrderDetail | ContractTerms; @@ -1031,9 +1074,9 @@ export namespace MerchantBackend { } } - namespace Tips { + namespace Rewards { // GET /private/reserves - interface TippingReserveStatus { + interface RewardReserveStatus { // Array of all known reserves (possibly empty!) reserves: ReserveStatusEntry[]; } @@ -1057,7 +1100,7 @@ export namespace MerchantBackend { // Amount picked up so far. pickup_amount: Amount; - // Amount approved for tips that exceeds the pickup_amount. + // Amount approved for rewards that exceeds the pickup_amount. committed_amount: Amount; // Is this reserve active (false if it was deleted but not purged) @@ -1068,7 +1111,7 @@ export namespace MerchantBackend { // Amount that the merchant promises to put into the reserve initial_balance: Amount; - // Exchange the merchant intends to use for tipping + // Exchange the merchant intends to use for reward exchange_url: string; // Desired wire method, for example "iban" or "x-taler-bank" @@ -1081,30 +1124,30 @@ export namespace MerchantBackend { // Wire accounts of the exchange where to transfer the funds. accounts: WireAccount[]; } - interface TipCreateRequest { - // Amount that the customer should be tipped + interface RewardCreateRequest { + // Amount that the customer should be reward amount: Amount; - // Justification for giving the tip + // Justification for giving the reward justification: string; - // URL that the user should be directed to after tipping, - // will be included in the tip_token. + // URL that the user should be directed to after rewarding, + // will be included in the reward_token. next_url: string; } - interface TipCreateConfirmation { - // Unique tip identifier for the tip that was created. - tip_id: HashCode; + interface RewardCreateConfirmation { + // Unique reward identifier for the reward that was created. + reward_id: HashCode; - // taler://tip URI for the tip - taler_tip_uri: string; + // taler://reward URI for the reward + taler_reward_uri: string; // URL that will directly trigger processing - // the tip when the browser is redirected to it - tip_status_url: string; + // the reward when the browser is redirected to it + reward_status_url: string; - // when does the tip expire - tip_expiration: Timestamp; + // when does the reward expire + reward_expiration: Timestamp; } interface ReserveDetail { @@ -1124,12 +1167,12 @@ export namespace MerchantBackend { // Amount picked up so far. pickup_amount: Amount; - // Amount approved for tips that exceeds the pickup_amount. + // Amount approved for rewards that exceeds the pickup_amount. committed_amount: Amount; - // Array of all tips created by this reserves (possibly empty!). + // Array of all rewards created by this reserves (possibly empty!). // Only present if asked for explicitly. - tips?: TipStatusEntry[]; + rewards?: RewardStatusEntry[]; // Is this reserve active (false if it was deleted but not purged)? active: boolean; @@ -1144,31 +1187,31 @@ export namespace MerchantBackend { exchange_url: string; } - interface TipStatusEntry { - // Unique identifier for the tip. - tip_id: HashCode; + interface RewardStatusEntry { + // Unique identifier for the reward. + reward_id: HashCode; - // Total amount of the tip that can be withdrawn. + // Total amount of the reward that can be withdrawn. total_amount: Amount; - // Human-readable reason for why the tip was granted. + // Human-readable reason for why the reward was granted. reason: string; } - interface TipDetails { - // Amount that we authorized for this tip. + interface RewardDetails { + // Amount that we authorized for this reward. total_authorized: Amount; // Amount that was picked up by the user already. total_picked_up: Amount; - // Human-readable reason given when authorizing the tip. + // Human-readable reason given when authorizing the reward. reason: string; - // Timestamp indicating when the tip is set to expire (may be in the past). + // Timestamp indicating when the reward is set to expire (may be in the past). expiration: Timestamp; - // Reserve public key from which the tip is funded. + // Reserve public key from which the reward is funded. reserve_pub: EddsaPublicKey; // Array showing the pickup operations of the wallet (possibly empty!). @@ -1239,6 +1282,63 @@ export namespace MerchantBackend { } } + namespace OTP { + interface OtpDeviceAddDetails { + // Device ID to use. + otp_device_id: string; + + // Human-readable description for the device. + otp_description: string; + + // A base64-encoded key + otp_key: string; + + // Algorithm for computing the POS confirmation. + otp_algorithm: Integer; + + // Counter for counter-based OTP devices. + otp_ctr?: Integer; + } + + interface OtpDevicePatchDetails { + // Human-readable description for the device. + otp_description: string; + + // A base64-encoded key + otp_key: string | undefined; + + // Algorithm for computing the POS confirmation. + otp_algorithm: Integer; + + // Counter for counter-based OTP devices. + otp_ctr?: Integer; + } + + interface OtpDeviceSummaryResponse { + // Array of devices that are present in our backend. + otp_devices: OtpDeviceEntry[]; + } + interface OtpDeviceEntry { + // Device identifier. + otp_device_id: string; + + // Human-readable description for the device. + device_description: string; + } + + interface OtpDeviceDetails { + // Human-readable description for the device. + device_description: string; + + // Algorithm for computing the POS confirmation. + otp_algorithm: Integer; + + // Counter for counter-based OTP devices. + otp_ctr?: Integer; + } + + + } namespace Template { interface TemplateAddDetails { // Template ID to use. @@ -1247,12 +1347,9 @@ export namespace MerchantBackend { // Human-readable description for the template. template_description: string; - // A base64-encoded key of the point-of-sale. + // OTP device ID. // This parameter is optional. - pos_key?: string; - - // Algorithm for computing the POS confirmation, 0 for none. - pos_algorithm?: number; + otp_id?: string; // Additional information in a separate template. template_contract: TemplateContractDetails; @@ -1276,12 +1373,9 @@ export namespace MerchantBackend { // Human-readable description for the template. template_description: string; - // A base64-encoded key of the point-of-sale. + // OTP device ID. // This parameter is optional. - pos_key?: string; - - // Algorithm for computing the POS confirmation, 0 for none. - pos_algorithm?: Integer; + otp_id?: string; // Additional information in a separate template. template_contract: TemplateContractDetails; @@ -1304,12 +1398,9 @@ export namespace MerchantBackend { // Human-readable description for the template. template_description: string; - // A base64-encoded key of the point-of-sale. + // OTP device ID. // This parameter is optional. - pos_key?: string; - - // Algorithm for computing the POS confirmation, 0 for none. - pos_algorithm?: Integer; + otp_id?: string; // Additional information in a separate template. template_contract: TemplateContractDetails; @@ -1424,21 +1515,6 @@ export namespace MerchantBackend { // Maximum total deposit fee accepted by the merchant for this contract max_fee: Amount; - // Maximum wire fee accepted by the merchant (customer share to be - // divided by the 'wire_fee_amortization' factor, and further reduced - // if deposit fees are below 'max_fee'). Default if missing is zero. - max_wire_fee: Amount; - - // Over how many customer transactions does the merchant expect to - // amortize wire fees on average? If the exchange's wire fee is - // above 'max_wire_fee', the difference is divided by this number - // to compute the expected customer's contribution to the wire fee. - // The customer's contribution may further be reduced by the difference - // between the 'max_fee' and the sum of the actual deposit fees. - // Optional, default value if missing is 1. 0 and negative values are - // invalid and also interpreted as 1. - wire_fee_amortization: number; - // List of products that are part of the purchase (see Product). products: Product[]; |