From fdf89e8138cc239bd1cb11e9b71c30b9607f54b1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 13 Jun 2020 22:51:37 +0200 Subject: adjust API to current spec --- src/include/taler_merchant_service.h | 135 ++++++++++++++++++++++------------- 1 file changed, 87 insertions(+), 48 deletions(-) (limited to 'src/include/taler_merchant_service.h') diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 4ae3112a..7ffa6b32 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -1485,16 +1485,14 @@ struct TALER_MERCHANT_WireTransfer /** - * Details about a conflicting response returned by the exchange. + * Details about a failures returned by the exchange when + * tracking wire transfers. */ -struct TALER_MERCHANT_WireConflict +struct TALER_MERCHANT_WireReport { /** - * Error code explaining the nature of the conflict. Can either be that - * @e coin_pub is not (or with a different amount) included in @e - * wtid_claim despite @e deposit_claim saying it should be, or that the - * amounts in @e wtid_claim do not add up. + * Error code explaining the nature of the problem. */ enum TALER_ErrorCode code; @@ -1509,21 +1507,34 @@ struct TALER_MERCHANT_WireConflict struct TALER_CoinSpendPublicKeyP coin_pub; /** - * HTTP response data from the exchange (NULL if not available). + * HTTP response data from the exchange (fields are MAY BE NULL or 0 if not + * available). */ - const struct TALER_EXCHANGE_HttpResponse *hr; + struct TALER_EXCHANGE_HttpResponse hr; + +}; + + +/** + * Detail returned by the merchant backend about refunds. + */ +struct TALER_MERCHANT_RefundOrderDetail +{ /** - * A claim by the exchange about the transactions associated - * with a given wire transfer, NULL if not available. + * Human-readable reason given for the refund. */ - const struct TALER_EXCHANGE_TransferData *wtid_claim; + const char *reason; + + /** + * Time when the refund was granted. + */ + struct GNUNET_TIME_Absolute refund_time; /** - * A claim by the exchange that the given transaction is included - * in the above WTID, NULL if not available. + * Total amount that was refunded. */ - const struct TALER_EXCHANGE_DepositData *deposit_claim; + struct TALER_Amount refund_amount; }; @@ -1535,11 +1546,18 @@ struct TALER_MERCHANT_OrderStatusResponse { /** - * #GNUNET_YES if the payment is settled, #GNUNET_NO if not - * settled, #GNUNET_SYSERR if we got conflicting transaction proofs. + * The full contract terms of the order. + */ + const json_t *contract_terms; + + /** + * true if the payment is settled, false if not settled. */ - enum GNUNET_GenericReturnValue paid; + bool paid; + /** + * Details depending on the payment status given in @e paid. + */ union { @@ -1549,15 +1567,15 @@ struct TALER_MERCHANT_OrderStatusResponse struct { /** - * Refunded #GNUNET_YES if there is at least on refund on this payment, - * #GNUNET_NO if there are no refunds. + * Amount that was refunded. */ - enum GNUNET_GenericReturnValue refunded; + struct TALER_Amount refund_amount; /** - * Amount that was refunded. + * Amount that was deposited into our bank account, + * excluding fees. */ - struct TALER_Amount refund_amount; + struct TALER_Amount deposit_total; /** * Hash of the contract terms. @@ -1571,10 +1589,56 @@ struct TALER_MERCHANT_OrderStatusResponse struct TALER_MERCHANT_WireTransfer *wts; /** - * Length of the @e wt array. + * Length of the @e wts array. */ unsigned int wts_len; + /** + * Array of wire reports about problems tracking wire transfers. + * Of length @e wrs_len. + */ + struct TALER_MERCHANT_WireReport *wrs; + + /** + * Length of the @e wrs array. + */ + unsigned int wrs_len; + + /** + * Details returned by the merchant backend about refunds. + * Of length @e refunds_len. + */ + struct TALER_MERCHANT_RefundOrderDetail *refunds; + + /** + * Length of the @e refunds array. + */ + unsigned int refunds_len; + + /** + * Error code encountered trying to contact the exchange + * about the wire tracking, 0 for none. + */ + enum TALER_ErrorCode exchange_ec; + + /** + * HTTP status code encountered trying to contact the exchange + * about the wire tracking, 0 for no error. + */ + unsigned int exchange_hc; + + /** + * true if there is at least on refund on this payment, + * false if there are no refunds. + */ + bool refunded; + + /** + * true if the exchange paid the merchant for this order, + * false if not. + */ + bool wired; + } paid; /** @@ -1597,31 +1661,6 @@ struct TALER_MERCHANT_OrderStatusResponse } unpaid; - /** - * Details provided if @e paid is #GNUNET_SYSERR. - */ - struct - { - - /** - * Length of the @e conflicts array. - */ - unsigned int num_conficts; - - /** - * Array of conflicting information returned by the exchange - * concerning the payments made for this order. - */ - struct TALER_MERCHANT_WireConflict *conflicts; - - /** - * Losses we believe to have suffered as a result from - * the @e conflicts (in total). - */ - struct TALER_Amount total_loss; - - } conflict; - } details; }; -- cgit v1.2.3