diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-01-29 16:41:17 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-01-29 16:41:17 +0100 |
commit | 1a66e232a55dff8c889e5554f637f4d4e475179c (patch) | |
tree | e02390f0edfecf5e925d44a71c62056060819886 /src/talerTypes.ts | |
parent | c8c03e381e252dc3a73a2c35bb1cd2ee24eeaabb (diff) | |
download | wallet-core-1a66e232a55dff8c889e5554f637f4d4e475179c.tar.xz |
implement aborting and getting refunds from failed payments
Diffstat (limited to 'src/talerTypes.ts')
-rw-r--r-- | src/talerTypes.ts | 89 |
1 files changed, 82 insertions, 7 deletions
diff --git a/src/talerTypes.ts b/src/talerTypes.ts index d593c3d34..611d667c5 100644 --- a/src/talerTypes.ts +++ b/src/talerTypes.ts @@ -475,46 +475,121 @@ export interface PayReq { /** * Refund permission in the format that the merchant gives it to us. */ -export interface RefundPermission { +@Checkable.Class() +export class MerchantRefundPermission { /** * Amount to be refunded. */ + @Checkable.Value(() => AmountJson) refund_amount: AmountJson; /** * Fee for the refund. */ + @Checkable.Value(() => AmountJson) + refund_fee: AmountJson; + + /** + * Public key of the coin being refunded. + */ + @Checkable.String + coin_pub: string; + + /** + * Refund transaction ID between merchant and exchange. + */ + @Checkable.Number + rtransaction_id: number; + + /** + * Signature made by the merchant over the refund permission. + */ + @Checkable.String + merchant_sig: string; + + /** + * Create a MerchantRefundPermission from untyped JSON. + */ + static checked: (obj: any) => MerchantRefundPermission; +} + + +/** + * Refund request sent to the exchange. + */ +export interface RefundRequest { + /** + * Amount to be refunded, can be a fraction of the + * coin's total deposit value (including deposit fee); + * must be larger than the refund fee. + */ + refund_amount: AmountJson; + + /** + * Refund fee associated with the given coin. + * must be smaller than the refund amount. + */ refund_fee: AmountJson; /** - * Contract terms hash to identify the contract that this - * refund is for. + * SHA-512 hash of the contact of the merchant with the customer. */ h_contract_terms: string; /** - * Public key of the coin being refunded. + * coin's public key, both ECDHE and EdDSA. */ coin_pub: string; /** - * Refund transaction ID between merchant and exchange. + * 64-bit transaction id of the refund transaction between merchant and customer */ rtransaction_id: number; /** - * Public key of the merchant. + * EdDSA public key of the merchant. */ merchant_pub: string; /** - * Signature made by the merchant over the refund permission. + * EdDSA signature of the merchant affirming the refund. */ merchant_sig: string; } /** + * Response for a refund pickup or a /pay in abort mode. + */ +@Checkable.Class() +export class MerchantRefundResponse { + /** + * Public key of the merchant + */ + @Checkable.String + merchant_pub: string; + + /** + * Contract terms hash of the contract that + * is being refunded. + */ + @Checkable.String + h_contract_terms: string; + + /** + * The signed refund permissions, to be sent to the exchange. + */ + @Checkable.List(Checkable.Value(() => MerchantRefundPermission)) + refund_permissions: MerchantRefundPermission[]; + + /** + * Create a MerchantRefundReponse from untyped JSON. + */ + static checked: (obj: any) => MerchantRefundResponse; +} + + +/** * Planchet detail sent to the merchant. */ export interface TipPlanchetDetail { |