summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_merchant_service.h')
-rw-r--r--src/include/taler_merchant_service.h364
1 files changed, 214 insertions, 150 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 815a885b..20a0ee8e 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -1595,35 +1595,78 @@ struct TALER_MERCHANT_OrderWalletGetHandle;
/**
+ * Response to a GET /orders/$ID request.
+ */
+struct TALER_MERCHANT_OrderWalletGetResponse
+{
+ /**
+ * Full HTTP response details.
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ /**
+ * Response details depending on the HTTP status.
+ */
+ union
+ {
+ /**
+ * Response details if the response code is #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * True if there is at least on refund on this payment.
+ */
+ bool refunded;
+
+ /**
+ * True if there are refunds waiting to be
+ * obtained.
+ */
+ bool refund_pending;
+
+ /**
+ * Amount that was refunded, only set if
+ * @e refunded is #GNUNET_YES.
+ */
+ struct TALER_Amount refund_amount;
+
+ } success;
+
+ /**
+ * Response if a payment is required from the client.
+ */
+ struct
+ {
+
+ /**
+ * The URI that instructs the wallet to process
+ * the payment.
+ */
+ const char *taler_pay_uri;
+
+ /**
+ * Equivalent order that this customer paid already, or NULL for none.
+ */
+ const char *already_paid_order_id;
+
+ } payment_required;
+
+ } details;
+};
+
+
+/**
* Callback to process a GET /orders/$ID response
*
* @param cls closure
* @param hr HTTP response details
- * @param paid #GNUNET_YES if the payment is settled, #GNUNET_NO if not
- * settled, #GNUNET_SYSERR on error
- * (note that refunded payments are returned as paid!)
- * @param refunded #GNUNET_YES if there is at least on refund on this payment,
- * #GNUNET_NO if refunded, #GNUNET_SYSERR or error
- * @param refund_pending #GNUNET_YES if there are refunds waiting to be
- * obtained, #GNUNET_NO if all refunds have been obtained, #GNUNET_SYSERR
- * on error.
- * @param refund_amount amount that was refunded, NULL if there
- * was no refund
- * @param taler_pay_uri the URI that instructs the wallets to process
- * the payment
- * @param already_paid_order_id equivalent order that this customer
- * paid already, or NULL for none
*/
typedef void
(*TALER_MERCHANT_OrderWalletGetCallback) (
void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- enum GNUNET_GenericReturnValue paid,
- enum GNUNET_GenericReturnValue refunded,
- enum GNUNET_GenericReturnValue refund_pending,
- struct TALER_Amount *refund_amount,
- const char *taler_pay_uri,
- const char *already_paid_order_id);
+ const struct TALER_MERCHANT_OrderWalletGetResponse *owgs);
/**
@@ -1798,151 +1841,170 @@ enum TALER_MERCHANT_OrderStatusCode
*/
struct TALER_MERCHANT_OrderStatusResponse
{
-
/**
- * Status of the order.
+ * HTTP response details.
*/
- enum TALER_MERCHANT_OrderStatusCode status;
+ struct TALER_MERCHANT_HttpResponse hr;
/**
- * Details depending on the payment status given in @e status.
+ * Details provided depending on the HTTP status code.
*/
union
{
-
- /**
- * Details provided if @e status is #TALER_MERCHANT_OSC_PAID.
- */
- struct
- {
- /**
- * Amount that was refunded.
- */
- struct TALER_Amount refund_amount;
-
- /**
- * Amount that was deposited into our bank account,
- * excluding fees.
- */
- struct TALER_Amount deposit_total;
-
- /**
- * The full contract terms of the order.
- */
- const json_t *contract_terms;
-
- /**
- * Array of wire transfers made for this payment to the
- * merchant by the exchange. Of length @e wts_len.
- */
- struct TALER_MERCHANT_WireTransfer *wts;
-
- /**
- * 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 refunds were approved that have not yet been obtained
- * by the wallet.
- */
- bool refund_pending;
-
- /**
- * true if the exchange paid the merchant for this order,
- * false if not.
- */
- bool wired;
-
- } paid;
-
/**
- * Details provided if @e status is #TALER_MERCHANT_OSC_CLAIMED.
+ * Details provided if the HTTP status is #MHD_OK.
*/
struct
{
/**
- * The full contract terms of the claimed order (including client nonce from claiming).
+ * Status of the order.
*/
- const json_t *contract_terms;
-
- } claimed;
-
- /**
- * Details provided if @e status is #TALER_MERCHANT_OSC_UNPAID.
- */
- struct
- {
+ enum TALER_MERCHANT_OrderStatusCode status;
/**
- * URI that should be shown to the wallet to trigger a payment.
+ * Details depending on the payment status given in @e status.
*/
- const char *taler_pay_uri;
+ union
+ {
+
+ /**
+ * Details provided if @e status is #TALER_MERCHANT_OSC_PAID.
+ */
+ struct
+ {
+ /**
+ * Amount that was refunded.
+ */
+ struct TALER_Amount refund_amount;
+
+ /**
+ * Amount that was deposited into our bank account,
+ * excluding fees.
+ */
+ struct TALER_Amount deposit_total;
+
+ /**
+ * The full contract terms of the order.
+ */
+ const json_t *contract_terms;
+
+ /**
+ * Array of wire transfers made for this payment to the
+ * merchant by the exchange. Of length @e wts_len.
+ */
+ struct TALER_MERCHANT_WireTransfer *wts;
+
+ /**
+ * 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 refunds were approved that have not yet been obtained
+ * by the wallet.
+ */
+ bool refund_pending;
+
+ /**
+ * true if the exchange paid the merchant for this order,
+ * false if not.
+ */
+ bool wired;
+
+ } paid;
+
+ /**
+ * Details provided if @e status is #TALER_MERCHANT_OSC_CLAIMED.
+ */
+ struct
+ {
+
+ /**
+ * The full contract terms of the claimed order (including client nonce from claiming).
+ */
+ const json_t *contract_terms;
+
+ } claimed;
+
+ /**
+ * Details provided if @e status is #TALER_MERCHANT_OSC_UNPAID.
+ */
+ struct
+ {
+
+ /**
+ * URI that should be shown to the wallet to trigger a payment.
+ */
+ const char *taler_pay_uri;
+
+ /**
+ * Alternative order ID which was paid for already in the same session.
+ * Only given if the same product was purchased before in the same session.
+ * Otherwise NULL.
+ */
+ const char *already_paid_order_id;
+
+ /**
+ * Order summary.
+ */
+ const char *summary;
+
+ /**
+ * Time when the order was created.
+ */
+ struct GNUNET_TIME_Timestamp creation_time;
+
+ /**
+ * Total amount the order is about (amount to be paid by customer).
+ */
+ struct TALER_Amount contract_amount;
+
+ } unpaid;
+
+ } details;
- /**
- * Alternative order ID which was paid for already in the same session.
- * Only given if the same product was purchased before in the same session.
- * Otherwise NULL.
- */
- const char *already_paid_order_id;
-
- /**
- * Order summary.
- */
- const char *summary;
-
- /**
- * Time when the order was created.
- */
- struct GNUNET_TIME_Timestamp creation_time;
-
- /**
- * Total amount the order is about (amount to be paid by customer).
- */
- struct TALER_Amount contract_amount;
-
- } unpaid;
+ } success;
} details;
};
@@ -1958,7 +2020,6 @@ struct TALER_MERCHANT_OrderStatusResponse
typedef void
(*TALER_MERCHANT_OrderMerchantGetCallback) (
void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
const struct TALER_MERCHANT_OrderStatusResponse *osr);
@@ -3865,10 +3926,13 @@ struct TALER_MERCHANT_ExchangeKycFailureDetail
*/
struct TALER_MERCHANT_KycResponse
{
+ /**
+ * HTTP response details.
+ */
struct TALER_MERCHANT_HttpResponse hr;
/**
- * Response details.
+ * Response details depending on the HTTP status.
*/
union
{