/*
  This file is part of TALER
  Copyright (C) 2014-2026 Taler Systems SA

  TALER is free software; you can redistribute it and/or modify it under the
  terms of the GNU Lesser General Public License as published by the Free Software
  Foundation; either version 2.1, or (at your option) any later version.

  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License along with
  TALER; see the file COPYING.LGPL.  If not, see
  <http://www.gnu.org/licenses/>
*/
/**
 * @file include/taler/taler-merchant/patch-private-accounts-H_WIRE.h
 * @brief C interface for PATCH /private/accounts/$H_WIRE of the merchant backend
 * @author Christian Grothoff
 */
#ifndef _TALER_MERCHANT__PATCH_PRIVATE_ACCOUNTS_H_WIRE_H
#define _TALER_MERCHANT__PATCH_PRIVATE_ACCOUNTS_H_WIRE_H

#include <taler/taler-merchant/common.h>


/**
 * Handle for a PATCH /private/accounts/$H_WIRE request.
 */
struct TALER_MERCHANT_AccountPatchHandle;


/**
 * Callback for a PATCH /private/accounts/$H_WIRE request.
 *
 * @param cls closure
 * @param hr HTTP response details
 */
typedef void
(*TALER_MERCHANT_AccountPatchCallback)(
  void *cls,
  const struct TALER_MERCHANT_HttpResponse *hr);


/**
 * Issue a PATCH /private/accounts/$H_WIRE request to update a wire account.
 *
 * @param ctx CURL context to use
 * @param backend_url base URL of the merchant backend
 * @param h_wire hash of the wire details identifying the account
 * @param credit_facade_url new URL of the credit facade, or NULL
 * @param credit_facade_credentials new credentials (JSON), or NULL
 * @param cb callback to invoke with the result
 * @param cb_cls closure for @a cb
 * @return handle for the request, NULL on hard error
 */
struct TALER_MERCHANT_AccountPatchHandle *
TALER_MERCHANT_account_patch (
  struct GNUNET_CURL_Context *ctx,
  const char *backend_url,
  const struct TALER_MerchantWireHashP *h_wire,
  const char *credit_facade_url,
  const json_t *credit_facade_credentials,
  TALER_MERCHANT_AccountPatchCallback cb,
  void *cb_cls);


/**
 * Cancel a PATCH /private/accounts/$H_WIRE request.
 *
 * @param[in] tph handle to cancel
 */
void
TALER_MERCHANT_account_patch_cancel (
  struct TALER_MERCHANT_AccountPatchHandle *tph);


#endif
