UNPKG

@marceloclp/monzojs

Version:

Unofficial wrapper for the Monzo API written in TypeScript.

104 lines (103 loc) 3.64 kB
/** * Receipts are line-item purchase data added to a transaction. They contain all * the information about the purchase, including the products you bought, any * taxes that were added on, and how you paid. They can also contain extra * details about the merchant you spent money at, such as how to contact them, * but this may not appear in the app yet. */ export declare type Receipt = { /** A unique identifier generated by Monzo when you submit the receipt. */ id: string; /** * A unique identifier generated by you, which is used as an idempotency key. * You might use an order number for example. */ external_id: string; /** The ID of the Transaction to associate the Receipt with. */ transaction_id: string; /** * The amount of the transaction in minor units of currency. For example * pennies in the case of GBP. The amount should be positive. */ total: number; /** Usually 'GBP', for Pounds Sterling. */ currency: string; /** A list of Items detailing the products included in the total. */ items: Item[]; /** A list of Taxes (e.g. VAT) added onto the total. */ taxes: Tax[]; /** A list of Payments, indicating how the customer paid the total. */ payments: Payment[]; /** The Merchant you shopped at. */ merchant: Merchant; }; /** * Items detail each product that was included in the transaction. They let you * see more detailed data in your Monzo feed than just how much you spent! * * Items can be made up of sub-items, for example an extra topping on a burger. * Sub-items have the same format as items (but they cannot in turn have their * own sub-items!). The amounts of the sub-items should add up to amount on the * item. * * All of the items together, plus the taxes, should add up to the receipt * total. */ export declare type Item = { /** The item bought. */ description: string; /** * The amount paid for the item, in pennies. If there are sub-items, this * should be the total of their amounts. */ amount: number; currency: string; /** * An integer indicating how many of the product were bought, e.g. 2. * Or a floating-point number, so it can represent weights like 1.23. */ quantity: number; /** The unit the quantity is measured in, e.g. 'kg' */ unit: string; /** The tax, in pennies. */ tax: number; /** A list of sub-items. */ sub_items?: Item[]; }; export declare type Tax = { /** The name of the tax (e.g., VAT). */ description: string; /** Total amount of the tax, in pennies. */ amount: number; currency: string; tax_number: string; }; /** * Payments tell us how you paid for your purchase. While it will always include * a card payment, sometimes a cash payment or a gift card is included as well. * All of the payments together should add up to the receipt total. */ export declare type Payment = { type: 'card' | 'cash' | 'gift_card'; /** Amount paid in pennies. */ amount: number; currency: string; /** The last four digits of the card number, for card payments. */ last_four?: number; /** A description of the gift card, for gift_card payments */ gift_card_type?: string; }; /** * The merchant gives us more information about where the purchase was made, to * help us decide what to show at the top of the receipt. */ export declare type Merchant = { /** The merchant name. */ name: string; online: boolean; phone: string; email: string; store_name: string; store_address: string; store_postcode: string; };