From 5be0708a10874be939e63ca82082cd665165823c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 27 Apr 2020 21:11:20 +0530 Subject: adopt new merchant refund API --- src/types/talerTypes.ts | 60 +++++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 39 deletions(-) (limited to 'src/types/talerTypes.ts') diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts index 799c84dc5..17d11eea8 100644 --- a/src/types/talerTypes.ts +++ b/src/types/talerTypes.ts @@ -411,7 +411,7 @@ export interface PayReq { /** * Refund permission in the format that the merchant gives it to us. */ -export class MerchantRefundPermission { +export class MerchantRefundDetails { /** * Amount to be refunded. */ @@ -433,52 +433,30 @@ export class MerchantRefundPermission { rtransaction_id: number; /** - * Signature made by the merchant over the refund permission. + * Exchange's key used for the signature. */ - merchant_sig: string; -} - -/** - * 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: string; - - /** - * Refund fee associated with the given coin. - * must be smaller than the refund amount. - */ - refund_fee: string; + exchange_pub?: string; /** - * SHA-512 hash of the contact of the merchant with the customer. + * Exchange's signature to confirm the refund. */ - h_contract_terms: string; + exchange_sig?: string; /** - * coin's public key, both ECDHE and EdDSA. + * Error replay from the exchange (if any). */ - coin_pub: string; + exchange_reply?: any; /** - * 64-bit transaction id of the refund transaction between merchant and customer + * Error code from the exchange (if any). */ - rtransaction_id: number; - - /** - * EdDSA public key of the merchant. - */ - merchant_pub: string; + exchange_code?: number; /** - * EdDSA signature of the merchant affirming the refund. + * HTTP status code of the exchange's response + * to the merchant's refund request. */ - merchant_sig: string; + exchange_http_status: number; } /** @@ -499,7 +477,7 @@ export class MerchantRefundResponse { /** * The signed refund permissions, to be sent to the exchange. */ - refund_permissions: MerchantRefundPermission[]; + refunds: MerchantRefundDetails[]; } /** @@ -854,14 +832,18 @@ export const codecForContractTerms = (): Codec => .build("ContractTerms"); export const codecForMerchantRefundPermission = (): Codec< - MerchantRefundPermission + MerchantRefundDetails > => - makeCodecForObject() + makeCodecForObject() .property("refund_amount", codecForString) .property("refund_fee", codecForString) .property("coin_pub", codecForString) .property("rtransaction_id", codecForNumber) - .property("merchant_sig", codecForString) + .property("exchange_http_status", codecForNumber) + .property("exchange_code", makeCodecOptional(codecForNumber)) + .property("exchange_reply", makeCodecOptional(codecForAny)) + .property("exchange_sig", makeCodecOptional(codecForString)) + .property("exchange_pub", makeCodecOptional(codecForString)) .build("MerchantRefundPermission"); export const codecForMerchantRefundResponse = (): Codec< @@ -871,7 +853,7 @@ export const codecForMerchantRefundResponse = (): Codec< .property("merchant_pub", codecForString) .property("h_contract_terms", codecForString) .property( - "refund_permissions", + "refunds", makeCodecForList(codecForMerchantRefundPermission()), ) .build("MerchantRefundResponse"); -- cgit v1.2.3