merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 3921a989ebfefe0cbda271350d87a09c90c21970
parent 4f0b2d59ad54c5977843ec00949f5f554f03c81c
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  9 Apr 2026 20:51:28 +0200

changing includes from taler/taler-merchant/ to taler/merchant/

Diffstat:
Mconfigure.ac | 2+-
Msrc/include/taler/Makefile.am | 2+-
Asrc/include/taler/merchant/Makefile.am | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/common.h | 445+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-management-instances-INSTANCE.h | 192+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-accounts-H_WIRE.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-donau-DONAU_SERIAL.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-orders-ORDER_ID.h | 197+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-otp-devices-DEVICE_ID.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-products-PRODUCT_ID.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-templates-TEMPLATE_ID.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-token.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-tokens-SERIAL.h | 112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-transfers-TID.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-units-UNIT.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/delete-private-webhooks-WEBHOOK_ID.h | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-config.h | 308+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-management-instances-INSTANCE.h | 267+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-management-instances.h | 181+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-orders-ORDER_ID.h | 450+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-accounts-H_WIRE.h | 177+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-accounts.h | 161+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-donau.h | 191+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-kyc.h | 533+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-orders-ORDER_ID.h | 569+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-orders.h | 556+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-otp-devices-DEVICE_ID.h | 304+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-otp-devices.h | 157+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-products-PRODUCT_ID.h | 246+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-products.h | 401+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-statistics-amount-SLUG.h | 342+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-statistics-counter-SLUG.h | 333+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-templates-TEMPLATE_ID.h | 155+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-templates.h | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h | 196+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-transfers.h | 429+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-units-UNIT.h | 135+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-units.h | 137+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-webhooks-WEBHOOK_ID.h | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-private-webhooks.h | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-products-IMAGE_HASH-image.h | 135+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/get-templates-TEMPLATE_ID.h | 146+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-management-instances-INSTANCE.h | 415+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-private-accounts-H_WIRE.h | 279+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-private-orders-ORDER_ID-forget.h | 113+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-private-otp-devices-DEVICE_ID.h | 233+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-private-products-PRODUCT_ID.h | 638+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-private-templates-TEMPLATE_ID.h | 223+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-private-units-UNIT.h | 376+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/patch-private-webhooks-WEBHOOK_ID.h | 260+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-management-instances-INSTANCE-auth.h | 223+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-management-instances.h | 452+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-orders-ORDER_ID-abort.h | 250+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-orders-ORDER_ID-claim.h | 252+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-orders-ORDER_ID-paid.h | 227+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-orders-ORDER_ID-pay.h | 788+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-orders-ORDER_ID-refund.h | 221+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-accounts.h | 301+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-categories.h | 240+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-donau.h | 224+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-orders-ORDER_ID-refund.h | 143+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-orders.h | 536+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-otp-devices.h | 238+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-products-PRODUCT_ID-lock.h | 251+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-products.h | 604++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-templates.h | 249+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-token.h | 310+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-tokenfamilies.h | 261+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-transfers.h | 145+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-units.h | 328+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-private-webhooks.h | 263+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/include/taler/merchant/post-templates-TEMPLATE_ID.h | 298+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsrc/include/taler/taler-merchant/Makefile.am | 74--------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/common.h | 445-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-management-instances-INSTANCE.h | 192-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-accounts-H_WIRE.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-donau-DONAU_SERIAL.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-orders-ORDER_ID.h | 197-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-otp-devices-DEVICE_ID.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-products-PRODUCT_ID.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-templates-TEMPLATE_ID.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-token.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-tokens-SERIAL.h | 112-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-transfers-TID.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-units-UNIT.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/delete-private-webhooks-WEBHOOK_ID.h | 110-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-config.h | 308-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-management-instances-INSTANCE.h | 267-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-management-instances.h | 181-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-orders-ORDER_ID.h | 450-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-accounts-H_WIRE.h | 177-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-accounts.h | 161-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-donau.h | 191-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-kyc.h | 533-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-orders-ORDER_ID.h | 569-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-orders.h | 556-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-otp-devices-DEVICE_ID.h | 304-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-otp-devices.h | 157-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-products-PRODUCT_ID.h | 246-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-products.h | 401-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-statistics-amount-SLUG.h | 342-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-statistics-counter-SLUG.h | 333-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-templates-TEMPLATE_ID.h | 155-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-templates.h | 156-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h | 196-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-transfers.h | 429-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-units-UNIT.h | 135-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-units.h | 137-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-webhooks-WEBHOOK_ID.h | 156-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-private-webhooks.h | 156-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-products-IMAGE_HASH-image.h | 135-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/get-templates-TEMPLATE_ID.h | 146-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-management-instances-INSTANCE.h | 415-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-private-accounts-H_WIRE.h | 279-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-private-orders-ORDER_ID-forget.h | 113-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-private-otp-devices-DEVICE_ID.h | 233-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-private-products-PRODUCT_ID.h | 638-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-private-templates-TEMPLATE_ID.h | 223-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-private-units-UNIT.h | 376-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/patch-private-webhooks-WEBHOOK_ID.h | 260-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-management-instances-INSTANCE-auth.h | 223-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-management-instances.h | 452-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-orders-ORDER_ID-abort.h | 250-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-orders-ORDER_ID-claim.h | 252-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-orders-ORDER_ID-paid.h | 227-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-orders-ORDER_ID-pay.h | 788-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-orders-ORDER_ID-refund.h | 221-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-accounts.h | 301-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-categories.h | 240-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-donau.h | 224-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-orders-ORDER_ID-refund.h | 143-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-orders.h | 536-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-otp-devices.h | 238-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-products-PRODUCT_ID-lock.h | 251-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-products.h | 604------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-templates.h | 249-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-token.h | 310-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-tokenfamilies.h | 261-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-transfers.h | 145-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-units.h | 328-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-private-webhooks.h | 263-------------------------------------------------------------------------------
Dsrc/include/taler/taler-merchant/post-templates-TEMPLATE_ID.h | 298-------------------------------------------------------------------------------
Msrc/include/taler/taler_merchant_service.h | 138++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/lib/merchant_api_delete-management-instances-INSTANCE.c | 2+-
Msrc/lib/merchant_api_delete-private-accounts-H_WIRE.c | 2+-
Msrc/lib/merchant_api_delete-private-donau-DONAU_SERIAL.c | 2+-
Msrc/lib/merchant_api_delete-private-orders-ORDER_ID.c | 2+-
Msrc/lib/merchant_api_delete-private-otp-devices-DEVICE_ID.c | 2+-
Msrc/lib/merchant_api_delete-private-products-PRODUCT_ID.c | 2+-
Msrc/lib/merchant_api_delete-private-templates-TEMPLATE_ID.c | 2+-
Msrc/lib/merchant_api_delete-private-token.c | 2+-
Msrc/lib/merchant_api_delete-private-tokens-SERIAL.c | 2+-
Msrc/lib/merchant_api_delete-private-transfers-TID.c | 2+-
Msrc/lib/merchant_api_delete-private-units-UNIT.c | 2+-
Msrc/lib/merchant_api_delete-private-webhooks-WEBHOOK_ID.c | 2+-
Msrc/lib/merchant_api_get-config.c | 2+-
Msrc/lib/merchant_api_get-management-instances-INSTANCE.c | 2+-
Msrc/lib/merchant_api_get-management-instances.c | 2+-
Msrc/lib/merchant_api_get-orders-ORDER_ID.c | 2+-
Msrc/lib/merchant_api_get-private-accounts-H_WIRE.c | 2+-
Msrc/lib/merchant_api_get-private-accounts.c | 2+-
Msrc/lib/merchant_api_get-private-donau.c | 2+-
Msrc/lib/merchant_api_get-private-kyc.c | 2+-
Msrc/lib/merchant_api_get-private-orders-ORDER_ID.c | 2+-
Msrc/lib/merchant_api_get-private-orders.c | 2+-
Msrc/lib/merchant_api_get-private-otp-devices-DEVICE_ID.c | 2+-
Msrc/lib/merchant_api_get-private-otp-devices.c | 2+-
Msrc/lib/merchant_api_get-private-products-PRODUCT_ID.c | 2+-
Msrc/lib/merchant_api_get-private-products.c | 2+-
Msrc/lib/merchant_api_get-private-statistics-amount-SLUG.c | 2+-
Msrc/lib/merchant_api_get-private-statistics-counter-SLUG.c | 2+-
Msrc/lib/merchant_api_get-private-templates-TEMPLATE_ID.c | 2+-
Msrc/lib/merchant_api_get-private-templates.c | 2+-
Msrc/lib/merchant_api_get-private-tokenfamilies-TOKEN_FAMILY_SLUG.c | 2+-
Msrc/lib/merchant_api_get-private-transfers.c | 2+-
Msrc/lib/merchant_api_get-private-units-UNIT.c | 2+-
Msrc/lib/merchant_api_get-private-units.c | 2+-
Msrc/lib/merchant_api_get-private-webhooks-WEBHOOK_ID.c | 2+-
Msrc/lib/merchant_api_get-private-webhooks.c | 2+-
Msrc/lib/merchant_api_get-products-IMAGE_HASH-image.c | 2+-
Msrc/lib/merchant_api_get-templates-TEMPLATE_ID.c | 2+-
Msrc/lib/merchant_api_patch-management-instances-INSTANCE.c | 2+-
Msrc/lib/merchant_api_patch-private-accounts-H_WIRE.c | 2+-
Msrc/lib/merchant_api_patch-private-orders-ORDER_ID-forget.c | 2+-
Msrc/lib/merchant_api_patch-private-otp-devices-DEVICE_ID.c | 2+-
Msrc/lib/merchant_api_patch-private-products-PRODUCT_ID.c | 2+-
Msrc/lib/merchant_api_patch-private-templates-TEMPLATE_ID.c | 2+-
Msrc/lib/merchant_api_patch-private-units-UNIT.c | 2+-
Msrc/lib/merchant_api_patch-private-webhooks-WEBHOOK_ID.c | 2+-
Msrc/lib/merchant_api_post-management-instances-INSTANCE-auth.c | 2+-
Msrc/lib/merchant_api_post-management-instances.c | 2+-
Msrc/lib/merchant_api_post-orders-ORDER_ID-abort.c | 2+-
Msrc/lib/merchant_api_post-orders-ORDER_ID-claim.c | 2+-
Msrc/lib/merchant_api_post-orders-ORDER_ID-paid.c | 2+-
Msrc/lib/merchant_api_post-orders-ORDER_ID-pay.c | 2+-
Msrc/lib/merchant_api_post-orders-ORDER_ID-refund.c | 2+-
Msrc/lib/merchant_api_post-private-accounts.c | 2+-
Msrc/lib/merchant_api_post-private-categories.c | 2+-
Msrc/lib/merchant_api_post-private-donau.c | 2+-
Msrc/lib/merchant_api_post-private-orders-ORDER_ID-refund.c | 2+-
Msrc/lib/merchant_api_post-private-orders.c | 2+-
Msrc/lib/merchant_api_post-private-otp-devices.c | 2+-
Msrc/lib/merchant_api_post-private-products-PRODUCT_ID-lock.c | 2+-
Msrc/lib/merchant_api_post-private-products.c | 2+-
Msrc/lib/merchant_api_post-private-templates.c | 2+-
Msrc/lib/merchant_api_post-private-token.c | 2+-
Msrc/lib/merchant_api_post-private-tokenfamilies.c | 2+-
Msrc/lib/merchant_api_post-private-transfers.c | 2+-
Msrc/lib/merchant_api_post-private-units.c | 2+-
Msrc/lib/merchant_api_post-private-webhooks.c | 2+-
Msrc/lib/merchant_api_post-templates-TEMPLATE_ID.c | 2+-
Msrc/testing/testing_api_cmd_abort_order.c | 2+-
Msrc/testing/testing_api_cmd_claim_order.c | 2+-
Msrc/testing/testing_api_cmd_config.c | 2+-
Msrc/testing/testing_api_cmd_delete_account.c | 2+-
Msrc/testing/testing_api_cmd_delete_donau_instances.c | 2+-
Msrc/testing/testing_api_cmd_delete_instance.c | 2+-
Msrc/testing/testing_api_cmd_delete_order.c | 2+-
Msrc/testing/testing_api_cmd_delete_otp_device.c | 2+-
Msrc/testing/testing_api_cmd_delete_product.c | 2+-
Msrc/testing/testing_api_cmd_delete_template.c | 2+-
Msrc/testing/testing_api_cmd_delete_transfer.c | 2+-
Msrc/testing/testing_api_cmd_delete_unit.c | 2+-
Msrc/testing/testing_api_cmd_delete_webhook.c | 2+-
Msrc/testing/testing_api_cmd_forget_order.c | 2+-
Msrc/testing/testing_api_cmd_get_donau_instances.c | 2+-
Msrc/testing/testing_api_cmd_get_instance.c | 2+-
Msrc/testing/testing_api_cmd_get_instances.c | 2+-
Msrc/testing/testing_api_cmd_get_orders.c | 2+-
Msrc/testing/testing_api_cmd_get_otp_device.c | 2+-
Msrc/testing/testing_api_cmd_get_otp_devices.c | 2+-
Msrc/testing/testing_api_cmd_get_product.c | 2+-
Msrc/testing/testing_api_cmd_get_product_image.c | 2+-
Msrc/testing/testing_api_cmd_get_products.c | 2+-
Msrc/testing/testing_api_cmd_get_statisticsamount.c | 2+-
Msrc/testing/testing_api_cmd_get_statisticscounter.c | 2+-
Msrc/testing/testing_api_cmd_get_template.c | 2+-
Msrc/testing/testing_api_cmd_get_templates.c | 2+-
Msrc/testing/testing_api_cmd_get_transfers.c | 2+-
Msrc/testing/testing_api_cmd_get_unit.c | 2+-
Msrc/testing/testing_api_cmd_get_units.c | 2+-
Msrc/testing/testing_api_cmd_get_webhook.c | 2+-
Msrc/testing/testing_api_cmd_get_webhooks.c | 2+-
Msrc/testing/testing_api_cmd_instance_auth.c | 2+-
Msrc/testing/testing_api_cmd_instance_token.c | 4++--
Msrc/testing/testing_api_cmd_kyc_get.c | 2+-
Msrc/testing/testing_api_cmd_lock_product.c | 2+-
Msrc/testing/testing_api_cmd_merchant_get_order.c | 2+-
Msrc/testing/testing_api_cmd_patch_instance.c | 2+-
Msrc/testing/testing_api_cmd_patch_otp_device.c | 2+-
Msrc/testing/testing_api_cmd_patch_product.c | 2+-
Msrc/testing/testing_api_cmd_patch_template.c | 2+-
Msrc/testing/testing_api_cmd_patch_unit.c | 2+-
Msrc/testing/testing_api_cmd_patch_webhook.c | 2+-
Msrc/testing/testing_api_cmd_pay_order.c | 2+-
Msrc/testing/testing_api_cmd_post_account.c | 2+-
Msrc/testing/testing_api_cmd_post_categories.c | 2+-
Msrc/testing/testing_api_cmd_post_donau_instances.c | 2+-
Msrc/testing/testing_api_cmd_post_instances.c | 2+-
Msrc/testing/testing_api_cmd_post_orders.c | 4++--
Msrc/testing/testing_api_cmd_post_orders_paid.c | 2+-
Msrc/testing/testing_api_cmd_post_otp_devices.c | 2+-
Msrc/testing/testing_api_cmd_post_products.c | 2+-
Msrc/testing/testing_api_cmd_post_templates.c | 2+-
Msrc/testing/testing_api_cmd_post_tokenfamilies.c | 2+-
Msrc/testing/testing_api_cmd_post_transfers.c | 2+-
Msrc/testing/testing_api_cmd_post_units.c | 2+-
Msrc/testing/testing_api_cmd_post_using_templates.c | 4++--
Msrc/testing/testing_api_cmd_post_webhooks.c | 2+-
Msrc/testing/testing_api_cmd_refund_order.c | 2+-
Msrc/testing/testing_api_cmd_wallet_get_order.c | 2+-
Msrc/testing/testing_api_cmd_wallet_get_template.c | 2+-
Msrc/testing/testing_api_cmd_wallet_post_orders_refund.c | 2+-
273 files changed, 18532 insertions(+), 18532 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -514,7 +514,7 @@ src/backend/Makefile src/backenddb/Makefile src/include/Makefile src/include/taler/Makefile -src/include/taler/taler-merchant/Makefile +src/include/taler/merchant/Makefile src/lib/Makefile src/merchant-tools/Makefile src/util/Makefile diff --git a/src/include/taler/Makefile.am b/src/include/taler/Makefile.am @@ -1,5 +1,5 @@ # This Makefile.am is in the public domain -SUBDIRS = taler-merchant . +SUBDIRS = merchant . EXTRA_DIST = \ platform.h diff --git a/src/include/taler/merchant/Makefile.am b/src/include/taler/merchant/Makefile.am @@ -0,0 +1,74 @@ +# This Makefile.am is in the public domain +SUBDIRS = . +talermerchantincludedir = $(includedir)/taler/merchant + +talermerchantinclude_HEADERS = \ + common.h \ + delete-management-instances-INSTANCE.h \ + delete-private-accounts-H_WIRE.h \ + delete-private-donau-DONAU_SERIAL.h \ + delete-private-orders-ORDER_ID.h \ + delete-private-otp-devices-DEVICE_ID.h \ + delete-private-products-PRODUCT_ID.h \ + delete-private-templates-TEMPLATE_ID.h \ + delete-private-token.h \ + delete-private-tokens-SERIAL.h \ + delete-private-transfers-TID.h \ + delete-private-units-UNIT.h \ + delete-private-webhooks-WEBHOOK_ID.h \ + get-config.h \ + get-management-instances.h \ + get-management-instances-INSTANCE.h \ + get-private-kyc.h \ + get-private-statistics-amount-SLUG.h \ + get-private-statistics-counter-SLUG.h \ + get-orders-ORDER_ID.h \ + get-private-accounts.h \ + get-private-accounts-H_WIRE.h \ + get-private-donau.h \ + get-private-orders.h \ + get-private-orders-ORDER_ID.h \ + get-private-otp-devices.h \ + get-private-otp-devices-DEVICE_ID.h \ + get-private-products.h \ + get-private-products-PRODUCT_ID.h \ + get-private-templates.h \ + get-private-templates-TEMPLATE_ID.h \ + get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h \ + get-private-transfers.h \ + get-private-units.h \ + get-private-units-UNIT.h \ + get-private-webhooks.h \ + get-private-webhooks-WEBHOOK_ID.h \ + get-products-IMAGE_HASH-image.h \ + get-templates-TEMPLATE_ID.h \ + patch-management-instances-INSTANCE.h \ + patch-private-accounts-H_WIRE.h \ + patch-private-otp-devices-DEVICE_ID.h \ + patch-private-orders-ORDER_ID-forget.h \ + patch-private-products-PRODUCT_ID.h \ + patch-private-templates-TEMPLATE_ID.h \ + patch-private-units-UNIT.h \ + patch-private-webhooks-WEBHOOK_ID.h \ + post-management-instances.h \ + post-management-instances-INSTANCE-auth.h \ + post-orders-ORDER_ID-abort.h \ + post-orders-ORDER_ID-claim.h \ + post-orders-ORDER_ID-paid.h \ + post-orders-ORDER_ID-pay.h \ + post-orders-ORDER_ID-refund.h \ + post-private-accounts.h \ + post-private-categories.h \ + post-private-donau.h \ + post-private-orders.h \ + post-private-orders-ORDER_ID-refund.h \ + post-private-otp-devices.h \ + post-private-products.h \ + post-private-products-PRODUCT_ID-lock.h \ + post-private-templates.h \ + post-private-tokenfamilies.h \ + post-private-token.h \ + post-private-transfers.h \ + post-private-units.h \ + post-private-webhooks.h \ + post-templates-TEMPLATE_ID.h diff --git a/src/include/taler/merchant/common.h b/src/include/taler/merchant/common.h @@ -0,0 +1,445 @@ +/* + 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/merchant/common.h + * @brief Common functions of libtalermerchant not specific to a particular endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__COMMON_H +#define _TALER_MERCHANT__COMMON_H + +#include <jansson.h> +#include <taler/taler_util.h> +#include <taler/taler_error_codes.h> +#include <taler/taler_exchange_service.h> +#include <gnunet/gnunet_curl_lib.h> +#include <donau/donau_service.h> + + +/** + * Maximum number of options that can be set in one set_options + * call. Used as a dummy for "infinite" in the varargs case. + */ +#define TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE UINT_MAX + + +/** + * General information about the HTTP response we obtained + * from the merchant for a request. + */ +struct TALER_MERCHANT_HttpResponse +{ + + /** + * The complete JSON reply. NULL if we failed to parse the + * reply (too big, invalid JSON). + */ + const json_t *reply; + + /** + * Set to the human-readable 'hint' that is optionally + * provided by the merchant together with errors. NULL + * if no hint was provided or if there was no error. + */ + const char *hint; + + /** + * HTTP status code for the response. 0 if the + * HTTP request failed and we did not get any answer, or + * if the answer was invalid and we set @a ec to a + * client-side error code. + */ + unsigned int http_status; + + /** + * Taler error code. #TALER_EC_NONE if everything was + * OK. Usually set to the "code" field of an error + * response, but may be set to values created at the + * client side, for example when the response was + * not in JSON format or was otherwise ill-formed. + */ + enum TALER_ErrorCode ec; + + /** + * HTTP status code returned by the exchange, if + * the merchant forwarded an exchange error to us. + * Set to 0 if there was no exchange involved. + */ + unsigned int exchange_http_status; + + /** + * JSON reply from the exchange, if the merchant + * forwarded an exchange error to us. NULL otherwise. + */ + const json_t *exchange_reply; + + /** + * Taler error code from the exchange, if the merchant + * forwarded an exchange error to us. + */ + enum TALER_ErrorCode exchange_code; + + /** + * Human-readable hint from the exchange, if the merchant + * forwarded an exchange error to us. NULL otherwise. + */ + const char *exchange_hint; + +}; + + +/** + * Parse URI data for taler://pay/ URIs. + */ +struct TALER_MERCHANT_PayUriData +{ + + /** + * Hostname (and possibly port) of the merchant backend. + */ + char *merchant_host; + + /** + * Prefix path at the merchant backend (may be NULL). + */ + char *merchant_prefix_path; + + /** + * The order ID. + */ + char *order_id; + + /** + * The session ID (may be NULL if none given). + */ + char *session_id; + + /** + * Claim token (may be NULL if not given in the URI). + */ + struct TALER_ClaimTokenP *claim_token; + + /** + * Subscription session ID (SSID), may be NULL. + */ + char *ssid; + + /** + * Set to true if taler+http:// was used (test only). + */ + bool use_http; + +}; + + +/** + * Parse URI data for taler://refund/ URIs. + */ +struct TALER_MERCHANT_RefundUriData +{ + + /** + * Hostname (and possibly port) of the merchant backend. + */ + char *merchant_host; + + /** + * Prefix path at the merchant backend (may be NULL). + */ + char *merchant_prefix_path; + + /** + * The order ID. + */ + char *order_id; + + /** + * Subscription session ID (SSID), may be NULL. + */ + char *ssid; + + /** + * Set to true if taler+http:// was used (test only). + */ + bool use_http; + +}; + +/** + * Entry for one measurement unit. + */ +struct TALER_MERCHANT_UnitEntry +{ + + /** + * Identifier of the unit. + */ + const char *unit; + + /** + * Long (human-readable) name of the unit. + */ + const char *unit_name_long; + + /** + * Short symbol for the unit. + */ + const char *unit_name_short; + + const json_t *unit_name_long_i18n; + + const json_t *unit_name_short_i18n; + + /** + * Whether fractional quantities are allowed. + */ + bool unit_allow_fraction; + + /** + * Precision level for fractional quantities. + */ + uint32_t unit_precision_level; + + /** + * Whether this unit is currently active. + */ + bool unit_active; + + bool unit_builtin; + + /** + * Serial number of this unit in the database. + */ + uint64_t unit_serial; +}; + + +/** + * Wire transfer information associated with a paid order. + */ +struct TALER_MERCHANT_WireTransfer +{ + + /** + * Base URL of the exchange that made the transfer. + */ + const char *exchange_url; + + /** + * When the transfer took place (note: may not be exact, + * as the time at which the exchange initiated the transfer + * may differ from the time the bank or the merchant observed). + * Zero if not known. + */ + struct GNUNET_TIME_Timestamp execution_time; + + /** + * Wire transfer subject. + */ + struct TALER_WireTransferIdentifierRawP wtid; + + /** + * Total amount that was transferred. + */ + struct TALER_Amount total_amount; + + /** + * Deposit fees paid to the exchange for this order. + * @since protocol v26. + */ + struct TALER_Amount deposit_fee; + + /** + * Whether this transfer was confirmed by the merchant using + * the POST /transfers API, or whether it was merely claimed + * by the exchange. + */ + bool confirmed; + + /** + * Transfer serial ID of this wire transfer, useful as + * offset for the GET /private/incoming endpoint. + * @since protocol v25. + */ + uint64_t expected_transfer_serial_id; + +}; + + +/** + * Type of a statistics metric / aggregation mode. + */ +enum TALER_MERCHANT_StatisticsType +{ + /** + * Return statistics aggregated by bucket. + */ + TALER_MERCHANT_STATISTICS_BY_BUCKET = 0, + + /** + * Return statistics aggregated by time interval. + */ + TALER_MERCHANT_STATISTICS_BY_INTERVAL = 1, + + /** + * Return all available statistics (both buckets and intervals). + */ + TALER_MERCHANT_STATISTICS_ALL = 2 +}; + + +/** + * Information about a single MFA challenge sent by the merchant. + */ +struct TALER_MERCHANT_MfaChallengeEntry +{ + + /** + * Hint about where the challenge was sent (e.g. masked phone/email). + */ + const char *tan_info; + + /** + * Channel used for the challenge ("sms", "email", "totp"). + */ + const char *tan_channel; + + /** + * Challenge identifier (format: "$SERIAL-$H_BODY_HEX"). + */ + const char *challenge_id; + +}; + + +/** + * Response from the merchant requiring multi-factor authentication. + * Returned as HTTP 202 Accepted. + */ +struct TALER_MERCHANT_MfaChallengeResponse +{ + + /** + * If true, all challenges must be solved (AND combination). + * If false, solving any one challenge suffices (OR combination). + */ + bool combi_and; + + /** + * Number of entries in @e challenges. + */ + unsigned int challenges_length; + + /** + * Array of MFA challenges the client must solve. + */ + struct TALER_MERCHANT_MfaChallengeEntry *challenges; + +}; + + +/** + * Free data within a #TALER_MERCHANT_MfaChallengeResponse (but not + * the struct itself). + * + * @param cr response to clean up + */ +void +TALER_MERCHANT_mfa_challenge_response_free ( + struct TALER_MERCHANT_MfaChallengeResponse *cr); + + +/** + * Parse a taler://pay/ URI into its components. + * + * @param pay_uri the URI to parse + * @param[out] parse_data parsed URI data, to be freed with + * #TALER_MERCHANT_parse_pay_uri_free() + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_parse_pay_uri (const char *pay_uri, + struct TALER_MERCHANT_PayUriData *parse_data); + + +/** + * Free a #TALER_MERCHANT_PayUriData previously obtained from + * #TALER_MERCHANT_parse_pay_uri(). + * + * @param[in] parse_data the data to free (fields only, not the struct itself) + */ +void +TALER_MERCHANT_parse_pay_uri_free ( + struct TALER_MERCHANT_PayUriData *parse_data); + + +/** + * Parse a taler://refund/ URI into its components. + * + * @param refund_uri the URI to parse + * @param[out] parse_data parsed URI data, to be freed with + * #TALER_MERCHANT_parse_refund_uri_free() + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_parse_refund_uri ( + const char *refund_uri, + struct TALER_MERCHANT_RefundUriData *parse_data); + + +/** + * Free a #TALER_MERCHANT_RefundUriData previously obtained from + * #TALER_MERCHANT_parse_refund_uri(). + * + * @param[in] parse_data the data to free (fields only, not the struct itself) + */ +void +TALER_MERCHANT_parse_refund_uri_free ( + struct TALER_MERCHANT_RefundUriData *parse_data); + + +/** + * Format a quantity into its decimal string representation. + * + * @param quantity integer part of the quantity + * @param quantity_frac fractional part + * @param[out] buffer output buffer + * @param buffer_length size of @a buffer + */ +void +TALER_MERCHANT_format_quantity_string (uint64_t quantity, + uint32_t quantity_frac, + char *buffer, + size_t buffer_length); + + +/** + * Format a stock value into its decimal string representation. + * + * @param total_stock integer part of the stock value + * @param total_stock_frac fractional part + * @param[out] buffer output buffer + * @param buffer_length size of @a buffer + */ +void +TALER_MERCHANT_format_stock_string (uint64_t total_stock, + uint32_t total_stock_frac, + char *buffer, + size_t buffer_length); + + +#endif diff --git a/src/include/taler/merchant/delete-management-instances-INSTANCE.h b/src/include/taler/merchant/delete-management-instances-INSTANCE.h @@ -0,0 +1,192 @@ +/* + 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/merchant/delete-management-instances-INSTANCE.h + * @brief C interface for DELETE /management/instances/$INSTANCE + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_MANAGEMENT_INSTANCES_INSTANCE_H +#define _TALER_MERCHANT__DELETE_MANAGEMENT_INSTANCES_INSTANCE_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /management/instances/$INSTANCE operation. + */ +struct TALER_MERCHANT_DeleteManagementInstanceHandle; + + +/** + * Set up DELETE /management/instances/$INSTANCE operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param instance_id identifier of the instance to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeleteManagementInstanceHandle * +TALER_MERCHANT_delete_management_instance_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id); + + +/** + * Options for DELETE /management/instances/$INSTANCE. + */ +enum TALER_MERCHANT_DeleteManagementInstanceOption +{ + /** + * Sentinel value, end of options. + */ + TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTION_END = 0, + + /** + * If set, purge (hard delete) the instance, removing all data. + * Without this option, a soft delete is performed (preserves data). + * Value type: none (presence of option means purge=yes). + */ + TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTION_PURGE +}; + + +/** + * Value for a DELETE /management/instances/$INSTANCE option. + */ +struct TALER_MERCHANT_DeleteManagementInstanceOptionValue +{ + /** + * Which option is being set. + */ + enum TALER_MERCHANT_DeleteManagementInstanceOption option; +}; + + +/** + * Set options for DELETE /management/instances/$INSTANCE operation. + * + * @param[in,out] handle the handle to set options for + * @param num_options length of the @a options array + * @param options array of option values (terminated with _END) + */ +void +TALER_MERCHANT_delete_management_instance_set_options_ ( + struct TALER_MERCHANT_DeleteManagementInstanceHandle *handle, + unsigned int num_options, + const struct TALER_MERCHANT_DeleteManagementInstanceOptionValue options[]); + + +/** + * Maximum number of options for set_options macro. + */ +#define TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTIONS_ARRAY_MAX_SIZE 4 + +/** + * Set options for DELETE /management/instances/$INSTANCE operation. + * Variadic macro wrapper around + * #TALER_MERCHANT_delete_management_instance_set_options_(). + * + * @param handle the handle to set options for + * @param ... option values (automatically terminated with _END) + */ +#define TALER_MERCHANT_delete_management_instance_set_options(handle, ...) \ + do { \ + struct TALER_MERCHANT_DeleteManagementInstanceOptionValue __opts[] = { \ + __VA_ARGS__, \ + { .option = TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTION_END } \ + }; \ + TALER_MERCHANT_delete_management_instance_set_options_ ( \ + handle, \ + sizeof (__opts) / sizeof (__opts[0]) - 1, \ + __opts); \ + } while (0) + + +/** + * Response details for a DELETE /management/instances/$INSTANCE request. + */ +struct TALER_MERCHANT_DeleteManagementInstanceResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on HTTP status code. + */ + union + { + /** + * Details in case HTTP status code is #MHD_HTTP_ACCEPTED. + */ + struct TALER_MERCHANT_MfaChallengeResponse accepted; + } details; +}; + + +#ifndef TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeleteManagementInstanceCallback. + */ +#define TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /management/instances/$INSTANCE request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeleteManagementInstanceCallback)( + TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeleteManagementInstanceResponse *result); + + +/** + * Start DELETE /management/instances/$INSTANCE operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_management_instance_start ( + struct TALER_MERCHANT_DeleteManagementInstanceHandle *handle, + TALER_MERCHANT_DeleteManagementInstanceCallback cb, + TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /management/instances/$INSTANCE operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_management_instance_cancel ( + struct TALER_MERCHANT_DeleteManagementInstanceHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_MANAGEMENT_INSTANCES_INSTANCE_H */ diff --git a/src/include/taler/merchant/delete-private-accounts-H_WIRE.h b/src/include/taler/merchant/delete-private-accounts-H_WIRE.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-accounts-H_WIRE.h + * @brief C interface for DELETE /private/accounts/$H_WIRE + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_ACCOUNTS_H_WIRE_H +#define _TALER_MERCHANT__DELETE_PRIVATE_ACCOUNTS_H_WIRE_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/accounts/$H_WIRE operation. + */ +struct TALER_MERCHANT_DeletePrivateAccountHandle; + + +/** + * Set up DELETE /private/accounts/$H_WIRE operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param h_wire hash of the wire details identifying the account to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateAccountHandle * +TALER_MERCHANT_delete_private_account_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_MerchantWireHashP *h_wire); + + +/** + * Response details for a DELETE /private/accounts/$H_WIRE request. + */ +struct TALER_MERCHANT_DeletePrivateAccountResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateAccountCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/accounts/$H_WIRE request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateAccountCallback)( + TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateAccountResponse *result); + + +/** + * Start DELETE /private/accounts/$H_WIRE operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_account_start ( + struct TALER_MERCHANT_DeletePrivateAccountHandle *handle, + TALER_MERCHANT_DeletePrivateAccountCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/accounts/$H_WIRE operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_account_cancel ( + struct TALER_MERCHANT_DeletePrivateAccountHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_ACCOUNTS_H_WIRE_H */ diff --git a/src/include/taler/merchant/delete-private-donau-DONAU_SERIAL.h b/src/include/taler/merchant/delete-private-donau-DONAU_SERIAL.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-donau-DONAU_SERIAL.h + * @brief C interface for DELETE /private/donau/$DONAU_SERIAL + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_DONAU_DONAU_SERIAL_H +#define _TALER_MERCHANT__DELETE_PRIVATE_DONAU_DONAU_SERIAL_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/donau/$DONAU_SERIAL operation. + */ +struct TALER_MERCHANT_DeletePrivateDonauHandle; + + +/** + * Set up DELETE /private/donau/$DONAU_SERIAL operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param charity_id charity identifier to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateDonauHandle * +TALER_MERCHANT_delete_private_donau_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + uint64_t charity_id); + + +/** + * Response details for a DELETE /private/donau/$DONAU_SERIAL request. + */ +struct TALER_MERCHANT_DeletePrivateDonauResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateDonauCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/donau/$DONAU_SERIAL request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateDonauCallback)( + TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateDonauResponse *result); + + +/** + * Start DELETE /private/donau/$DONAU_SERIAL operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_donau_start ( + struct TALER_MERCHANT_DeletePrivateDonauHandle *handle, + TALER_MERCHANT_DeletePrivateDonauCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/donau/$DONAU_SERIAL operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_donau_cancel ( + struct TALER_MERCHANT_DeletePrivateDonauHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_DONAU_DONAU_SERIAL_H */ diff --git a/src/include/taler/merchant/delete-private-orders-ORDER_ID.h b/src/include/taler/merchant/delete-private-orders-ORDER_ID.h @@ -0,0 +1,197 @@ +/* + 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/merchant/delete-private-orders-ORDER_ID.h + * @brief C interface for DELETE /private/orders/$ORDER_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H +#define _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/orders/$ORDER_ID operation. + */ +struct TALER_MERCHANT_DeletePrivateOrderHandle; + + +/** + * Set up DELETE /private/orders/$ORDER_ID operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param order_id identifier of the order to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateOrderHandle * +TALER_MERCHANT_delete_private_order_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id); + + +/** + * Options for DELETE /private/orders/$ORDER_ID. + */ +enum TALER_MERCHANT_DeletePrivateOrderOption +{ + /** + * Sentinel value, end of options. + */ + TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_END = 0, + + /** + * If set, force deletion even if order has payments. + * Value type: none (presence of option means force=true). + */ + TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_FORCE +}; + + +/** + * Value for a DELETE /private/orders/$ORDER_ID option. + */ +struct TALER_MERCHANT_DeletePrivateOrderOptionValue +{ + /** + * Which option is being set. + */ + enum TALER_MERCHANT_DeletePrivateOrderOption option; +}; + + +/** + * Ends list of options. + */ +#define TALER_MERCHANT_delete_private_order_set_option_end() \ + (struct TALER_MERCHANT_DeletePrivateOrderOptionValue) \ + { .option = TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_END } + +/** + * Force deletion even if the order has been claimed. + */ +#define TALER_MERCHANT_delete_private_order_set_option_force() \ + (struct TALER_MERCHANT_DeletePrivateOrderOptionValue) \ + { .option = TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_FORCE } + + +/** + * Set options for DELETE /private/orders/$ORDER_ID operation. + * + * @param[in,out] handle the handle to set options for + * @param num_options length of the @a options array + * @param options array of option values (terminated with _END) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_delete_private_order_set_options_ ( + struct TALER_MERCHANT_DeletePrivateOrderHandle *handle, + unsigned int num_options, + const struct TALER_MERCHANT_DeletePrivateOrderOptionValue options[]); + + +/** + * Maximum number of options for set_options macro. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTIONS_ARRAY_MAX_SIZE 4 + +/** + * Set options for DELETE /private/orders/$ORDER_ID operation. + * Variadic macro wrapper around + * #TALER_MERCHANT_delete_private_order_set_options_(). + * + * @param handle the handle to set options for + * @param ... option values (automatically terminated with _END) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_delete_private_order_set_options(handle, ...) \ + TALER_MERCHANT_delete_private_order_set_options_ ( \ + handle, \ + TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_DeletePrivateOrderOptionValue[]) \ + {__VA_ARGS__, \ + TALER_MERCHANT_delete_private_order_set_option_end () } \ + )) + +/** + * Response details for a DELETE /private/orders/$ORDER_ID request. + */ +struct TALER_MERCHANT_DeletePrivateOrderResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateOrderCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/orders/$ORDER_ID request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateOrderCallback)( + TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateOrderResponse *result); + + +/** + * Start DELETE /private/orders/$ORDER_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_order_start ( + struct TALER_MERCHANT_DeletePrivateOrderHandle *handle, + TALER_MERCHANT_DeletePrivateOrderCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/orders/$ORDER_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_order_cancel ( + struct TALER_MERCHANT_DeletePrivateOrderHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H */ diff --git a/src/include/taler/merchant/delete-private-otp-devices-DEVICE_ID.h b/src/include/taler/merchant/delete-private-otp-devices-DEVICE_ID.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-otp-devices-DEVICE_ID.h + * @brief C interface for DELETE /private/otp-devices/$DEVICE_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_OTP_DEVICES_DEVICE_ID_H +#define _TALER_MERCHANT__DELETE_PRIVATE_OTP_DEVICES_DEVICE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/otp-devices/$DEVICE_ID operation. + */ +struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle; + + +/** + * Set up DELETE /private/otp-devices/$DEVICE_ID operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param otp_device_id identifier of the OTP device to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle * +TALER_MERCHANT_delete_private_otp_device_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *otp_device_id); + + +/** + * Response details for a DELETE /private/otp-devices/$DEVICE_ID request. + */ +struct TALER_MERCHANT_DeletePrivateOtpDeviceResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateOtpDeviceCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/otp-devices/$DEVICE_ID request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateOtpDeviceCallback)( + TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateOtpDeviceResponse *result); + + +/** + * Start DELETE /private/otp-devices/$DEVICE_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_otp_device_start ( + struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle *handle, + TALER_MERCHANT_DeletePrivateOtpDeviceCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/otp-devices/$DEVICE_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_otp_device_cancel ( + struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_OTP_DEVICES_DEVICE_ID_H */ diff --git a/src/include/taler/merchant/delete-private-products-PRODUCT_ID.h b/src/include/taler/merchant/delete-private-products-PRODUCT_ID.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-products-PRODUCT_ID.h + * @brief C interface for DELETE /private/products/$PRODUCT_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_PRODUCTS_PRODUCT_ID_H +#define _TALER_MERCHANT__DELETE_PRIVATE_PRODUCTS_PRODUCT_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/products/$PRODUCT_ID operation. + */ +struct TALER_MERCHANT_DeletePrivateProductHandle; + + +/** + * Set up DELETE /private/products/$PRODUCT_ID operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param product_id identifier of the product to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateProductHandle * +TALER_MERCHANT_delete_private_product_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *product_id); + + +/** + * Response details for a DELETE /private/products/$PRODUCT_ID request. + */ +struct TALER_MERCHANT_DeletePrivateProductResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateProductCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/products/$PRODUCT_ID request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateProductCallback)( + TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateProductResponse *result); + + +/** + * Start DELETE /private/products/$PRODUCT_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_product_start ( + struct TALER_MERCHANT_DeletePrivateProductHandle *handle, + TALER_MERCHANT_DeletePrivateProductCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/products/$PRODUCT_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_product_cancel ( + struct TALER_MERCHANT_DeletePrivateProductHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_PRODUCTS_PRODUCT_ID_H */ diff --git a/src/include/taler/merchant/delete-private-templates-TEMPLATE_ID.h b/src/include/taler/merchant/delete-private-templates-TEMPLATE_ID.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-templates-TEMPLATE_ID.h + * @brief C interface for DELETE /private/templates/$TEMPLATE_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TEMPLATES_TEMPLATE_ID_H +#define _TALER_MERCHANT__DELETE_PRIVATE_TEMPLATES_TEMPLATE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/templates/$TEMPLATE_ID operation. + */ +struct TALER_MERCHANT_DeletePrivateTemplateHandle; + + +/** + * Set up DELETE /private/templates/$TEMPLATE_ID operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param template_id identifier of the template to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateTemplateHandle * +TALER_MERCHANT_delete_private_template_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *template_id); + + +/** + * Response details for a DELETE /private/templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_DeletePrivateTemplateResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateTemplateCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/templates/$TEMPLATE_ID request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateTemplateCallback)( + TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateTemplateResponse *result); + + +/** + * Start DELETE /private/templates/$TEMPLATE_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_template_start ( + struct TALER_MERCHANT_DeletePrivateTemplateHandle *handle, + TALER_MERCHANT_DeletePrivateTemplateCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/templates/$TEMPLATE_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_template_cancel ( + struct TALER_MERCHANT_DeletePrivateTemplateHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/merchant/delete-private-token.h b/src/include/taler/merchant/delete-private-token.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-token.h + * @brief C interface for DELETE /private/token + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H +#define _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/token operation. + */ +struct TALER_MERCHANT_DeletePrivateTokenHandle; + + +/** + * Set up DELETE /private/token operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param instance_id identifier of the instance + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateTokenHandle * +TALER_MERCHANT_delete_private_token_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id); + + +/** + * Response details for a DELETE /private/token request. + */ +struct TALER_MERCHANT_DeletePrivateTokenResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateTokenCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/token request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateTokenCallback)( + TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateTokenResponse *result); + + +/** + * Start DELETE /private/token operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_token_start ( + struct TALER_MERCHANT_DeletePrivateTokenHandle *handle, + TALER_MERCHANT_DeletePrivateTokenCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/token operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_token_cancel ( + struct TALER_MERCHANT_DeletePrivateTokenHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H */ diff --git a/src/include/taler/merchant/delete-private-tokens-SERIAL.h b/src/include/taler/merchant/delete-private-tokens-SERIAL.h @@ -0,0 +1,112 @@ +/* + 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/merchant/delete-private-tokens-SERIAL.h + * @brief C interface for DELETE /private/tokens/$SERIAL + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TOKENS_SERIAL_H +#define _TALER_MERCHANT__DELETE_PRIVATE_TOKENS_SERIAL_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/tokens/$SERIAL operation. + */ +struct TALER_MERCHANT_DeletePrivateTokensSerialHandle; + + +/** + * Set up DELETE /private/tokens/$SERIAL operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param instance_id identifier of the instance + * @param serial serial number of the token to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateTokensSerialHandle * +TALER_MERCHANT_delete_private_tokens_serial_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id, + uint64_t serial); + + +/** + * Response details for a DELETE /private/tokens/$SERIAL request. + */ +struct TALER_MERCHANT_DeletePrivateTokensSerialResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateTokensSerialCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/tokens/$SERIAL request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateTokensSerialCallback)( + TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateTokensSerialResponse *result); + + +/** + * Start DELETE /private/tokens/$SERIAL operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_tokens_serial_start ( + struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *handle, + TALER_MERCHANT_DeletePrivateTokensSerialCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/tokens/$SERIAL operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_tokens_serial_cancel ( + struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TOKENS_SERIAL_H */ diff --git a/src/include/taler/merchant/delete-private-transfers-TID.h b/src/include/taler/merchant/delete-private-transfers-TID.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-transfers-TID.h + * @brief C interface for DELETE /private/transfers/$TID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TRANSFERS_TID_H +#define _TALER_MERCHANT__DELETE_PRIVATE_TRANSFERS_TID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/transfers/$TID operation. + */ +struct TALER_MERCHANT_DeletePrivateTransferHandle; + + +/** + * Set up DELETE /private/transfers/$TID operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param wire_transfer_serial serial number of the wire transfer to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateTransferHandle * +TALER_MERCHANT_delete_private_transfer_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + uint64_t wire_transfer_serial); + + +/** + * Response details for a DELETE /private/transfers/$TID request. + */ +struct TALER_MERCHANT_DeletePrivateTransferResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateTransferCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/transfers/$TID request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateTransferCallback)( + TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateTransferResponse *result); + + +/** + * Start DELETE /private/transfers/$TID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_transfer_start ( + struct TALER_MERCHANT_DeletePrivateTransferHandle *handle, + TALER_MERCHANT_DeletePrivateTransferCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/transfers/$TID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_transfer_cancel ( + struct TALER_MERCHANT_DeletePrivateTransferHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TRANSFERS_TID_H */ diff --git a/src/include/taler/merchant/delete-private-units-UNIT.h b/src/include/taler/merchant/delete-private-units-UNIT.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-units-UNIT.h + * @brief C interface for DELETE /private/units/$UNIT + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_UNITS_UNIT_H +#define _TALER_MERCHANT__DELETE_PRIVATE_UNITS_UNIT_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/units/$UNIT operation. + */ +struct TALER_MERCHANT_DeletePrivateUnitHandle; + + +/** + * Set up DELETE /private/units/$UNIT operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param unit_id identifier of the unit to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateUnitHandle * +TALER_MERCHANT_delete_private_unit_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *unit_id); + + +/** + * Response details for a DELETE /private/units/$UNIT request. + */ +struct TALER_MERCHANT_DeletePrivateUnitResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateUnitCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/units/$UNIT request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateUnitCallback)( + TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateUnitResponse *result); + + +/** + * Start DELETE /private/units/$UNIT operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_unit_start ( + struct TALER_MERCHANT_DeletePrivateUnitHandle *handle, + TALER_MERCHANT_DeletePrivateUnitCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/units/$UNIT operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_unit_cancel ( + struct TALER_MERCHANT_DeletePrivateUnitHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_UNITS_UNIT_H */ diff --git a/src/include/taler/merchant/delete-private-webhooks-WEBHOOK_ID.h b/src/include/taler/merchant/delete-private-webhooks-WEBHOOK_ID.h @@ -0,0 +1,110 @@ +/* + 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/merchant/delete-private-webhooks-WEBHOOK_ID.h + * @brief C interface for DELETE /private/webhooks/$WEBHOOK_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__DELETE_PRIVATE_WEBHOOKS_WEBHOOK_ID_H +#define _TALER_MERCHANT__DELETE_PRIVATE_WEBHOOKS_WEBHOOK_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a DELETE /private/webhooks/$WEBHOOK_ID operation. + */ +struct TALER_MERCHANT_DeletePrivateWebhookHandle; + + +/** + * Set up DELETE /private/webhooks/$WEBHOOK_ID operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx curl context + * @param url merchant backend base URL + * @param webhook_id identifier of the webhook to delete + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_DeletePrivateWebhookHandle * +TALER_MERCHANT_delete_private_webhook_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *webhook_id); + + +/** + * Response details for a DELETE /private/webhooks/$WEBHOOK_ID request. + */ +struct TALER_MERCHANT_DeletePrivateWebhookResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_DeletePrivateWebhookCallback. + */ +#define TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE */ + +/** + * Type of the function that receives the result of a + * DELETE /private/webhooks/$WEBHOOK_ID request. + * + * @param cls closure + * @param result result returned by the HTTP server + */ +typedef void +(*TALER_MERCHANT_DeletePrivateWebhookCallback)( + TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_DeletePrivateWebhookResponse *result); + + +/** + * Start DELETE /private/webhooks/$WEBHOOK_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_delete_private_webhook_start ( + struct TALER_MERCHANT_DeletePrivateWebhookHandle *handle, + TALER_MERCHANT_DeletePrivateWebhookCallback cb, + TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel DELETE /private/webhooks/$WEBHOOK_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_delete_private_webhook_cancel ( + struct TALER_MERCHANT_DeletePrivateWebhookHandle *handle); + + +#endif /* _TALER_MERCHANT__DELETE_PRIVATE_WEBHOOKS_WEBHOOK_ID_H */ diff --git a/src/include/taler/merchant/get-config.h b/src/include/taler/merchant/get-config.h @@ -0,0 +1,308 @@ +/* + 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/merchant/get-config.h + * @brief C interface for the GET /config endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_CONFIG_H +#define _TALER_MERCHANT__GET_CONFIG_H + +#include <taler/merchant/common.h> + + +/** + * Version compatibility status for the merchant backend. + */ +enum TALER_MERCHANT_GetConfigVersionCompatibility +{ + /** + * The client and server are at the same version. + */ + TALER_MERCHANT_GET_CONFIG_VC_MATCH = 0, + + /** + * The server is running a newer API version. + */ + TALER_MERCHANT_GET_CONFIG_VC_NEWER = 1, + + /** + * The server is running an older API version. + */ + TALER_MERCHANT_GET_CONFIG_VC_OLDER = 2, + + /** + * The versions are incompatible. + */ + TALER_MERCHANT_GET_CONFIG_VC_INCOMPATIBLE = 4, + + /** + * A protocol error occurred. + */ + TALER_MERCHANT_GET_CONFIG_VC_PROTOCOL_ERROR = 8 +}; + + +/** + * Information about an exchange as returned in the config response. + */ +struct TALER_MERCHANT_GetConfigExchangeInfo +{ + + /** + * Base URL of the exchange. + */ + const char *base_url; + + /** + * Currency served by this exchange. + */ + const char *currency; + + /** + * Master public key of the exchange. + */ + struct TALER_MasterPublicKeyP master_pub; + +}; + + +/** + * Handle for a GET /config request. + */ +struct TALER_MERCHANT_GetConfigHandle; + + +/** + * Response details for a GET /config request. + */ +struct TALER_MERCHANT_GetConfigResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * API version string. + */ + const char *version; + + /** + * Currency used by this merchant backend. + */ + const char *currency; + + /** + * Compatibility status with the client library. + */ + enum TALER_MERCHANT_GetConfigVersionCompatibility compat; + + /** + * Number of exchanges in @a exchanges. + */ + unsigned int num_exchanges; + + /** + * Array of exchange configurations. + */ + const struct TALER_MERCHANT_GetConfigExchangeInfo *exchanges; + + /** + * Number of currency specifications in @a cspecs. + */ + unsigned int num_cspecs; + + /** + * Array of currency specifications. + */ + const struct TALER_CurrencySpecification *cspecs; + + /** + * Currency information returned by the backend. + */ + struct + { + /** + * Currency string. + */ + const char *currency; + + /** + * Version string. + */ + const char *version; + } ci; + + /** + * Implementation identifier (e.g. + * "urn:net:taler:specs:taler-merchant:c-reference"). + * NULL if not provided. + */ + const char *implementation; + + /** + * Whether the backend supports self-provisioning. + */ + bool have_self_provisioning; + + /** + * Whether the backend was compiled with Donau support. + */ + bool have_donau; + + /** + * Allowed payment target types (as a string). + * NULL if not provided. + */ + const char *payment_target_types; + + /** + * Payment target regex (as a string). + * NULL if not provided. + */ + const char *payment_target_regex; + + /** + * Mandatory TAN channels (JSON array of strings). + * NULL if not provided. + */ + const json_t *mandatory_tan_channels; + + /** + * Default pay delay. + */ + struct GNUNET_TIME_Relative default_pay_delay; + + /** + * Default refund delay. + */ + struct GNUNET_TIME_Relative default_refund_delay; + + /** + * Default wire transfer delay. + */ + struct GNUNET_TIME_Relative default_wire_transfer_delay; + + /** + * Default persona. + */ + const char *default_persona; + + /** + * Report generators (JSON array of strings). + * NULL if not provided. + * // FIXME: split up into array of strings? + */ + const json_t *report_generators; + + /** + * Phone regex for validation. + * NULL if not provided. + */ + const char *phone_regex; + + /** + * SPA configuration options (JSON object). + * NULL if not provided. + */ + const json_t *spa_options; + + } ok; + + } details; + +}; + + +/** + * Set up GET /config operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetConfigHandle * +TALER_MERCHANT_get_config_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetConfigCallback. + */ +#define TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE */ + +/** + * Callback for a GET /config request. + * + * @param cls closure + * @param cr response details + */ +typedef void +(*TALER_MERCHANT_GetConfigCallback)( + TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetConfigResponse *cr); + + +/** + * Start GET /config operation. + * + * @param[in,out] gch operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_config_start ( + struct TALER_MERCHANT_GetConfigHandle *gch, + TALER_MERCHANT_GetConfigCallback cb, + TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /config operation. This function must not be called + * by clients after the TALER_MERCHANT_GetConfigCallback has been + * invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gch operation to cancel + */ +void +TALER_MERCHANT_get_config_cancel ( + struct TALER_MERCHANT_GetConfigHandle *gch); + + +#endif /* _TALER_MERCHANT__GET_CONFIG_H */ diff --git a/src/include/taler/merchant/get-management-instances-INSTANCE.h b/src/include/taler/merchant/get-management-instances-INSTANCE.h @@ -0,0 +1,267 @@ +/* + 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/merchant/get-management-instances-INSTANCE.h + * @brief C interface for GET /management/instances/$INSTANCE of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H +#define _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /management/instances/$INSTANCE request. + */ +struct TALER_MERCHANT_GetManagementInstanceHandle; + + +/** + * Account details for a merchant wire account + * as returned by GET /management/instances/$INSTANCE. + */ +struct TALER_MERCHANT_ManagementAccountEntry +{ + + /** + * Full payto URI of the account. + */ + struct TALER_FullPayto payto_uri; + + /** + * URL of the credit facade (optional, may be NULL). + */ + const char *credit_facade_url; + + /** + * Hash of the wire details. + */ + struct TALER_MerchantWireHashP h_wire; + + /** + * Salt used to compute @e h_wire. + */ + struct TALER_WireSaltP salt; + + /** + * True if the account is active. + */ + bool active; + +}; + + +/** + * Detailed information about a merchant instance. + */ +struct TALER_MERCHANT_GetManagementInstanceDetails +{ + + /** + * Human-readable name of the instance. + */ + const char *name; + + /** + * Public key of the merchant instance. + */ + struct TALER_MerchantPublicKeyP merchant_pub; + + /** + * Whether to use the STEFAN curve for fee calculations. + */ + bool use_stefan; + + /** + * Default wire transfer delay. + */ + struct GNUNET_TIME_Relative default_wire_transfer_delay; + + /** + * Default payment deadline. + */ + struct GNUNET_TIME_Relative default_pay_delay; + + /** + * Default refund deadline. + */ + struct GNUNET_TIME_Relative default_refund_delay; + + /** + * Default wire transfer rounding interval. + */ + enum GNUNET_TIME_RounderInterval default_wire_transfer_rounding_interval; + + /** + * Merchant address (JSON). + */ + const json_t *address; + + /** + * Merchant jurisdiction (JSON). + */ + const json_t *jurisdiction; + + /** + * Email address of the merchant (optional, may be NULL). + */ + const char *email; + + /** + * Whether the email address has been validated. + * Only meaningful if @e email is not NULL. + */ + bool email_validated; + + /** + * Phone number of the merchant (optional, may be NULL). + */ + const char *phone_number; + + /** + * Whether the phone number has been validated. + * Only meaningful if @e phone_number is not NULL. + */ + bool phone_validated; + + /** + * Website URL of the merchant (optional, may be NULL). + */ + const char *website; + + /** + * Logo of the merchant (optional, may be NULL). + */ + const char *logo; + +}; + + +/** + * Response details for a GET /management/instances/$INSTANCE request. + */ +struct TALER_MERCHANT_GetManagementInstanceResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Detailed information about the instance. + */ + struct TALER_MERCHANT_GetManagementInstanceDetails details; + + /** + * Number of accounts in @a accounts. + */ + unsigned int accounts_length; + + /** + * Array of account entries. + */ + const struct TALER_MERCHANT_ManagementAccountEntry *accounts; + + } ok; + + } details; + +}; + + +/** + * Set up GET /management/instances/$INSTANCE operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param instance_id identifier of the instance to retrieve, + * NULL for admin instance + * @return handle to operation + */ +struct TALER_MERCHANT_GetManagementInstanceHandle * +TALER_MERCHANT_get_management_instance_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id); + + +#ifndef TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetManagementInstanceCallback. + */ +#define TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE */ + +/** + * Callback for a GET /management/instances/$INSTANCE request. + * + * @param cls closure + * @param igr response details + */ +typedef void +(*TALER_MERCHANT_GetManagementInstanceCallback)( + TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetManagementInstanceResponse *igr); + + +/** + * Start GET /management/instances/$INSTANCE operation. + * + * @param[in,out] gmi operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_management_instance_start ( + struct TALER_MERCHANT_GetManagementInstanceHandle *gmi, + TALER_MERCHANT_GetManagementInstanceCallback cb, + TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /management/instances/$INSTANCE operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetManagementInstanceCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gmi operation to cancel + */ +void +TALER_MERCHANT_get_management_instance_cancel ( + struct TALER_MERCHANT_GetManagementInstanceHandle *gmi); + + +#endif /* _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H */ diff --git a/src/include/taler/merchant/get-management-instances.h b/src/include/taler/merchant/get-management-instances.h @@ -0,0 +1,181 @@ +/* + 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/merchant/get-management-instances.h + * @brief C interface for the GET /management/instances endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H +#define _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /management/instances request. + */ +struct TALER_MERCHANT_GetManagementInstancesHandle; + + +/** + * Information about one merchant instance. + */ +struct TALER_MERCHANT_GetManagementInstancesInstanceInfo +{ + + /** + * Instance identifier string. + */ + const char *id; + + /** + * Human-readable name of the instance. + */ + const char *name; + + /** + * Public key of the instance. + */ + struct TALER_MerchantPublicKeyP merchant_pub; + + /** + * JSON array of supported payment targets. + */ + const json_t *payment_targets; + + /** + * Website URL of the instance, or NULL if not set. + */ + const char *website; + + /** + * Logo (data URL) of the instance, or NULL if not set. + */ + const char *logo; + + /** + * True if this instance has been deleted. + */ + bool deleted; + +}; + + +/** + * Response details for a GET /management/instances request. + */ +struct TALER_MERCHANT_GetManagementInstancesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of instances in @a iis. + */ + unsigned int iis_length; + + /** + * Array of instance information. + */ + const struct TALER_MERCHANT_GetManagementInstancesInstanceInfo *iis; + + } ok; + + } details; + +}; + + +/** + * Set up GET /management/instances operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetManagementInstancesHandle * +TALER_MERCHANT_get_management_instances_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetManagementInstancesCallback. + */ +#define TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE */ + +/** + * Callback for a GET /management/instances request. + * + * @param cls closure + * @param igr response details + */ +typedef void +(*TALER_MERCHANT_GetManagementInstancesCallback)( + TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetManagementInstancesResponse *igr); + + +/** + * Start GET /management/instances operation. + * + * @param[in,out] gimh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_management_instances_start ( + struct TALER_MERCHANT_GetManagementInstancesHandle *gimh, + TALER_MERCHANT_GetManagementInstancesCallback cb, + TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /management/instances operation. This function must not be + * called by clients after the TALER_MERCHANT_GetManagementInstancesCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gimh operation to cancel + */ +void +TALER_MERCHANT_get_management_instances_cancel ( + struct TALER_MERCHANT_GetManagementInstancesHandle *gimh); + + +#endif /* _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H */ diff --git a/src/include/taler/merchant/get-orders-ORDER_ID.h b/src/include/taler/merchant/get-orders-ORDER_ID.h @@ -0,0 +1,450 @@ +/* + 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/merchant/get-orders-ORDER_ID.h + * @brief C interface for the GET /orders/$ORDER_ID endpoint (wallet-facing) + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_ORDERS_ORDER_ID_H +#define _TALER_MERCHANT__GET_ORDERS_ORDER_ID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /orders/$ORDER_ID request. + */ +enum TALER_MERCHANT_GetOrdersOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_ORDERS_OPTION_END = 0, + + /** + * Long polling timeout. + */ + TALER_MERCHANT_GET_ORDERS_OPTION_TIMEOUT, + + /** + * Session ID for repurchase detection. + */ + TALER_MERCHANT_GET_ORDERS_OPTION_SESSION_ID, + + /** + * Minimum refund amount to wait for. + */ + TALER_MERCHANT_GET_ORDERS_OPTION_MIN_REFUND, + + /** + * If true, wait until refund is confirmed obtained. + */ + TALER_MERCHANT_GET_ORDERS_OPTION_AWAIT_REFUND_OBTAINED, + + /** + * Hash of the contract terms (for authentication). + */ + TALER_MERCHANT_GET_ORDERS_OPTION_H_CONTRACT, + + /** + * Claim token for unclaimed order authentication. + */ + TALER_MERCHANT_GET_ORDERS_OPTION_TOKEN, + + /** + * Whether refunded orders count for repurchase detection. + */ + TALER_MERCHANT_GET_ORDERS_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE + +}; + + +/** + * Value for an option for the GET /orders/$ORDER_ID request. + */ +struct TALER_MERCHANT_GetOrdersOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetOrdersOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_ORDERS_OPTION_TIMEOUT. + */ + struct GNUNET_TIME_Relative timeout; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_ORDERS_OPTION_SESSION_ID. + */ + const char *session_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_ORDERS_OPTION_MIN_REFUND. + */ + struct TALER_Amount min_refund; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_ORDERS_OPTION_AWAIT_REFUND_OBTAINED. + */ + bool await_refund_obtained; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_ORDERS_OPTION_H_CONTRACT. + */ + struct TALER_PrivateContractHashP h_contract; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_ORDERS_OPTION_TOKEN. + */ + struct TALER_ClaimTokenP token; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_ORDERS_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE. + */ + enum TALER_EXCHANGE_YesNoAll allow_refunded_for_repurchase; + + } details; + +}; + + +/** + * Handle for a GET /orders/$ORDER_ID request (wallet-facing). + */ +struct TALER_MERCHANT_GetOrdersHandle; + + +/** + * Set up GET /orders/$ORDER_ID operation (wallet-facing). + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order to check + * @return handle to operation + */ +struct TALER_MERCHANT_GetOrdersHandle * +TALER_MERCHANT_get_orders_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_end_() \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_END \ + } + +/** + * Set long polling timeout. + * + * @param t timeout to use + * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_timeout(t) \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_TIMEOUT, \ + .details.timeout = (t) \ + } + +/** + * Set session ID for repurchase detection. + * + * @param s session ID to use + * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_session_id(s) \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_SESSION_ID, \ + .details.session_id = (s) \ + } + +/** + * Set minimum refund amount to wait for. + * + * @param a minimum refund amount + * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_min_refund(a) \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_MIN_REFUND, \ + .details.min_refund = (a) \ + } + +/** + * Set await refund obtained flag. + * + * @param b true to wait until refund is confirmed obtained + * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_await_refund_obtained(b) \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_AWAIT_REFUND_OBTAINED, \ + .details.await_refund_obtained = (b) \ + } + +/** + * Set hash of the contract terms (for authentication). + * + * @param h hash of contract terms + * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_h_contract(h) \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_H_CONTRACT, \ + .details.h_contract = (h) \ + } + +/** + * Set claim token for unclaimed order authentication. + * + * @param t claim token + * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_token(t) \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_TOKEN, \ + .details.token = (t) \ + } + +/** + * Set whether refunded orders count for repurchase detection. + * + * @param v yes/no/all value + * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue + */ +#define TALER_MERCHANT_get_orders_option_allow_refunded_for_repurchase(v) \ + (const struct TALER_MERCHANT_GetOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_ORDERS_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE, \ + .details.allow_refunded_for_repurchase = (v) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param oph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_orders_set_options_ ( + struct TALER_MERCHANT_GetOrdersHandle *oph, + unsigned int num_options, + const struct TALER_MERCHANT_GetOrdersOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_orders_set_options ( + * oph, + * TALER_MERCHANT_get_orders_option_timeout ( + * GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)), + * TALER_MERCHANT_get_orders_option_session_id ("mysession")); + * + * @param oph the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_orders_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_orders_set_options(oph,...) \ + TALER_MERCHANT_get_orders_set_options_ ( \ + oph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetOrdersOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_get_orders_option_end_ () } \ + )) + + +/** + * Response details for a GET /orders/$ORDER_ID request (wallet-facing). + */ +struct TALER_MERCHANT_GetOrdersResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK (order is paid, refund info available). + */ + struct + { + + /** + * True if a refund has been granted. + */ + bool refunded; + + /** + * True if a refund is still pending. + */ + bool refund_pending; + + /** + * Total amount refunded. + */ + struct TALER_Amount refund_amount; + + /** + * Total amount of refunds taken by the wallet so far. + */ + struct TALER_Amount refund_taken; + + } ok; + + /** + * Details on #MHD_HTTP_ACCEPTED (order claimed, goto reorder URL). + */ + struct + { + + /** + * URL where the client should go to create a fresh order + * or trigger repurchase detection. + */ + const char *public_reorder_url; + + } accepted; + + /** + * Details on #MHD_HTTP_PAYMENT_REQUIRED (order not yet paid). + */ + struct + { + + /** + * Taler pay URI for this order. + */ + const char *taler_pay_uri; + + /** + * Order ID of a previously paid order that covers this one, + * or NULL if none. + */ + const char *already_paid_order_id; + + /** + * Fulfillment URL of the order, or NULL if not available. + */ + const char *fulfillment_url; + + } payment_required; + + } details; + +}; + + +#ifndef TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetOrdersCallback. + */ +#define TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE */ + +/** + * Callback for a GET /orders/$ORDER_ID request (wallet-facing). + * + * @param cls closure + * @param owgr response details + */ +typedef void +(*TALER_MERCHANT_GetOrdersCallback)( + TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetOrdersResponse *owgr); + + +/** + * Start GET /orders/$ORDER_ID operation (wallet-facing). + * + * @param[in,out] oph operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_orders_start ( + struct TALER_MERCHANT_GetOrdersHandle *oph, + TALER_MERCHANT_GetOrdersCallback cb, + TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /orders/$ORDER_ID operation (wallet-facing). This function + * must not be called by clients after the TALER_MERCHANT_GetOrdersCallback + * has been invoked (as in those cases it'll be called internally by + * the implementation already). + * + * @param[in] oph operation to cancel + */ +void +TALER_MERCHANT_get_orders_cancel ( + struct TALER_MERCHANT_GetOrdersHandle *oph); + + +#endif /* _TALER_MERCHANT__GET_ORDERS_ORDER_ID_H */ diff --git a/src/include/taler/merchant/get-private-accounts-H_WIRE.h b/src/include/taler/merchant/get-private-accounts-H_WIRE.h @@ -0,0 +1,177 @@ +/* + 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/merchant/get-private-accounts-H_WIRE.h + * @brief C interface for GET /private/accounts/$H_WIRE of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H +#define _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/accounts/$H_WIRE request. + */ +struct TALER_MERCHANT_GetPrivateAccountHandle; + + +/** + * Account details for a merchant wire account. + */ +struct TALER_MERCHANT_GetPrivateAccountDetails +{ + + /** + * Hash of the wire details. + */ + struct TALER_MerchantWireHashP h_wire; + + /** + * Salt used in the wire hash computation. + */ + struct TALER_WireSaltP salt; + + /** + * Full payto URI of the account. + */ + struct TALER_FullPayto payto_uri; + + /** + * URL of the credit facade, or NULL if none. + */ + const char *credit_facade_url; + + /** + * Extra wire subject metadata, or NULL if not provided. + * Available since protocol v27. + */ + const json_t *extra_wire_subject_metadata; + + /** + * True if the account is currently active. + */ + bool active; + +}; + + +/** + * Response details for a GET /private/accounts/$H_WIRE request. + */ +struct TALER_MERCHANT_GetPrivateAccountResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Detailed account information. + */ + struct TALER_MERCHANT_GetPrivateAccountDetails ad; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/accounts/$H_WIRE operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param instance_id identifier of the merchant instance + * @param h_wire hash of the wire details identifying the account + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateAccountHandle * +TALER_MERCHANT_get_private_account_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id, + const struct TALER_MerchantWireHashP *h_wire); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateAccountCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/accounts/$H_WIRE request. + * + * @param cls closure + * @param agr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateAccountCallback)( + TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateAccountResponse *agr); + + +/** + * Start GET /private/accounts/$H_WIRE operation. + * + * @param[in,out] gpa operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_account_start ( + struct TALER_MERCHANT_GetPrivateAccountHandle *gpa, + TALER_MERCHANT_GetPrivateAccountCallback cb, + TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/accounts/$H_WIRE operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateAccountCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpa operation to cancel + */ +void +TALER_MERCHANT_get_private_account_cancel ( + struct TALER_MERCHANT_GetPrivateAccountHandle *gpa); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H */ diff --git a/src/include/taler/merchant/get-private-accounts.h b/src/include/taler/merchant/get-private-accounts.h @@ -0,0 +1,161 @@ +/* + 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/merchant/get-private-accounts.h + * @brief C interface for the GET /private/accounts endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H +#define _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/accounts request. + */ +struct TALER_MERCHANT_GetPrivateAccountsHandle; + + +/** + * Account details for a merchant wire account. + */ +struct TALER_MERCHANT_GetPrivateAccountsAccountEntry +{ + + /** + * Hash of the wire details. + */ + struct TALER_MerchantWireHashP h_wire; + + /** + * Full payto URI of the account. + */ + struct TALER_FullPayto payto_uri; + + /** + * True if the account is active. + */ + bool active; + +}; + + +/** + * Response details for a GET /private/accounts request. + */ +struct TALER_MERCHANT_GetPrivateAccountsResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of accounts in @a accounts. + */ + unsigned int accounts_length; + + /** + * Array of account entries. + */ + const struct TALER_MERCHANT_GetPrivateAccountsAccountEntry *accounts; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/accounts operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateAccountsHandle * +TALER_MERCHANT_get_private_accounts_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateAccountsCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/accounts request. + * + * @param cls closure + * @param agr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateAccountsCallback)( + TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateAccountsResponse *agr); + + +/** + * Start GET /private/accounts operation. + * + * @param[in,out] gpah operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_accounts_start ( + struct TALER_MERCHANT_GetPrivateAccountsHandle *gpah, + TALER_MERCHANT_GetPrivateAccountsCallback cb, + TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/accounts operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateAccountsCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpah operation to cancel + */ +void +TALER_MERCHANT_get_private_accounts_cancel ( + struct TALER_MERCHANT_GetPrivateAccountsHandle *gpah); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H */ diff --git a/src/include/taler/merchant/get-private-donau.h b/src/include/taler/merchant/get-private-donau.h @@ -0,0 +1,191 @@ +/* + 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/merchant/get-private-donau.h + * @brief C interface for the GET /private/donau endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_DONAU_H +#define _TALER_MERCHANT__GET_PRIVATE_DONAU_H + +#include <taler/merchant/common.h> +#include <donau/donau_service.h> + + +/** + * Handle for a GET /private/donau request. + */ +struct TALER_MERCHANT_GetPrivateDonauHandle; + + +/** + * Individual Donau instance details. + */ +struct TALER_MERCHANT_GetPrivateDonauDonauInstanceEntry +{ + /** + * Serial number of the Donau instance in merchant database. + */ + uint64_t donau_instance_serial; + + /** + * The URL of the Donau service. + */ + const char *donau_url; + + /** + * Name of the charity associated with the Donau instance. + */ + const char *charity_name; + + /** + * Public key of the charity. + */ + struct DONAU_CharityPublicKeyP charity_pub_key; + + /** + * ID of the charity on Donau. + */ + uint64_t charity_id; + + /** + * Maximum donation amount per year allowed for the charity. + */ + struct TALER_Amount charity_max_per_year; + + /** + * Total donations received by the charity in the current year. + */ + struct TALER_Amount charity_receipts_to_date; + + /** + * The current year being tracked for donations. + */ + int64_t current_year; + + /** + * Additional key information related to the Donau instance. + */ + const struct DONAU_Keys *donau_keys; +}; + + +/** + * Response details for a GET /private/donau request. + */ +struct TALER_MERCHANT_GetPrivateDonauResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of Donau instances in @a donau_instances. + */ + unsigned int donau_instances_length; + + /** + * Array of Donau instance entries. + */ + const struct TALER_MERCHANT_GetPrivateDonauDonauInstanceEntry * + donau_instances; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/donau operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateDonauHandle * +TALER_MERCHANT_get_private_donau_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateDonauCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/donau request. + * + * @param cls closure + * @param dgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateDonauCallback)( + TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateDonauResponse *dgr); + + +/** + * Start GET /private/donau operation. + * + * @param[in,out] gpdh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_donau_start ( + struct TALER_MERCHANT_GetPrivateDonauHandle *gpdh, + TALER_MERCHANT_GetPrivateDonauCallback cb, + TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/donau operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateDonauCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpdh operation to cancel + */ +void +TALER_MERCHANT_get_private_donau_cancel ( + struct TALER_MERCHANT_GetPrivateDonauHandle *gpdh); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_DONAU_H */ diff --git a/src/include/taler/merchant/get-private-kyc.h b/src/include/taler/merchant/get-private-kyc.h @@ -0,0 +1,533 @@ +/* + 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/merchant/get-private-kyc.h + * @brief C interface for the GET /private/kyc (and /management/instances/$INSTANCE/kyc) endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_KYC_H +#define _TALER_MERCHANT__GET_PRIVATE_KYC_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /private/kyc request. + */ +enum TALER_MERCHANT_GetPrivateKycOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_END = 0, + + /** + * Hash of the wire account to check, or NULL for all. + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_H_WIRE, + + /** + * URL of the exchange to check with, or NULL for any. + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_EXCHANGE_URL, + + /** + * Long-poll target (what status to wait for). + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LPT, + + /** + * Long polling timeout. + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_TIMEOUT, + + /** + * Instance ID for management mode (GET /management/instances/$INSTANCE/kyc). + * If not set, uses the private endpoint (GET /private/kyc). + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_INSTANCE_ID, + + /** + * Long-poll status filter: only return when some account reaches + * this status. String value (since v25). + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_STATUS, + + /** + * Long-poll negated status filter: only return when some account + * no longer matches this status. String value (since v25). + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_STATUS, + + /** + * Long-poll ETag to suppress responses that have not changed. + * ShortHashCode value (since v25). + */ + TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_ETAG + +}; + + +/** + * Value for an option for the GET /private/kyc request. + */ +struct TALER_MERCHANT_GetPrivateKycOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateKycOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_H_WIRE. + */ + const struct TALER_MerchantWireHashP *h_wire; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_EXCHANGE_URL. + */ + const char *exchange_url; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LPT. + */ + enum TALER_EXCHANGE_KycLongPollTarget lpt; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_TIMEOUT. + */ + struct GNUNET_TIME_Relative timeout; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_INSTANCE_ID. + * If set, the management endpoint + * /management/instances/$INSTANCE/kyc is used instead of + * /private/kyc. + */ + const char *instance_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_STATUS. + */ + const char *lp_status; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_STATUS. + */ + const char *lp_not_status; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_ETAG. + */ + const struct GNUNET_ShortHashCode *lp_not_etag; + + } details; + +}; + + +/** + * Handle for a GET /private/kyc (or /management/instances/$INSTANCE/kyc) request. + */ +struct TALER_MERCHANT_GetPrivateKycHandle; + + +/** + * Set up GET /private/kyc operation. + * Note that you must explicitly start the operation after + * possibly setting options. By default, uses the /private/kyc + * endpoint; set the INSTANCE_ID option to use the management + * endpoint instead. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateKycHandle * +TALER_MERCHANT_get_private_kyc_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_END \ + } + +/** + * Set hash of the wire account to check. + * + * @param h pointer to the wire hash to filter by + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_h_wire(h) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_H_WIRE, \ + .details.h_wire = (h) \ + } + +/** + * Set exchange URL to check with. + * + * @param u exchange URL to filter by + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_exchange_url(u) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_EXCHANGE_URL, \ + .details.exchange_url = (u) \ + } + +/** + * Set long-poll target. + * + * @param t long-poll target to wait for + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_lpt(t) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LPT, \ + .details.lpt = (t) \ + } + +/** + * Set long polling timeout. + * + * @param t timeout to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_timeout(t) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_TIMEOUT, \ + .details.timeout = (t) \ + } + +/** + * Set instance ID for management mode. When set, the request uses + * the /management/instances/$INSTANCE/kyc endpoint instead of + * /private/kyc. + * + * @param id instance identifier + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_instance_id(id) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_INSTANCE_ID, \ + .details.instance_id = (id) \ + } + +/** + * Set long-poll status filter. + * + * @param s status string to wait for + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_lp_status(s) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_STATUS, \ + .details.lp_status = (s) \ + } + +/** + * Set long-poll negated status filter. + * + * @param s status string to negate + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_lp_not_status(s) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_STATUS, \ + .details.lp_not_status = (s) \ + } + +/** + * Set long-poll ETag to suppress unchanged responses. + * + * @param e pointer to the short hash code ETag + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue + */ +#define TALER_MERCHANT_get_private_kyc_option_lp_not_etag(e) \ + (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_ETAG, \ + .details.lp_not_etag = (e) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param kyc the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_kyc_set_options_ ( + struct TALER_MERCHANT_GetPrivateKycHandle *kyc, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateKycOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_kyc_set_options ( + * kyc, + * TALER_MERCHANT_get_private_kyc_option_exchange_url ( + * "https://exchange.example.com/"), + * TALER_MERCHANT_get_private_kyc_option_timeout ( + * GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30))); + * + * @param kyc the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_kyc_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_kyc_set_options(kyc,...) \ + TALER_MERCHANT_get_private_kyc_set_options_ ( \ + kyc, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateKycOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_get_private_kyc_option_end_ () } \ + )) + + +/** + * Information about KYC actions the merchant still must perform. + */ +struct TALER_MERCHANT_GetPrivateKycRedirectDetail +{ + + /** + * Access token the user needs to start a KYC process, + * all zero if a KYC auth transfer must be made first. + */ + struct TALER_AccountAccessTokenP access_token; + + /** + * Base URL of the exchange this is about. + */ + const char *exchange_url; + + /** + * Our bank wire account this is about. + */ + struct TALER_FullPayto payto_uri; + + /** + * Array of length @e limits_length with (exposed) limits that apply to the + * account. + */ + const struct TALER_EXCHANGE_AccountLimit *limits; + + /** + * Array of payto://-URIs with instructions for wire + * transfers to perform a KYC auth wire transfer for + * the given account. Needed if @e access_token is zero + * and @e limits are to be passed. + */ + struct TALER_FullPayto *payto_kycauths; + + /** + * Length of the @e limits array. + */ + unsigned int limits_length; + + /** + * Length of the @e payto_kycauths array. + */ + unsigned int pkycauth_length; + + /** + * HTTP status code returned by the exchange when we asked for + * information about the KYC status. + * 0 if there was no response at all. + */ + unsigned int exchange_http_status; + + /** + * Error code indicating errors the exchange + * returned, or #TALER_EC_NONE for none. + */ + enum TALER_ErrorCode exchange_code; + + /** + * Set to true if @e access_token was not given. + */ + bool no_access_token; + + /** + * Hash of the wire account this entry is about. + */ + struct TALER_MerchantWireHashP h_wire; + + /** + * KYC status string, or NULL if not provided. + */ + const char *status; + + /** + * Currency used by the exchange, or NULL if not provided. + */ + const char *exchange_currency; + + /** + * Set to true if the merchant backend could not + * get the exchanges ``/keys`` and thus could not + * determine default limits or determine an + * @e auth_conflict. + */ + bool no_keys; + + /** + * Set to true if the given account cannot do KYC at the given exchange + * because no wire method exists that could be used to do the KYC auth wire + * transfer. + */ + bool auth_conflict; + +}; + + +/** + * Response details for a KYC status request. + */ +struct TALER_MERCHANT_GetPrivateKycResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of KYC redirect details in @a kycs. + */ + unsigned int kycs_length; + + /** + * Array of KYC redirect details for accounts requiring KYC. + */ + const struct TALER_MERCHANT_GetPrivateKycRedirectDetail *kycs; + + } ok; + + } details; + +}; + + +#ifndef TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateKycCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE */ + +/** + * Callback for a KYC status request. + * + * @param cls closure + * @param kr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateKycCallback)( + TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateKycResponse *kr); + + +/** + * Start GET /private/kyc (or /management/instances/$INSTANCE/kyc) operation. + * + * @param[in,out] kyc operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_kyc_start ( + struct TALER_MERCHANT_GetPrivateKycHandle *kyc, + TALER_MERCHANT_GetPrivateKycCallback cb, + TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/kyc operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateKycCallback + * has been invoked (as in those cases it'll be called internally by + * the implementation already). + * + * @param[in] kyc operation to cancel + */ +void +TALER_MERCHANT_get_private_kyc_cancel ( + struct TALER_MERCHANT_GetPrivateKycHandle *kyc); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_KYC_H */ diff --git a/src/include/taler/merchant/get-private-orders-ORDER_ID.h b/src/include/taler/merchant/get-private-orders-ORDER_ID.h @@ -0,0 +1,569 @@ +/* + 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/merchant/get-private-orders-ORDER_ID.h + * @brief C interface for the GET /private/orders/$ORDER_ID endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_ORDERS_ORDER_ID_H +#define _TALER_MERCHANT__GET_PRIVATE_ORDERS_ORDER_ID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /private/orders/$ORDER_ID request. + */ +enum TALER_MERCHANT_GetPrivateOrderOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_END = 0, + + /** + * Session ID for repurchase detection. + */ + TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_SESSION_ID, + + /** + * Long polling timeout. + */ + TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TIMEOUT, + + /** + * If set to true, try to obtain the wire transfer status + * for this order from the exchange. + * @deprecated since protocol v6. + */ + TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TRANSFER, + + /** + * Long-poll ETag to suppress responses that have not changed. + * ShortHashCode value. + * @since protocol v25. + */ + TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_LP_NOT_ETAG, + + /** + * If true, refunded orders may be returned under + * "already_paid_order_id". + * @since protocol v9. + */ + TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE + +}; + + +/** + * Value for an option for the GET /private/orders/$ORDER_ID request. + */ +struct TALER_MERCHANT_GetPrivateOrderOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateOrderOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_SESSION_ID. + */ + const char *session_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TIMEOUT. + */ + struct GNUNET_TIME_Relative timeout; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TRANSFER. + */ + bool transfer; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_LP_NOT_ETAG. + */ + const struct GNUNET_ShortHashCode *lp_not_etag; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE. + */ + bool allow_refunded_for_repurchase; + + } details; + +}; + + +/** + * Handle for a GET /private/orders/$ORDER_ID request. + */ +struct TALER_MERCHANT_GetPrivateOrderHandle; + + +/** + * Set up GET /private/orders/$ORDER_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateOrderHandle * +TALER_MERCHANT_get_private_order_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateOrderOptionValue + */ +#define TALER_MERCHANT_get_private_order_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_END \ + } + +/** + * Set session ID for repurchase detection. + * + * @param s session ID to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue + */ +#define TALER_MERCHANT_get_private_order_option_session_id(s) \ + (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_SESSION_ID, \ + .details.session_id = (s) \ + } + +/** + * Set long polling timeout. + * + * @param t timeout to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue + */ +#define TALER_MERCHANT_get_private_order_option_timeout(t) \ + (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TIMEOUT, \ + .details.timeout = (t) \ + } + +/** + * Set transfer flag (try to obtain wire transfer status from exchange). + * @deprecated since protocol v6. + * + * @param b true to request wire transfer status + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue + */ +#define TALER_MERCHANT_get_private_order_option_transfer(b) \ + (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TRANSFER, \ + .details.transfer = (b) \ + } + +/** + * Set long-poll ETag to suppress unchanged responses. + * + * @param e pointer to the short hash code ETag + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue + */ +#define TALER_MERCHANT_get_private_order_option_lp_not_etag(e) \ + (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_LP_NOT_ETAG, \ + .details.lp_not_etag = (e) \ + } + +/** + * Set allow-refunded-for-repurchase flag. + * + * @param b true to allow refunded orders under already_paid_order_id + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue + */ +#define TALER_MERCHANT_get_private_order_option_allow_refunded_for_repurchase(b) \ + (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE, \ + .details.allow_refunded_for_repurchase = (b) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param oph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_order_set_options_ ( + struct TALER_MERCHANT_GetPrivateOrderHandle *oph, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateOrderOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_order_set_options ( + * oph, + * TALER_MERCHANT_get_private_order_option_session_id ("mysession")); + * + * @param oph the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_order_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_order_set_options(oph,...) \ + TALER_MERCHANT_get_private_order_set_options_ ( \ + oph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateOrderOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_get_private_order_option_end_ () } \ + )) + + +/** + * Order status code. + */ +enum TALER_MERCHANT_OrderStatusCode +{ + /** + * The order is unpaid. + */ + TALER_MERCHANT_OSC_UNPAID = 0, + + /** + * The order has been claimed by a wallet. + */ + TALER_MERCHANT_OSC_CLAIMED = 1, + + /** + * The order has been paid. + */ + TALER_MERCHANT_OSC_PAID = 2 +}; + + +/** + * Refund detail in a paid order (merchant view). + */ +struct TALER_MERCHANT_GetPrivateOrderRefundDetail +{ + + /** + * Human-readable reason given for the refund. + */ + const char *reason; + + /** + * Time when the refund was granted. + */ + struct GNUNET_TIME_Timestamp refund_time; + + /** + * Total amount that was refunded. + */ + struct TALER_Amount refund_amount; + + /** + * True if a refund is still available for the wallet + * for this payment. + */ + bool pending; + +}; + + +/** + * Response details for a GET /private/orders/$ORDER_ID request. + */ +struct TALER_MERCHANT_GetPrivateOrderResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Current status of the order. + */ + enum TALER_MERCHANT_OrderStatusCode status; + + /** + * Details depending on @a status. + */ + union + { + + /** + * Details when @a status is #TALER_MERCHANT_OSC_UNPAID. + */ + struct + { + + /** + * Order ID of a previously paid order that covers this one, + * or NULL if none. + */ + const char *already_paid_order_id; + + /** + * Fulfillment URL of an already paid order, or NULL. + */ + const char *already_paid_fulfillment_url; + + /** + * Taler pay URI for this order. + */ + const char *taler_pay_uri; + + /** + * Short summary of the order. + */ + const char *summary; + + /** + * Proto contract terms (contract terms without nonce). + * @since protocol v25. + */ + const json_t *proto_contract_terms; + + /** + * Status URL for the order. + */ + const char *order_status_url; + + /** + * Timestamp when the order was created. + */ + struct GNUNET_TIME_Timestamp creation_time; + + /** + * Deadline when the offer expires. + * @since protocol v21. + */ + struct GNUNET_TIME_Timestamp pay_deadline; + + } unpaid; + + /** + * Details when @a status is #TALER_MERCHANT_OSC_CLAIMED. + */ + struct + { + + /** + * Contract terms (JSON). + */ + const json_t *contract_terms; + + /** + * Status URL for the order. + * @since protocol v19. + */ + const char *order_status_url; + + } claimed; + + /** + * Details when @a status is #TALER_MERCHANT_OSC_PAID. + */ + struct + { + + /** + * True if a refund has been granted. + */ + bool refunded; + + /** + * True if a refund is still pending at the exchange. + */ + bool refund_pending; + + /** + * True if the payment has been wired to the merchant. + */ + bool wired; + + /** + * Total amount deposited. + */ + struct TALER_Amount deposit_total; + + /** + * Error code from the exchange, or TALER_EC_NONE. + */ + enum TALER_ErrorCode exchange_ec; + + /** + * HTTP status returned by the exchange. + */ + unsigned int exchange_hc; + + /** + * Total amount refunded. + */ + struct TALER_Amount refund_amount; + + /** + * Contract terms (JSON). + */ + const json_t *contract_terms; + + /** + * Number of wire transfers in @a wts. + */ + unsigned int wts_len; + + /** + * Array of wire transfer details. + */ + struct TALER_MERCHANT_WireTransfer *wts; + + /** + * Number of refund details in @a refunds. + */ + unsigned int refunds_len; + + /** + * Array of per-coin refund details. + */ + struct TALER_MERCHANT_GetPrivateOrderRefundDetail *refunds; + + /** + * Timestamp of the last payment. + */ + struct GNUNET_TIME_Timestamp last_payment; + + /** + * Status URL for the order. + */ + const char *order_status_url; + + /** + * Index of the selected choice within the choices array + * of contract terms, or -1 if not set. + * @since protocol v21. + */ + int choice_index; + + } paid; + + } details; + + } ok; + + } details; + +}; + + +#ifndef TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateOrderCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/orders/$ORDER_ID request. + * + * @param cls closure + * @param osr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateOrderCallback)( + TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateOrderResponse *osr); + + +/** + * Start GET /private/orders/$ORDER_ID operation. + * + * @param[in,out] oph operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_order_start ( + struct TALER_MERCHANT_GetPrivateOrderHandle *oph, + TALER_MERCHANT_GetPrivateOrderCallback cb, + TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/orders/$ORDER_ID operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateOrderCallback + * has been invoked (as in those cases it'll be called internally by + * the implementation already). + * + * @param[in] oph operation to cancel + */ +void +TALER_MERCHANT_get_private_order_cancel ( + struct TALER_MERCHANT_GetPrivateOrderHandle *oph); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_ORDERS_ORDER_ID_H */ diff --git a/src/include/taler/merchant/get-private-orders.h b/src/include/taler/merchant/get-private-orders.h @@ -0,0 +1,556 @@ +/* + 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/merchant/get-private-orders.h + * @brief C interface for the GET /private/orders endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_ORDERS_H +#define _TALER_MERCHANT__GET_PRIVATE_ORDERS_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /private/orders request. + */ +enum TALER_MERCHANT_GetPrivateOrdersOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_END = 0, + + /** + * Filter by paid status. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_PAID, + + /** + * Filter by refunded status. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_REFUNDED, + + /** + * Filter by wired status. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_WIRED, + + /** + * Return at most N values. Negative values + * to return before offset, positive to return after offset. + * Default is -20. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_LIMIT, + + /** + * Starting row_id for pagination. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_OFFSET, + + /** + * Date threshold for filtering. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_DATE, + + /** + * Long polling timeout. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_TIMEOUT, + + /** + * Filter by session ID. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SESSION_ID, + + /** + * Filter by fulfillment URL. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_FULFILLMENT_URL, + + /** + * Filter by summary text (case-insensitive substring match). + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SUMMARY_FILTER, + + /** + * Only return orders younger than the specified age. + * Only applicable if limit is positive. + * @since protocol v27. + */ + TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_MAX_AGE + +}; + + +/** + * Value for an option for the GET /private/orders request. + */ +struct TALER_MERCHANT_GetPrivateOrdersOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateOrdersOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_PAID. + */ + enum TALER_EXCHANGE_YesNoAll paid; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_REFUNDED. + */ + enum TALER_EXCHANGE_YesNoAll refunded; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_WIRED. + */ + enum TALER_EXCHANGE_YesNoAll wired; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_LIMIT. + */ + int64_t limit; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_OFFSET. + */ + uint64_t offset; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_DATE. + */ + struct GNUNET_TIME_Timestamp date; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_TIMEOUT. + */ + struct GNUNET_TIME_Relative timeout; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SESSION_ID. + */ + const char *session_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_FULFILLMENT_URL. + */ + const char *fulfillment_url; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SUMMARY_FILTER. + */ + const char *summary_filter; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_MAX_AGE. + */ + struct GNUNET_TIME_Relative max_age; + + } details; + +}; + + +/** + * Handle for a GET /private/orders request. + */ +struct TALER_MERCHANT_GetPrivateOrdersHandle; + + +/** + * Set up GET /private/orders operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateOrdersHandle * +TALER_MERCHANT_get_private_orders_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_END \ + } + +/** + * Set filter on paid status. + * + * @param p paid filter to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_paid(p) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_PAID, \ + .details.paid = (p) \ + } + +/** + * Set filter on refunded status. + * + * @param r refunded filter to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_refunded(r) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_REFUNDED, \ + .details.refunded = (r) \ + } + +/** + * Set filter on wired status. + * + * @param w wired filter to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_wired(w) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_WIRED, \ + .details.wired = (w) \ + } + +/** + * Set limit on the number of results to return. + * + * @param l limit on the number of results to return + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_limit(l) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_LIMIT, \ + .details.limit = (l) \ + } + +/** + * Set row offset from which to return results. + * + * @param o offset to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_offset(o) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_OFFSET, \ + .details.offset = (o) \ + } + +/** + * Set date threshold for filtering. + * + * @param d date threshold to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_date(d) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_DATE, \ + .details.date = (d) \ + } + +/** + * Set long polling timeout. + * + * @param t timeout to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_timeout(t) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_TIMEOUT, \ + .details.timeout = (t) \ + } + +/** + * Set session ID filter. + * + * @param s session ID to filter by + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_session_id(s) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SESSION_ID, \ + .details.session_id = (s) \ + } + +/** + * Set fulfillment URL filter. + * + * @param u fulfillment URL to filter by + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_fulfillment_url(u) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_FULFILLMENT_URL, \ + .details.fulfillment_url = (u) \ + } + +/** + * Set summary text filter. + * + * @param f summary filter string (case-insensitive substring match) + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_summary_filter(f) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SUMMARY_FILTER, \ + .details.summary_filter = (f) \ + } + +/** + * Set maximum age filter. Only return orders younger than the + * specified age. Only applicable if limit is positive. + * @since protocol v27. + * + * @param a maximum age as a relative time + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue + */ +#define TALER_MERCHANT_get_private_orders_option_max_age(a) \ + (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_MAX_AGE, \ + .details.max_age = (a) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param oph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_orders_set_options_ ( + struct TALER_MERCHANT_GetPrivateOrdersHandle *oph, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateOrdersOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_orders_set_options ( + * oph, + * TALER_MERCHANT_get_private_orders_option_paid ( + * TALER_EXCHANGE_YNA_YES), + * TALER_MERCHANT_get_private_orders_option_limit (-20)); + * + * @param oph the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_orders_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_orders_set_options(oph,...) \ + TALER_MERCHANT_get_private_orders_set_options_ ( \ + oph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateOrdersOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_get_private_orders_option_end_ () } \ + )) + + +/** + * Entry for one order in the GET /private/orders response. + */ +struct TALER_MERCHANT_GetPrivateOrdersOrderEntry +{ + + /** + * The order identifier string. + */ + const char *order_id; + + /** + * Timestamp when the order was created. + */ + struct GNUNET_TIME_Timestamp timestamp; + + /** + * Serial number of the order in the database. + */ + uint64_t order_serial; + + /** + * Total amount of the order. + */ + struct TALER_Amount amount; + + /** + * Amount refunded so far. + */ + struct TALER_Amount refund_amount; + + /** + * Amount still pending refund. + */ + struct TALER_Amount pending_refund_amount; + + /** + * Short summary of the order. + */ + const char *summary; + + /** + * True if refund is possible. + */ + bool refundable; + + /** + * True if the order has been paid. + */ + bool paid; + +}; + + +/** + * Response details for a GET /private/orders request. + */ +struct TALER_MERCHANT_GetPrivateOrdersResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of orders in @a orders. + */ + unsigned int orders_length; + + /** + * Array of order entries. + */ + const struct TALER_MERCHANT_GetPrivateOrdersOrderEntry *orders; + + } ok; + + } details; + +}; + + +#ifndef TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateOrdersCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/orders request. + * + * @param cls closure + * @param ogr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateOrdersCallback)( + TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateOrdersResponse *ogr); + + +/** + * Start GET /private/orders operation. + * + * @param[in,out] oph operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_orders_start ( + struct TALER_MERCHANT_GetPrivateOrdersHandle *oph, + TALER_MERCHANT_GetPrivateOrdersCallback cb, + TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/orders operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateOrdersCallback + * has been invoked (as in those cases it'll be called internally by + * the implementation already). + * + * @param[in] oph operation to cancel + */ +void +TALER_MERCHANT_get_private_orders_cancel ( + struct TALER_MERCHANT_GetPrivateOrdersHandle *oph); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_ORDERS_H */ diff --git a/src/include/taler/merchant/get-private-otp-devices-DEVICE_ID.h b/src/include/taler/merchant/get-private-otp-devices-DEVICE_ID.h @@ -0,0 +1,304 @@ +/* + 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/merchant/get-private-otp-devices-DEVICE_ID.h + * @brief C interface for GET /private/otp-devices/$DEVICE_ID of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_DEVICE_ID_H +#define _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_DEVICE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/otp-devices/$DEVICE_ID request. + */ +struct TALER_MERCHANT_GetPrivateOtpDeviceHandle; + + +/** + * Response details for a GET /private/otp-devices/$DEVICE_ID request. + */ +struct TALER_MERCHANT_GetPrivateOtpDeviceResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Human-readable description of the OTP device. + */ + const char *otp_device_description; + + /** + * Current counter value of the OTP device (for HOTP). + */ + uint64_t otp_ctr; + + /** + * Current timestamp in seconds (for TOTP). + */ + uint64_t otp_timestamp_s; + + /** + * POS confirmation text with OTP codes that + * would be returned for a purchase over the + * amount given in the query for the respective + * time and algorithm. NULL if the confirmation + * could not be computed based on the query and + * OTP algorithm. + */ + const char *otp_code; + + /** + * OTP algorithm used. + */ + enum TALER_MerchantConfirmationAlgorithm otp_alg; + + } ok; + + } details; + +}; + + +/** + * Possible options we can set for the GET /private/otp-devices/$DEVICE_ID request. + */ +enum TALER_MERCHANT_GetPrivateOtpDeviceOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_END = 0, + + /** + * Set a fake time for OTP code computation. + */ + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_FAKETIME, + + /** + * Set a price amount for OTP code computation. + */ + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_PRICE + +}; + + +/** + * Value for an option for the GET /private/otp-devices/$DEVICE_ID request. + */ +struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateOtpDeviceOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_FAKETIME. + */ + struct GNUNET_TIME_Timestamp faketime; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_PRICE. + */ + struct TALER_Amount price; + + } details; + +}; + + +/** + * Set up GET /private/otp-devices/$DEVICE_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param otp_device_id identifier of the OTP device to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateOtpDeviceHandle * +TALER_MERCHANT_get_private_otp_device_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *otp_device_id); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue + */ +#define TALER_MERCHANT_get_private_otp_device_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_END \ + } + +/** + * Set a fake time for OTP code computation. + * + * @param t the timestamp to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue + */ +#define TALER_MERCHANT_get_private_otp_device_option_faketime(t) \ + (const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_FAKETIME, \ + .details.faketime = (t) \ + } + +/** + * Set a price amount for OTP code computation. + * + * @param a the amount to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue + */ +#define TALER_MERCHANT_get_private_otp_device_option_price(a) \ + (const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_PRICE, \ + .details.price = (a) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param god the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_otp_device_set_options_ ( + struct TALER_MERCHANT_GetPrivateOtpDeviceHandle *god, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_otp_device_set_options ( + * god, + * TALER_MERCHANT_get_private_otp_device_option_faketime (ts), + * TALER_MERCHANT_get_private_otp_device_option_price (amount)); + * + * @param god the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_otp_device_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_otp_device_set_options(god,...) \ + TALER_MERCHANT_get_private_otp_device_set_options_ ( \ + god, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_get_private_otp_device_option_end_ () } \ + )) + + +#ifndef TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateOtpDeviceCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/otp-devices/$DEVICE_ID request. + * + * @param cls closure + * @param ogr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateOtpDeviceCallback)( + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateOtpDeviceResponse *ogr); + + +/** + * Start GET /private/otp-devices/$DEVICE_ID operation. + * + * @param[in,out] god operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_otp_device_start ( + struct TALER_MERCHANT_GetPrivateOtpDeviceHandle *god, + TALER_MERCHANT_GetPrivateOtpDeviceCallback cb, + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/otp-devices/$DEVICE_ID operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateOtpDeviceCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] god operation to cancel + */ +void +TALER_MERCHANT_get_private_otp_device_cancel ( + struct TALER_MERCHANT_GetPrivateOtpDeviceHandle *god); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_DEVICE_ID_H */ diff --git a/src/include/taler/merchant/get-private-otp-devices.h b/src/include/taler/merchant/get-private-otp-devices.h @@ -0,0 +1,157 @@ +/* + 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/merchant/get-private-otp-devices.h + * @brief C interface for the GET /private/otp-devices endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_H +#define _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/otp-devices request. + */ +struct TALER_MERCHANT_GetPrivateOtpDevicesHandle; + + +/** + * Entry for one OTP device. + */ +struct TALER_MERCHANT_GetPrivateOtpDevicesOtpDeviceEntry +{ + + /** + * Identifier of the OTP device. + */ + const char *otp_device_id; + + /** + * Human-readable description of the OTP device. + */ + const char *otp_device_description; + +}; + + +/** + * Response details for a GET /private/otp-devices request. + */ +struct TALER_MERCHANT_GetPrivateOtpDevicesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of OTP devices in @a otp_devices. + */ + unsigned int otp_devices_length; + + /** + * Array of OTP device entries. + */ + const struct TALER_MERCHANT_GetPrivateOtpDevicesOtpDeviceEntry * + otp_devices; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/otp-devices operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateOtpDevicesHandle * +TALER_MERCHANT_get_private_otp_devices_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateOtpDevicesCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/otp-devices request. + * + * @param cls closure + * @param ogr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateOtpDevicesCallback)( + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateOtpDevicesResponse *ogr); + + +/** + * Start GET /private/otp-devices operation. + * + * @param[in,out] gpoh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_otp_devices_start ( + struct TALER_MERCHANT_GetPrivateOtpDevicesHandle *gpoh, + TALER_MERCHANT_GetPrivateOtpDevicesCallback cb, + TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/otp-devices operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateOtpDevicesCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpoh operation to cancel + */ +void +TALER_MERCHANT_get_private_otp_devices_cancel ( + struct TALER_MERCHANT_GetPrivateOtpDevicesHandle *gpoh); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_H */ diff --git a/src/include/taler/merchant/get-private-products-PRODUCT_ID.h b/src/include/taler/merchant/get-private-products-PRODUCT_ID.h @@ -0,0 +1,246 @@ +/* + 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/merchant/get-private-products-PRODUCT_ID.h + * @brief C interface for GET /private/products/$PRODUCT_ID of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_PRODUCT_ID_H +#define _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_PRODUCT_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/products/$PRODUCT_ID request. + */ +struct TALER_MERCHANT_GetPrivateProductHandle; + + +/** + * Response details for a GET /private/products/$PRODUCT_ID request. + */ +struct TALER_MERCHANT_GetPrivateProductResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Human-readable product name. + */ + const char *product_name; + + /** + * Human-readable product description. + */ + const char *description; + + /** + * Internationalized descriptions (JSON object), or NULL. + */ + const json_t *description_i18n; + + /** + * Unit of measurement for this product. + */ + const char *unit; + + /** + * Number of prices in @a unit_price. + */ + size_t unit_price_len; + + /** + * Array of unit prices (for different payment options). + */ + const struct TALER_Amount *unit_price; + + /** + * Single unit price (first element of @a unit_price, for backwards compatibility). + */ + struct TALER_Amount price; + + /** + * Base64-encoded product image, or empty string. + */ + const char *image; + + /** + * Tax information (JSON array), or NULL. + */ + const json_t *taxes; + + /** + * Total available stock (-1 for unlimited). + */ + int64_t total_stock; + + /** + * Total stock in fractional unit representation. + * Stock level encoded as a decimal string. Preferred source of truth for fractional stock. + */ + const char *unit_total_stock; + + /** + * Whether fractional quantities are allowed. + */ + bool unit_allow_fraction; + + /** + * Precision level for fractional quantities. + */ + uint32_t unit_precision_level; + + /** + * Total number of units sold. + */ + uint64_t total_sold; + + /** + * Total number of units lost/expired. + */ + uint64_t total_lost; + + /** + * Storage location (JSON), or NULL. + */ + const json_t *location; + + /** + * Expected time of next restock (may be zero if unknown). + */ + struct GNUNET_TIME_Timestamp next_restock; + + /** + * Number of categories in @a categories. + */ + unsigned int categories_len; + + /** + * Array of category IDs this product belongs to. + */ + const uint64_t *categories; + + /** + * Product group ID (0 if not set). + */ + uint64_t product_group_id; + + /** + * Money pot ID (0 if not set). + */ + uint64_t money_pot_id; + + /** + * Whether the price is net (excluding taxes). + */ + bool price_is_net; + + /** + * Minimum age required to purchase this product (0 if not set). + */ + uint16_t minimum_age; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/products/$PRODUCT_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param product_id identifier of the product to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateProductHandle * +TALER_MERCHANT_get_private_product_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *product_id); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateProductCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/products/$PRODUCT_ID request. + * + * @param cls closure + * @param pgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateProductCallback)( + TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateProductResponse *pgr); + + +/** + * Start GET /private/products/$PRODUCT_ID operation. + * + * @param[in,out] gpp operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_product_start ( + struct TALER_MERCHANT_GetPrivateProductHandle *gpp, + TALER_MERCHANT_GetPrivateProductCallback cb, + TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/products/$PRODUCT_ID operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateProductCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpp operation to cancel + */ +void +TALER_MERCHANT_get_private_product_cancel ( + struct TALER_MERCHANT_GetPrivateProductHandle *gpp); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_PRODUCT_ID_H */ diff --git a/src/include/taler/merchant/get-private-products.h b/src/include/taler/merchant/get-private-products.h @@ -0,0 +1,401 @@ +/* + 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/merchant/get-private-products.h + * @brief C interface for the GET /private/products endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_H +#define _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /private/products request. + */ +enum TALER_MERCHANT_GetPrivateProductsOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_END = 0, + + /** + * Return at most N values. Negative for descending by row ID, + * positive for ascending by row ID. Default is 20. + * @since protocol v12. + */ + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_LIMIT, + + /** + * Starting product_serial_id for pagination. + * @since protocol v12. + */ + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_OFFSET, + + /** + * Filter by category name (case-insensitive substring match). + * @since protocol v23. + */ + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_CATEGORY_FILTER, + + /** + * Filter by product name (case-insensitive substring match). + * @since protocol v23. + */ + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_NAME_FILTER, + + /** + * Filter by product description (case-insensitive substring match). + * @since protocol v23. + */ + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_FILTER, + + /** + * Filter by product group serial. + * @since protocol v25. + */ + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_SERIAL + +}; + + +/** + * Value for an option for the GET /private/products request. + */ +struct TALER_MERCHANT_GetPrivateProductsOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateProductsOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_LIMIT. + */ + int64_t limit; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_OFFSET. + */ + uint64_t offset; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_CATEGORY_FILTER. + */ + const char *category_filter; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_NAME_FILTER. + */ + const char *name_filter; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_FILTER. + */ + const char *description_filter; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_SERIAL. + */ + uint64_t product_group_serial; + + } details; + +}; + + +/** + * Handle for a GET /private/products request. + */ +struct TALER_MERCHANT_GetPrivateProductsHandle; + + +/** + * Inventory entry for the GET /private/products response. + */ +struct TALER_MERCHANT_GetPrivateProductsInventoryEntry +{ + + /** + * Identifier of the product. + */ + const char *product_id; + + /** + * Serial ID of the product. + */ + uint64_t product_serial; + +}; + + +/** + * Response details for a GET /private/products request. + */ +struct TALER_MERCHANT_GetPrivateProductsResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of products in @a products. + */ + unsigned int products_length; + + /** + * Array of product entries. + */ + const struct TALER_MERCHANT_GetPrivateProductsInventoryEntry *products; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/products operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateProductsHandle * +TALER_MERCHANT_get_private_products_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateProductsOptionValue + */ +#define TALER_MERCHANT_get_private_products_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_END \ + } + +/** + * Set limit on the number of results to return. + * + * @param l limit on the number of results to return + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue + */ +#define TALER_MERCHANT_get_private_products_option_limit(l) \ + (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_LIMIT, \ + .details.limit = (l) \ + } + +/** + * Set row offset from which to return results. + * + * @param o offset to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue + */ +#define TALER_MERCHANT_get_private_products_option_offset(o) \ + (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_OFFSET, \ + .details.offset = (o) \ + } + +/** + * Set category name filter (case-insensitive substring match). + * + * @param f category filter string + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue + */ +#define TALER_MERCHANT_get_private_products_option_category_filter(f) \ + (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_CATEGORY_FILTER, \ + .details.category_filter = (f) \ + } + +/** + * Set product name filter (case-insensitive substring match). + * + * @param f name filter string + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue + */ +#define TALER_MERCHANT_get_private_products_option_name_filter(f) \ + (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_NAME_FILTER, \ + .details.name_filter = (f) \ + } + +/** + * Set product description filter (case-insensitive substring match). + * + * @param f description filter string + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue + */ +#define TALER_MERCHANT_get_private_products_option_description_filter(f) \ + (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_FILTER, \ + .details.description_filter = (f) \ + } + +/** + * Set product group serial filter. + * + * @param s product group serial to filter by + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue + */ +#define TALER_MERCHANT_get_private_products_option_product_group_serial(s) \ + (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_SERIAL, \ + .details.product_group_serial = (s) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param gpph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_products_set_options_ ( + struct TALER_MERCHANT_GetPrivateProductsHandle *gpph, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateProductsOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_products_set_options ( + * gpph, + * TALER_MERCHANT_get_private_products_option_limit (20), + * TALER_MERCHANT_get_private_products_option_name_filter ("widget")); + * + * @param gpph the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_products_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_products_set_options(gpph,...) \ + TALER_MERCHANT_get_private_products_set_options_ ( \ + gpph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateProductsOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_get_private_products_option_end_ () } \ + )) + + +#ifndef TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateProductsCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/products request. + * + * @param cls closure + * @param pgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateProductsCallback)( + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateProductsResponse *pgr); + + +/** + * Start GET /private/products operation. + * + * @param[in,out] gpph operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_products_start ( + struct TALER_MERCHANT_GetPrivateProductsHandle *gpph, + TALER_MERCHANT_GetPrivateProductsCallback cb, + TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/products operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateProductsCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpph operation to cancel + */ +void +TALER_MERCHANT_get_private_products_cancel ( + struct TALER_MERCHANT_GetPrivateProductsHandle *gpph); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_H */ diff --git a/src/include/taler/merchant/get-private-statistics-amount-SLUG.h b/src/include/taler/merchant/get-private-statistics-amount-SLUG.h @@ -0,0 +1,342 @@ +/* + 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/merchant/get-private-statistics-amount-SLUG.h + * @brief C interface for the GET /private/statistics-amount/$SLUG endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_STATISTICS_AMOUNT_SLUG_H +#define _TALER_MERCHANT__GET_PRIVATE_STATISTICS_AMOUNT_SLUG_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /private/statistics-amount/$SLUG request. + */ +enum TALER_MERCHANT_GetPrivateStatisticsAmountOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_END = 0, + + /** + * Aggregation mode to request (BUCKET, INTERVAL, or ANY). + */ + TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_TYPE + +}; + + +/** + * Value for an option for the GET /private/statistics-amount/$SLUG request. + */ +struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateStatisticsAmountOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_TYPE. + */ + enum TALER_MERCHANT_StatisticsType type; + + } details; + +}; + + +/** + * Handle for a GET /private/statistics-amount/$SLUG request. + */ +struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle; + + +/** + * Set up GET /private/statistics-amount/$SLUG operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param slug statistics slug to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle * +TALER_MERCHANT_get_private_statistics_amount_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *slug); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue + */ +#define TALER_MERCHANT_get_private_statistics_amount_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_END \ + } + +/** + * Set aggregation mode type. + * + * @param t aggregation mode to request + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue + */ +#define TALER_MERCHANT_get_private_statistics_amount_option_type(t) \ + (const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_TYPE, \ + .details.type = (t) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param sah the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_statistics_amount_set_options_ ( + struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle *sah, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_statistics_amount_set_options ( + * sah, + * TALER_MERCHANT_get_private_statistics_amount_option_type ( + * TALER_MERCHANT_STATISTICS_TYPE_BUCKET)); + * + * @param sah the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_statistics_amount_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_statistics_amount_set_options(sah,...) \ + TALER_MERCHANT_get_private_statistics_amount_set_options_ ( \ + sah, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue[]) \ + {__VA_ARGS__, \ + TALER_MERCHANT_get_private_statistics_amount_option_end_ () } \ + )) + + +/** + * Statistic amount aggregated by bucket. + */ +struct TALER_MERCHANT_GetPrivateStatisticsAmountByBucket +{ + + /** + * Start time of the bucket (inclusive). + */ + struct GNUNET_TIME_Timestamp start_time; + + /** + * End time of the bucket (exclusive). + */ + struct GNUNET_TIME_Timestamp end_time; + + /** + * Range of the bucket. + */ + const char *range; + + /** + * Sum of all amounts falling under the given + * SLUG within this timeframe. + */ + struct TALER_Amount *cumulative_amounts; + + /** + * Length of array @a cumulative_amounts. + */ + unsigned int cumulative_amount_len; + +}; + + +/** + * Statistic amount aggregated by interval. + */ +struct TALER_MERCHANT_GetPrivateStatisticsAmountByInterval +{ + + /** + * Start time of the interval (inclusive). + * The interval always ends at the response + * generation time. + */ + struct GNUNET_TIME_Timestamp start_time; + + /** + * Sum of all amounts falling under the given + * SLUG within this timeframe. + */ + struct TALER_Amount *cumulative_amounts; + + /** + * Length of array @a cumulative_amounts. + */ + unsigned int cumulative_amount_len; + +}; + + +/** + * Response details for a GET /private/statistics-amount/$SLUG request. + */ +struct TALER_MERCHANT_GetPrivateStatisticsAmountResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of bucket entries in @a buckets. + */ + unsigned int buckets_length; + + /** + * Array of amount statistics per bucket. + */ + const struct TALER_MERCHANT_GetPrivateStatisticsAmountByBucket *buckets; + + /** + * Description of the bucket aggregation scheme, or NULL. + */ + const char *buckets_description; + + /** + * Number of interval entries in @a intervals. + */ + unsigned int intervals_length; + + /** + * Array of amount statistics per time interval. + */ + const struct TALER_MERCHANT_GetPrivateStatisticsAmountByInterval * + intervals; + + /** + * Description of the interval aggregation scheme, or NULL. + */ + const char *intervals_description; + + } ok; + + } details; + +}; + + +#ifndef TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateStatisticsAmountCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/statistics-amount/$SLUG request. + * + * @param cls closure + * @param sagr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateStatisticsAmountCallback)( + TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateStatisticsAmountResponse *sagr); + + +/** + * Start GET /private/statistics-amount/$SLUG operation. + * + * @param[in,out] sah operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_statistics_amount_start ( + struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle *sah, + TALER_MERCHANT_GetPrivateStatisticsAmountCallback cb, + TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/statistics-amount/$SLUG operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateStatisticsAmountCallback has been invoked + * (as in those cases it'll be called internally by the implementation + * already). + * + * @param[in] sah operation to cancel + */ +void +TALER_MERCHANT_get_private_statistics_amount_cancel ( + struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle *sah); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_STATISTICS_AMOUNT_SLUG_H */ diff --git a/src/include/taler/merchant/get-private-statistics-counter-SLUG.h b/src/include/taler/merchant/get-private-statistics-counter-SLUG.h @@ -0,0 +1,333 @@ +/* + 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/merchant/get-private-statistics-counter-SLUG.h + * @brief C interface for the GET /private/statistics-counter/$SLUG endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_STATISTICS_COUNTER_SLUG_H +#define _TALER_MERCHANT__GET_PRIVATE_STATISTICS_COUNTER_SLUG_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /private/statistics-counter/$SLUG request. + */ +enum TALER_MERCHANT_GetPrivateStatisticsCounterOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_END = 0, + + /** + * Aggregation mode to request (BUCKET, INTERVAL, or ANY). + */ + TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_TYPE + +}; + + +/** + * Value for an option for the GET /private/statistics-counter/$SLUG request. + */ +struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateStatisticsCounterOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_TYPE. + */ + enum TALER_MERCHANT_StatisticsType type; + + } details; + +}; + + +/** + * Handle for a GET /private/statistics-counter/$SLUG request. + */ +struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle; + + +/** + * Set up GET /private/statistics-counter/$SLUG operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param slug statistics slug to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle * +TALER_MERCHANT_get_private_statistics_counter_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *slug); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue + */ +#define TALER_MERCHANT_get_private_statistics_counter_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_END \ + } + +/** + * Set aggregation mode type. + * + * @param t aggregation mode to request + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue + */ +#define TALER_MERCHANT_get_private_statistics_counter_option_type(t) \ + (const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_TYPE, \ + .details.type = (t) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param sch the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_statistics_counter_set_options_ ( + struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle *sch, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_statistics_counter_set_options ( + * sch, + * TALER_MERCHANT_get_private_statistics_counter_option_type ( + * TALER_MERCHANT_STATISTICS_TYPE_INTERVAL)); + * + * @param sch the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_statistics_counter_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_statistics_counter_set_options(sch,...) \ + TALER_MERCHANT_get_private_statistics_counter_set_options_ ( \ + sch, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue[] \ + ) \ + {__VA_ARGS__, \ + TALER_MERCHANT_get_private_statistics_counter_option_end_ () } \ + )) + + +/** + * Statistic counter aggregated by bucket. + */ +struct TALER_MERCHANT_GetPrivateStatisticsCounterByBucket +{ + + /** + * Start time of the bucket (inclusive). + */ + struct GNUNET_TIME_Timestamp start_time; + + /** + * End time of the bucket (exclusive). + */ + struct GNUNET_TIME_Timestamp end_time; + + /** + * Range of the bucket. + */ + const char *range; + + /** + * Sum of all counters falling under the given + * SLUG within this timeframe. + */ + uint64_t cumulative_counter; + +}; + + +/** + * Statistic counter aggregated by interval. + */ +struct TALER_MERCHANT_GetPrivateStatisticsCounterByInterval +{ + + /** + * Start time of the interval (inclusive). + * The interval always ends at the response + * generation time. + */ + struct GNUNET_TIME_Timestamp start_time; + + /** + * Sum of all counters falling under the given + * SLUG within this timeframe. + */ + uint64_t cumulative_counter; + +}; + + +/** + * Response details for a GET /private/statistics-counter/$SLUG request. + */ +struct TALER_MERCHANT_GetPrivateStatisticsCounterResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of bucket entries in @a buckets. + */ + unsigned int buckets_length; + + /** + * Array of counter statistics per bucket. + */ + const struct TALER_MERCHANT_GetPrivateStatisticsCounterByBucket *buckets; + + /** + * Description of the bucket aggregation scheme, or NULL. + */ + const char *buckets_description; + + /** + * Number of interval entries in @a intervals. + */ + unsigned int intervals_length; + + /** + * Array of counter statistics per time interval. + */ + const struct TALER_MERCHANT_GetPrivateStatisticsCounterByInterval * + intervals; + + /** + * Description of the interval aggregation scheme, or NULL. + */ + const char *intervals_description; + + } ok; + + } details; + +}; + + +#ifndef TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateStatisticsCounterCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/statistics-counter/$SLUG request. + * + * @param cls closure + * @param scgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateStatisticsCounterCallback)( + TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateStatisticsCounterResponse *scgr); + + +/** + * Start GET /private/statistics-counter/$SLUG operation. + * + * @param[in,out] sch operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_statistics_counter_start ( + struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle *sch, + TALER_MERCHANT_GetPrivateStatisticsCounterCallback cb, + TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/statistics-counter/$SLUG operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateStatisticsCounterCallback has been invoked + * (as in those cases it'll be called internally by the implementation + * already). + * + * @param[in] sch operation to cancel + */ +void +TALER_MERCHANT_get_private_statistics_counter_cancel ( + struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle *sch); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_STATISTICS_COUNTER_SLUG_H */ diff --git a/src/include/taler/merchant/get-private-templates-TEMPLATE_ID.h b/src/include/taler/merchant/get-private-templates-TEMPLATE_ID.h @@ -0,0 +1,155 @@ +/* + 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/merchant/get-private-templates-TEMPLATE_ID.h + * @brief C interface for GET /private/templates/$TEMPLATE_ID of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H +#define _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_GetPrivateTemplateHandle; + + +/** + * Response details for a GET /private/templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_GetPrivateTemplateResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Human-readable description of the template. + */ + const char *template_description; + + /** + * OTP device ID associated with this template, or NULL. + */ + const char *otp_id; + + /** + * Template contract (JSON). + */ + const json_t *template_contract; + + /** + * Editable defaults (JSON), or NULL if not set. + */ + const json_t *editable_defaults; + + /** + * Required currency, or NULL if not set. + */ + const char *required_currency; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/templates/$TEMPLATE_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param template_id identifier of the template to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateTemplateHandle * +TALER_MERCHANT_get_private_template_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *template_id); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateTemplateCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/templates/$TEMPLATE_ID request. + * + * @param cls closure + * @param tgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateTemplateCallback)( + TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateTemplateResponse *tgr); + + +/** + * Start GET /private/templates/$TEMPLATE_ID operation. + * + * @param[in,out] gpt operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_template_start ( + struct TALER_MERCHANT_GetPrivateTemplateHandle *gpt, + TALER_MERCHANT_GetPrivateTemplateCallback cb, + TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/templates/$TEMPLATE_ID operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateTemplateCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpt operation to cancel + */ +void +TALER_MERCHANT_get_private_template_cancel ( + struct TALER_MERCHANT_GetPrivateTemplateHandle *gpt); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/merchant/get-private-templates.h b/src/include/taler/merchant/get-private-templates.h @@ -0,0 +1,156 @@ +/* + 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/merchant/get-private-templates.h + * @brief C interface for the GET /private/templates endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_H +#define _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/templates request. + */ +struct TALER_MERCHANT_GetPrivateTemplatesHandle; + + +/** + * Entry for one order template. + */ +struct TALER_MERCHANT_GetPrivateTemplatesTemplateEntry +{ + + /** + * Identifier of the template. + */ + const char *template_id; + + /** + * Human-readable description of the template. + */ + const char *template_description; + +}; + + +/** + * Response details for a GET /private/templates request. + */ +struct TALER_MERCHANT_GetPrivateTemplatesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of templates in @a templates. + */ + unsigned int templates_length; + + /** + * Array of template entries. + */ + const struct TALER_MERCHANT_GetPrivateTemplatesTemplateEntry *templates; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/templates operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateTemplatesHandle * +TALER_MERCHANT_get_private_templates_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateTemplatesCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/templates request. + * + * @param cls closure + * @param tgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateTemplatesCallback)( + TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateTemplatesResponse *tgr); + + +/** + * Start GET /private/templates operation. + * + * @param[in,out] gpth operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_templates_start ( + struct TALER_MERCHANT_GetPrivateTemplatesHandle *gpth, + TALER_MERCHANT_GetPrivateTemplatesCallback cb, + TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/templates operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateTemplatesCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpth operation to cancel + */ +void +TALER_MERCHANT_get_private_templates_cancel ( + struct TALER_MERCHANT_GetPrivateTemplatesHandle *gpth); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_H */ diff --git a/src/include/taler/merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h b/src/include/taler/merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h @@ -0,0 +1,196 @@ +/* + 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/merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h + * @brief C interface for GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG + * of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_TOKENFAMILIES_TOKEN_FAMILY_SLUG_H +#define _TALER_MERCHANT__GET_PRIVATE_TOKENFAMILIES_TOKEN_FAMILY_SLUG_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG request. + */ +struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle; + + +/** + * Response details for a GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG request. + */ +struct TALER_MERCHANT_GetPrivateTokenfamiliesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * URL-safe slug identifier of the token family. + */ + const char *slug; + + /** + * Human-readable name. + */ + const char *name; + + /** + * Human-readable description. + */ + const char *description; + + /** + * Internationalized descriptions (JSON), or NULL. + */ + const json_t *description_i18n; + + /** + * Extra data associated with this token family (JSON), or NULL. + */ + const json_t *extra_data; + + /** + * Start of validity period. + */ + struct GNUNET_TIME_Timestamp valid_after; + + /** + * End of validity period. + */ + struct GNUNET_TIME_Timestamp valid_before; + + /** + * Duration of individual token validity. + */ + struct GNUNET_TIME_Relative duration; + + /** + * Granularity for validity period alignment. + */ + struct GNUNET_TIME_Relative validity_granularity; + + /** + * Offset from purchase time to start of validity. + */ + struct GNUNET_TIME_Relative start_offset; + + /** + * Kind of token family ("subscription" or "discount"). + */ + const char *kind; + + /** + * Total number of tokens issued. + */ + uint64_t issued; + + /** + * Total number of tokens used. + */ + uint64_t used; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param token_family_slug slug of the token family to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle * +TALER_MERCHANT_get_private_tokenfamilies_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *token_family_slug); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateTokenfamiliesCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG request. + * + * @param cls closure + * @param tfgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateTokenfamiliesCallback)( + TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateTokenfamiliesResponse *tfgr); + + +/** + * Start GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG operation. + * + * @param[in,out] gptf operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_tokenfamilies_start ( + struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle *gptf, + TALER_MERCHANT_GetPrivateTokenfamiliesCallback cb, + TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG operation. + * This function must not be called by clients after the + * TALER_MERCHANT_GetPrivateTokenfamiliesCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gptf operation to cancel + */ +void +TALER_MERCHANT_get_private_tokenfamilies_cancel ( + struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle *gptf); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_TOKENFAMILIES_TOKEN_FAMILY_SLUG_H */ diff --git a/src/include/taler/merchant/get-private-transfers.h b/src/include/taler/merchant/get-private-transfers.h @@ -0,0 +1,429 @@ +/* + 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/merchant/get-private-transfers.h + * @brief C interface for the GET /private/transfers endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_TRANSFERS_H +#define _TALER_MERCHANT__GET_PRIVATE_TRANSFERS_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the GET /private/transfers request. + */ +enum TALER_MERCHANT_GetPrivateTransfersOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_END = 0, + + /** + * Filter by payto URI. + */ + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_PAYTO_URI, + + /** + * Filter for transfers before this time. + */ + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_BEFORE, + + /** + * Filter for transfers after this time. + */ + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_AFTER, + + /** + * Return at most N values. Negative values + * to return in descending order, positive for ascending. + * Default is -20. + */ + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_LIMIT, + + /** + * Starting transfer_serial_id for pagination. + */ + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_OFFSET, + + /** + * Filter by verification/expected status. + */ + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_EXPECTED + +}; + + +/** + * Value for an option for the GET /private/transfers request. + */ +struct TALER_MERCHANT_GetPrivateTransfersOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_GetPrivateTransfersOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_PAYTO_URI. + */ + struct TALER_FullPayto payto_uri; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_BEFORE. + */ + struct GNUNET_TIME_Timestamp before; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_AFTER. + */ + struct GNUNET_TIME_Timestamp after; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_LIMIT. + */ + int64_t limit; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_OFFSET. + */ + uint64_t offset; + + /** + * Value if @e option is + * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_EXPECTED. + */ + enum TALER_EXCHANGE_YesNoAll expected; + + } details; + +}; + + +/** + * Handle for a GET /private/transfers request. + */ +struct TALER_MERCHANT_GetPrivateTransfersHandle; + + +/** + * Set up GET /private/transfers operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateTransfersHandle * +TALER_MERCHANT_get_private_transfers_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_GetPrivateTransfersOptionValue + */ +#define TALER_MERCHANT_get_private_transfers_option_end_() \ + (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_END \ + } + +/** + * Set payto URI filter. + * + * @param p payto URI to filter by + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue + */ +#define TALER_MERCHANT_get_private_transfers_option_payto_uri(p) \ + (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_PAYTO_URI, \ + .details.payto_uri = (p) \ + } + +/** + * Set filter for transfers before the given timestamp. + * + * @param t timestamp threshold + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue + */ +#define TALER_MERCHANT_get_private_transfers_option_before(t) \ + (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_BEFORE, \ + .details.before = (t) \ + } + +/** + * Set filter for transfers after the given timestamp. + * + * @param t timestamp threshold + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue + */ +#define TALER_MERCHANT_get_private_transfers_option_after(t) \ + (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_AFTER, \ + .details.after = (t) \ + } + +/** + * Set limit on the number of results to return. + * + * @param l limit on the number of results to return + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue + */ +#define TALER_MERCHANT_get_private_transfers_option_limit(l) \ + (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_LIMIT, \ + .details.limit = (l) \ + } + +/** + * Set row offset from which to return results. + * + * @param o offset to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue + */ +#define TALER_MERCHANT_get_private_transfers_option_offset(o) \ + (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_OFFSET, \ + .details.offset = (o) \ + } + +/** + * Set filter on expected/verified status. + * + * @param e expected filter to use + * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue + */ +#define TALER_MERCHANT_get_private_transfers_option_expected(e) \ + (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ + { \ + .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_EXPECTED, \ + .details.expected = (e) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param gth the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_get_private_transfers_set_options_ ( + struct TALER_MERCHANT_GetPrivateTransfersHandle *gth, + unsigned int num_options, + const struct TALER_MERCHANT_GetPrivateTransfersOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_get_private_transfers_set_options ( + * gth, + * TALER_MERCHANT_get_private_transfers_option_limit (-20), + * TALER_MERCHANT_get_private_transfers_option_expected ( + * TALER_EXCHANGE_YNA_YES)); + * + * @param gth the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_get_private_transfers_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_get_private_transfers_set_options(gth,...) \ + TALER_MERCHANT_get_private_transfers_set_options_ ( \ + gth, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_GetPrivateTransfersOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_get_private_transfers_option_end_ () } \ + )) + + +/** + * Transfer data entry. + */ +struct TALER_MERCHANT_GetPrivateTransfersTransferData +{ + + /** + * Total amount wired by the exchange (without wire fee). + */ + struct TALER_Amount credit_amount; + + /** + * Wire transfer identifier used. + */ + struct TALER_WireTransferIdentifierRawP wtid; + + /** + * URI of the target account. + */ + struct TALER_FullPayto payto_uri; + + /** + * URL of the exchange that made the transfer. + */ + const char *exchange_url; + + /** + * Serial number of the credit operation in the merchant backend. + */ + uint64_t transfer_serial_id; + + /** + * Time of the wire transfer, based on when we received + * a confirmation for the wire transfer. + */ + struct GNUNET_TIME_Timestamp execution_time; + + /** + * Serial number of the expected transfer in the merchant backend, + * or 0 if not known. + */ + uint64_t expected_transfer_serial_id; + + /** + * True if this wire transfer was expected. + */ + bool expected; + +}; + + +/** + * Response details for a GET /private/transfers request. + */ +struct TALER_MERCHANT_GetPrivateTransfersResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of transfers in @a transfers. + */ + unsigned int transfers_length; + + /** + * Array of transfer data entries. + */ + const struct TALER_MERCHANT_GetPrivateTransfersTransferData *transfers; + + } ok; + + } details; + +}; + + +#ifndef TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateTransfersCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/transfers request. + * + * @param cls closure + * @param gtr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateTransfersCallback)( + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateTransfersResponse *gtr); + + +/** + * Start GET /private/transfers operation. + * + * @param[in,out] gth operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_transfers_start ( + struct TALER_MERCHANT_GetPrivateTransfersHandle *gth, + TALER_MERCHANT_GetPrivateTransfersCallback cb, + TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/transfers operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateTransfersCallback + * has been invoked (as in those cases it'll be called internally by + * the implementation already). + * + * @param[in] gth operation to cancel + */ +void +TALER_MERCHANT_get_private_transfers_cancel ( + struct TALER_MERCHANT_GetPrivateTransfersHandle *gth); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_TRANSFERS_H */ diff --git a/src/include/taler/merchant/get-private-units-UNIT.h b/src/include/taler/merchant/get-private-units-UNIT.h @@ -0,0 +1,135 @@ +/* + 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/merchant/get-private-units-UNIT.h + * @brief C interface for GET /private/units/$UNIT of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_UNITS_UNIT_H +#define _TALER_MERCHANT__GET_PRIVATE_UNITS_UNIT_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/units/$UNIT request. + */ +struct TALER_MERCHANT_GetPrivateUnitHandle; + + +/** + * Response details for a GET /private/units/$UNIT request. + */ +struct TALER_MERCHANT_GetPrivateUnitResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Detailed unit information. + */ + struct TALER_MERCHANT_UnitEntry unit; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/units/$UNIT operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param unit_id identifier of the unit to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateUnitHandle * +TALER_MERCHANT_get_private_unit_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *unit_id); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateUnitCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/units/$UNIT request. + * + * @param cls closure + * @param ugr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateUnitCallback)( + TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateUnitResponse *ugr); + + +/** + * Start GET /private/units/$UNIT operation. + * + * @param[in,out] gpu operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_unit_start ( + struct TALER_MERCHANT_GetPrivateUnitHandle *gpu, + TALER_MERCHANT_GetPrivateUnitCallback cb, + TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/units/$UNIT operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateUnitCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpu operation to cancel + */ +void +TALER_MERCHANT_get_private_unit_cancel ( + struct TALER_MERCHANT_GetPrivateUnitHandle *gpu); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_UNITS_UNIT_H */ diff --git a/src/include/taler/merchant/get-private-units.h b/src/include/taler/merchant/get-private-units.h @@ -0,0 +1,137 @@ +/* + 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/merchant/get-private-units.h + * @brief C interface for the GET /private/units endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_UNITS_H +#define _TALER_MERCHANT__GET_PRIVATE_UNITS_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/units request. + */ +struct TALER_MERCHANT_GetPrivateUnitsHandle; + + +/** + * Response details for a GET /private/units request. + */ +struct TALER_MERCHANT_GetPrivateUnitsResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of units in @a units. + */ + unsigned int units_length; + + /** + * Array of unit entries. + */ + const struct TALER_MERCHANT_UnitEntry *units; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/units operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateUnitsHandle * +TALER_MERCHANT_get_private_units_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateUnitsCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/units request. + * + * @param cls closure + * @param ugr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateUnitsCallback)( + TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateUnitsResponse *ugr); + + +/** + * Start GET /private/units operation. + * + * @param[in,out] gpuh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_units_start ( + struct TALER_MERCHANT_GetPrivateUnitsHandle *gpuh, + TALER_MERCHANT_GetPrivateUnitsCallback cb, + TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/units operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateUnitsCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpuh operation to cancel + */ +void +TALER_MERCHANT_get_private_units_cancel ( + struct TALER_MERCHANT_GetPrivateUnitsHandle *gpuh); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_UNITS_H */ diff --git a/src/include/taler/merchant/get-private-webhooks-WEBHOOK_ID.h b/src/include/taler/merchant/get-private-webhooks-WEBHOOK_ID.h @@ -0,0 +1,156 @@ +/* + 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/merchant/get-private-webhooks-WEBHOOK_ID.h + * @brief C interface for GET /private/webhooks/$WEBHOOK_ID of the merchant backend + * @author Priscilla Huang + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_WEBHOOK_ID_H +#define _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_WEBHOOK_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/webhooks/$WEBHOOK_ID request. + */ +struct TALER_MERCHANT_GetPrivateWebhookHandle; + + +/** + * Response details for a GET /private/webhooks/$WEBHOOK_ID request. + */ +struct TALER_MERCHANT_GetPrivateWebhookResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Event type that triggers this webhook. + */ + const char *event_type; + + /** + * URL to send the webhook notification to. + */ + const char *url; + + /** + * HTTP method to use. + */ + const char *http_method; + + /** + * Template for HTTP headers, or NULL. + */ + const char *header_template; + + /** + * Template for the HTTP body, or NULL. + */ + const char *body_template; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/webhooks/$WEBHOOK_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param webhook_id identifier of the webhook to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateWebhookHandle * +TALER_MERCHANT_get_private_webhook_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *webhook_id); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateWebhookCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/webhooks/$WEBHOOK_ID request. + * + * @param cls closure + * @param wgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateWebhookCallback)( + TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateWebhookResponse *wgr); + + +/** + * Start GET /private/webhooks/$WEBHOOK_ID operation. + * + * @param[in,out] gpw operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_webhook_start ( + struct TALER_MERCHANT_GetPrivateWebhookHandle *gpw, + TALER_MERCHANT_GetPrivateWebhookCallback cb, + TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/webhooks/$WEBHOOK_ID operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetPrivateWebhookCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpw operation to cancel + */ +void +TALER_MERCHANT_get_private_webhook_cancel ( + struct TALER_MERCHANT_GetPrivateWebhookHandle *gpw); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_WEBHOOK_ID_H */ diff --git a/src/include/taler/merchant/get-private-webhooks.h b/src/include/taler/merchant/get-private-webhooks.h @@ -0,0 +1,156 @@ +/* + 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/merchant/get-private-webhooks.h + * @brief C interface for the GET /private/webhooks endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H +#define _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /private/webhooks request. + */ +struct TALER_MERCHANT_GetPrivateWebhooksHandle; + + +/** + * Entry for one webhook. + */ +struct TALER_MERCHANT_GetPrivateWebhooksWebhookEntry +{ + + /** + * Identifier of the webhook. + */ + const char *webhook_id; + + /** + * Event type that triggers this webhook. + */ + const char *event_type; + +}; + + +/** + * Response details for a GET /private/webhooks request. + */ +struct TALER_MERCHANT_GetPrivateWebhooksResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of webhooks in @a webhooks. + */ + unsigned int webhooks_length; + + /** + * Array of webhook entries. + */ + const struct TALER_MERCHANT_GetPrivateWebhooksWebhookEntry *webhooks; + + } ok; + + } details; + +}; + + +/** + * Set up GET /private/webhooks operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @return handle to operation + */ +struct TALER_MERCHANT_GetPrivateWebhooksHandle * +TALER_MERCHANT_get_private_webhooks_create ( + struct GNUNET_CURL_Context *ctx, + const char *url); + + +#ifndef TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetPrivateWebhooksCallback. + */ +#define TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE */ + +/** + * Callback for a GET /private/webhooks request. + * + * @param cls closure + * @param wgr response details + */ +typedef void +(*TALER_MERCHANT_GetPrivateWebhooksCallback)( + TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetPrivateWebhooksResponse *wgr); + + +/** + * Start GET /private/webhooks operation. + * + * @param[in,out] gpwh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_private_webhooks_start ( + struct TALER_MERCHANT_GetPrivateWebhooksHandle *gpwh, + TALER_MERCHANT_GetPrivateWebhooksCallback cb, + TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /private/webhooks operation. This function must not be + * called by clients after the TALER_MERCHANT_GetPrivateWebhooksCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpwh operation to cancel + */ +void +TALER_MERCHANT_get_private_webhooks_cancel ( + struct TALER_MERCHANT_GetPrivateWebhooksHandle *gpwh); + + +#endif /* _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H */ diff --git a/src/include/taler/merchant/get-products-IMAGE_HASH-image.h b/src/include/taler/merchant/get-products-IMAGE_HASH-image.h @@ -0,0 +1,135 @@ +/* + 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/merchant/get-products-IMAGE_HASH-image.h + * @brief C interface for GET /products/$IMAGE_HASH/image of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_PRODUCTS_IMAGE_HASH_IMAGE_H +#define _TALER_MERCHANT__GET_PRODUCTS_IMAGE_HASH_IMAGE_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /products/$IMAGE_HASH/image request. + */ +struct TALER_MERCHANT_GetProductsImageHandle; + + +/** + * Response details for a GET /products/$IMAGE_HASH/image request. + */ +struct TALER_MERCHANT_GetProductsImageResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Image data (a data URI). + */ + const char *image; + + } ok; + + } details; + +}; + + +/** + * Set up GET /products/$IMAGE_HASH/image operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param image_hash hash identifying the image to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetProductsImageHandle * +TALER_MERCHANT_get_products_image_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *image_hash); + + +#ifndef TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetProductsImageCallback. + */ +#define TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE */ + +/** + * Callback for a GET /products/$IMAGE_HASH/image request. + * + * @param cls closure + * @param pgr response details + */ +typedef void +(*TALER_MERCHANT_GetProductsImageCallback)( + TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetProductsImageResponse *pgr); + + +/** + * Start GET /products/$IMAGE_HASH/image operation. + * + * @param[in,out] gpi operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_products_image_start ( + struct TALER_MERCHANT_GetProductsImageHandle *gpi, + TALER_MERCHANT_GetProductsImageCallback cb, + TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /products/$IMAGE_HASH/image operation. This function + * must not be called by clients after the + * TALER_MERCHANT_GetProductsImageCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gpi operation to cancel + */ +void +TALER_MERCHANT_get_products_image_cancel ( + struct TALER_MERCHANT_GetProductsImageHandle *gpi); + + +#endif /* _TALER_MERCHANT__GET_PRODUCTS_IMAGE_HASH_IMAGE_H */ diff --git a/src/include/taler/merchant/get-templates-TEMPLATE_ID.h b/src/include/taler/merchant/get-templates-TEMPLATE_ID.h @@ -0,0 +1,146 @@ +/* + 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/merchant/get-templates-TEMPLATE_ID.h + * @brief C interface for GET /templates/$TEMPLATE_ID (wallet-facing) of the merchant backend + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__GET_TEMPLATES_TEMPLATE_ID_H +#define _TALER_MERCHANT__GET_TEMPLATES_TEMPLATE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a GET /templates/$TEMPLATE_ID request (wallet-facing). + */ +struct TALER_MERCHANT_GetTemplatesHandle; + + +/** + * Response details for a GET /templates/$TEMPLATE_ID request (wallet-facing). + */ +struct TALER_MERCHANT_GetTemplatesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Template contract (JSON). + */ + const json_t *template_contract; + + /** + * Editable defaults (JSON object), or NULL if not provided. + */ + const json_t *editable_defaults; + + /** + * Required currency, or NULL if not provided. + * FIXME: currently not provided by the backend. Fix backend! + */ + const char *required_currency; + + } ok; + + } details; + +}; + + +/** + * Set up GET /templates/$TEMPLATE_ID operation (wallet-facing). + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param template_id identifier of the template to retrieve + * @return handle to operation + */ +struct TALER_MERCHANT_GetTemplatesHandle * +TALER_MERCHANT_get_templates_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *template_id); + + +#ifndef TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_GetTemplatesCallback. + */ +#define TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE */ + +/** + * Callback for a GET /templates/$TEMPLATE_ID request (wallet-facing). + * + * @param cls closure + * @param wtgr response details + */ +typedef void +(*TALER_MERCHANT_GetTemplatesCallback)( + TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_GetTemplatesResponse *wtgr); + + +/** + * Start GET /templates/$TEMPLATE_ID operation (wallet-facing). + * + * @param[in,out] gth operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_get_templates_start ( + struct TALER_MERCHANT_GetTemplatesHandle *gth, + TALER_MERCHANT_GetTemplatesCallback cb, + TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel GET /templates/$TEMPLATE_ID operation (wallet-facing). + * This function must not be called by clients after the + * TALER_MERCHANT_GetTemplatesCallback has been invoked + * (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] gth operation to cancel + */ +void +TALER_MERCHANT_get_templates_cancel ( + struct TALER_MERCHANT_GetTemplatesHandle *gth); + + +#endif /* _TALER_MERCHANT__GET_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/merchant/patch-management-instances-INSTANCE.h b/src/include/taler/merchant/patch-management-instances-INSTANCE.h @@ -0,0 +1,415 @@ +/* + 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/merchant/patch-management-instances-INSTANCE.h + * @brief C interface for PATCH /management/instances/$INSTANCE + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_MANAGEMENT_INSTANCES_INSTANCE_H +#define _TALER_MERCHANT__PATCH_MANAGEMENT_INSTANCES_INSTANCE_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the PATCH /management/instances/$INSTANCE request. + */ +enum TALER_MERCHANT_PatchManagementInstancesOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_END = 0, + + /** + * Set the default pay delay. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, + + /** + * Set the default refund delay. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, + + /** + * Set the default wire transfer delay. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, + + /** + * Set the default wire transfer rounding interval. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, + + /** + * Set the email address. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_EMAIL, + + /** + * Set the phone number. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, + + /** + * Set the website URL. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_WEBSITE, + + /** + * Set the logo. + */ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_LOGO + +}; + + +/** + * Value for an option for the PATCH /management/instances/$INSTANCE request. + */ +struct TALER_MERCHANT_PatchManagementInstancesOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PatchManagementInstancesOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY. + */ + struct GNUNET_TIME_Relative default_pay_delay; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY. + */ + struct GNUNET_TIME_Relative default_refund_delay; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY. + */ + struct GNUNET_TIME_Relative default_wire_transfer_delay; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL. + */ + enum GNUNET_TIME_RounderInterval default_wire_transfer_rounding_interval; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_EMAIL. + */ + const char *email; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER. + */ + const char *phone_number; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_WEBSITE. + */ + const char *website; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_LOGO. + */ + const char *logo; + + } details; + +}; + + +/** + * Handle for a PATCH /management/instances/$INSTANCE operation. + */ +struct TALER_MERCHANT_PatchManagementInstancesHandle; + + +/** + * Set up PATCH /management/instances/$INSTANCE operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param instance_id identifier of the instance to patch + * @param name new human-readable name + * @param address new address (JSON) + * @param jurisdiction new jurisdiction (JSON) + * @param use_stefan whether to use the STEFAN curve for fee calculations + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchManagementInstancesHandle * +TALER_MERCHANT_patch_management_instances_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id, + const char *name, + const json_t *address, + const json_t *jurisdiction, + bool use_stefan); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PatchManagementInstancesOptionValue + */ +#define TALER_MERCHANT_patch_management_instances_option_end_() \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_END \ + } + +/** + * Set default pay delay. + * + * @param d delay to set + * @return representation of the option + */ +#define TALER_MERCHANT_patch_management_instances_option_default_pay_delay(d) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, \ + .details.default_pay_delay = (d) \ + } + +/** + * Set default refund delay. + * + * @param d delay to set + * @return representation of the option + */ +#define TALER_MERCHANT_patch_management_instances_option_default_refund_delay(d) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, \ + .details.default_refund_delay = (d) \ + } + +/** + * Set default wire transfer delay. + * + * @param d delay to set + * @return representation of the option + */ +#define \ + TALER_MERCHANT_patch_management_instances_option_default_wire_transfer_delay(d) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, \ + .details.default_wire_transfer_delay = (d) \ + } + +/** + * Set default wire transfer rounding interval. + * + * @param ri rounding interval to set + * @return representation of the option + */ +#define \ + TALER_MERCHANT_patch_management_instances_option_default_wire_transfer_rounding_interval(ri) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, \ + .details.default_wire_transfer_rounding_interval = (ri) \ + } + +/** + * Set email address. + * + * @param e email to set + * @return representation of the option + */ +#define TALER_MERCHANT_patch_management_instances_option_email(e) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_EMAIL, \ + .details.email = (e) \ + } + +/** + * Set phone number. + * + * @param p phone number to set + * @return representation of the option + */ +#define TALER_MERCHANT_patch_management_instances_option_phone_number(p) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, \ + .details.phone_number = (p) \ + } + +/** + * Set website URL. + * + * @param w website to set + * @return representation of the option + */ +#define TALER_MERCHANT_patch_management_instances_option_website(w) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_WEBSITE, \ + .details.website = (w) \ + } + +/** + * Set logo. + * + * @param l logo to set + * @return representation of the option + */ +#define TALER_MERCHANT_patch_management_instances_option_logo(l) \ + (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_LOGO, \ + .details.logo = (l) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param pmih the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_patch_management_instances_set_options_ ( + struct TALER_MERCHANT_PatchManagementInstancesHandle *pmih, + unsigned int num_options, + const struct TALER_MERCHANT_PatchManagementInstancesOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_patch_management_instances_set_options ( + * pmih, + * TALER_MERCHANT_patch_management_instances_option_email ( + * "foo@example.com")); + * + * @param pmih the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_patch_management_instances_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_patch_management_instances_set_options(pmih,...) \ + TALER_MERCHANT_patch_management_instances_set_options_ ( \ + pmih, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PatchManagementInstancesOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_patch_management_instances_option_end_ \ + () } \ + )) + + +/** + * Response details for a PATCH /management/instances/$INSTANCE request. + */ +struct TALER_MERCHANT_PatchManagementInstancesResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchManagementInstancesCallback. + */ +#define TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /management/instances/$INSTANCE request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchManagementInstancesCallback)( + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchManagementInstancesResponse *result); + + +/** + * Start PATCH /management/instances/$INSTANCE operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_management_instances_start ( + struct TALER_MERCHANT_PatchManagementInstancesHandle *handle, + TALER_MERCHANT_PatchManagementInstancesCallback cb, + TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /management/instances/$INSTANCE operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_patch_management_instances_cancel ( + struct TALER_MERCHANT_PatchManagementInstancesHandle *handle); + + +#endif /* _TALER_MERCHANT__PATCH_MANAGEMENT_INSTANCES_INSTANCE_H */ diff --git a/src/include/taler/merchant/patch-private-accounts-H_WIRE.h b/src/include/taler/merchant/patch-private-accounts-H_WIRE.h @@ -0,0 +1,279 @@ +/* + 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/merchant/patch-private-accounts-H_WIRE.h + * @brief C interface for PATCH /private/accounts/$H_WIRE + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_PRIVATE_ACCOUNTS_H_WIRE_H +#define _TALER_MERCHANT__PATCH_PRIVATE_ACCOUNTS_H_WIRE_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the PATCH /private/accounts/$H_WIRE request. + */ +enum TALER_MERCHANT_PatchPrivateAccountOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_END = 0, + + /** + * Set the credit facade URL. + */ + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_URL, + + /** + * Set the credit facade credentials (JSON). + */ + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_CREDENTIALS, + + /** + * Set the extra wire subject metadata (restricted text). + */ + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_EXTRA_WIRE_SUBJECT_METADATA + +}; + + +/** + * Value for an option for the PATCH /private/accounts/$H_WIRE request. + */ +struct TALER_MERCHANT_PatchPrivateAccountOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PatchPrivateAccountOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_URL. + */ + const char *credit_facade_url; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_CREDENTIALS. + */ + const json_t *credit_facade_credentials; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_EXTRA_WIRE_SUBJECT_METADATA. + */ + const char *extra_wire_subject_metadata; + + } details; + +}; + + +/** + * Handle for a PATCH /private/accounts/$H_WIRE operation. + */ +struct TALER_MERCHANT_PatchPrivateAccountHandle; + + +/** + * Set up PATCH /private/accounts/$H_WIRE operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param h_wire hash of the wire details identifying the account + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchPrivateAccountHandle * +TALER_MERCHANT_patch_private_account_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_MerchantWireHashP *h_wire); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PatchPrivateAccountOptionValue + */ +#define TALER_MERCHANT_patch_private_account_option_end_() \ + (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_END \ + } + +/** + * Set credit facade URL. + * + * @param u credit facade URL to set + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateAccountOptionValue + */ +#define TALER_MERCHANT_patch_private_account_option_credit_facade_url(u) \ + (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_URL, \ + .details.credit_facade_url = (u) \ + } + +/** + * Set credit facade credentials. + * + * @param c credit facade credentials (JSON) to set + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateAccountOptionValue + */ +#define TALER_MERCHANT_patch_private_account_option_credit_facade_credentials(c) \ + (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_CREDENTIALS, \ + .details.credit_facade_credentials = (c) \ + } + +/** + * Set extra wire subject metadata. + * + * @param m extra wire subject metadata (JSON) to set + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateAccountOptionValue + */ +#define TALER_MERCHANT_patch_private_account_option_extra_wire_subject_metadata(m) \ + (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_EXTRA_WIRE_SUBJECT_METADATA, \ + .details.extra_wire_subject_metadata = (m) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param pah the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_patch_private_account_set_options_ ( + struct TALER_MERCHANT_PatchPrivateAccountHandle *pah, + unsigned int num_options, + const struct TALER_MERCHANT_PatchPrivateAccountOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_patch_private_account_set_options ( + * pah, + * TALER_MERCHANT_patch_private_account_option_credit_facade_url ( + * "https://example.com/facade")); + * + * @param pah the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_patch_private_account_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_patch_private_account_set_options(pah,...) \ + TALER_MERCHANT_patch_private_account_set_options_ ( \ + pah, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PatchPrivateAccountOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_patch_private_account_option_end_ () } \ + )) + + +/** + * Response details for a PATCH /private/accounts/$H_WIRE request. + */ +struct TALER_MERCHANT_PatchPrivateAccountResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchPrivateAccountCallback. + */ +#define TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /private/accounts/$H_WIRE request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchPrivateAccountCallback)( + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchPrivateAccountResponse *result); + + +/** + * Start PATCH /private/accounts/$H_WIRE operation. + * + * @param[in,out] pah operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_private_account_start ( + struct TALER_MERCHANT_PatchPrivateAccountHandle *pah, + TALER_MERCHANT_PatchPrivateAccountCallback cb, + TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /private/accounts/$H_WIRE operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] pah operation to cancel + */ +void +TALER_MERCHANT_patch_private_account_cancel ( + struct TALER_MERCHANT_PatchPrivateAccountHandle *pah); + + +#endif /* _TALER_MERCHANT__PATCH_PRIVATE_ACCOUNTS_H_WIRE_H */ diff --git a/src/include/taler/merchant/patch-private-orders-ORDER_ID-forget.h b/src/include/taler/merchant/patch-private-orders-ORDER_ID-forget.h @@ -0,0 +1,113 @@ +/* + 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/merchant/patch-private-orders-ORDER_ID-forget.h + * @brief C interface for PATCH /private/orders/$ORDER_ID/forget + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H +#define _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a PATCH /private/orders/$ORDER_ID/forget operation. + */ +struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle; + + +/** + * Set up PATCH /private/orders/$ORDER_ID/forget operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order + * @param fields_length number of field paths in @a fields + * @param fields array of JSON pointer paths to redact + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle * +TALER_MERCHANT_patch_private_orders_forget_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + unsigned int fields_length, + const char *fields[static fields_length]); + + +/** + * Response details for a PATCH /private/orders/$ORDER_ID/forget request. + */ +struct TALER_MERCHANT_PatchPrivateOrdersForgetResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchPrivateOrdersForgetCallback. + */ +#define TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /private/orders/$ORDER_ID/forget request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchPrivateOrdersForgetCallback)( + TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchPrivateOrdersForgetResponse *result); + + +/** + * Start PATCH /private/orders/$ORDER_ID/forget operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_private_orders_forget_start ( + struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle *handle, + TALER_MERCHANT_PatchPrivateOrdersForgetCallback cb, + TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /private/orders/$ORDER_ID/forget operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_patch_private_orders_forget_cancel ( + struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle *handle); + + +#endif /* _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H */ diff --git a/src/include/taler/merchant/patch-private-otp-devices-DEVICE_ID.h b/src/include/taler/merchant/patch-private-otp-devices-DEVICE_ID.h @@ -0,0 +1,233 @@ +/* + 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/merchant/patch-private-otp-devices-DEVICE_ID.h + * @brief C interface for PATCH /private/otp-devices/$DEVICE_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_PRIVATE_OTP_DEVICES_DEVICE_ID_H +#define _TALER_MERCHANT__PATCH_PRIVATE_OTP_DEVICES_DEVICE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the PATCH /private/otp-devices/$DEVICE_ID request. + */ +enum TALER_MERCHANT_PatchPrivateOtpDeviceOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_END = 0, + + /** + * Set the OTP counter value (for HOTP). + */ + TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_OTP_CTR + +}; + + +/** + * Value for an option for the PATCH /private/otp-devices/$DEVICE_ID request. + */ +struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PatchPrivateOtpDeviceOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_OTP_CTR. + */ + uint64_t otp_ctr; + + } details; + +}; + + +/** + * Handle for a PATCH /private/otp-devices/$DEVICE_ID operation. + */ +struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle; + + +/** + * Set up PATCH /private/otp-devices/$DEVICE_ID operation. + * Note that you must explicitly start the operation after setup. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param otp_device_id identifier of the OTP device to update + * @param otp_device_description new human-readable description + * @param otp_key new base32-encoded OTP secret key, or NULL to keep unchanged + * @param mca new OTP algorithm + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle * +TALER_MERCHANT_patch_private_otp_device_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *otp_device_id, + const char *otp_device_description, + const char *otp_key, + enum TALER_MerchantConfirmationAlgorithm mca); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue + */ +#define TALER_MERCHANT_patch_private_otp_device_option_end_() \ + (const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_END \ + } + +/** + * Set the counter value (for HOTP). + * + * @param c the counter value + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue + */ +#define TALER_MERCHANT_patch_private_otp_device_option_otp_ctr(c) \ + (const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_OTP_CTR, \ + .details.otp_ctr = (c) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param odh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_patch_private_otp_device_set_options_ ( + struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle *odh, + unsigned int num_options, + const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_patch_private_otp_device_set_options ( + * odh, + * TALER_MERCHANT_patch_private_otp_device_option_otp_ctr (42)); + * + * @param odh the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_patch_private_otp_device_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_patch_private_otp_device_set_options(odh,...) \ + TALER_MERCHANT_patch_private_otp_device_set_options_ ( \ + odh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_patch_private_otp_device_option_end_ () } \ + )) + + +/** + * Response details for a PATCH /private/otp-devices/$DEVICE_ID request. + */ +struct TALER_MERCHANT_PatchPrivateOtpDeviceResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchPrivateOtpDeviceCallback. + */ +#define TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /private/otp-devices/$DEVICE_ID request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchPrivateOtpDeviceCallback)( + TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchPrivateOtpDeviceResponse *result); + + +/** + * Start PATCH /private/otp-devices/$DEVICE_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_private_otp_device_start ( + struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle *handle, + TALER_MERCHANT_PatchPrivateOtpDeviceCallback cb, + TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /private/otp-devices/$DEVICE_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_patch_private_otp_device_cancel ( + struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle *handle); + + +#endif /* _TALER_MERCHANT__PATCH_PRIVATE_OTP_DEVICES_DEVICE_ID_H */ diff --git a/src/include/taler/merchant/patch-private-products-PRODUCT_ID.h b/src/include/taler/merchant/patch-private-products-PRODUCT_ID.h @@ -0,0 +1,638 @@ +/* + 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/merchant/patch-private-products-PRODUCT_ID.h + * @brief C interface for PATCH /private/products/$PRODUCT_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_PRIVATE_PRODUCTS_PRODUCT_ID_H +#define _TALER_MERCHANT__PATCH_PRIVATE_PRODUCTS_PRODUCT_ID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the PATCH /private/products/$PRODUCT_ID request. + */ +enum TALER_MERCHANT_PatchPrivateProductOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_END = 0, + + /** + * Set value and fractional part of total stock. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK, + + /** + * Set value part of total stock (-1 for unlimited). + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_VAL, + + /** + * Set fractional part of total stock. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC, + + /** + * Set whether fractional quantities are allowed. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_ALLOW_FRACTION, + + /** + * Set precision level for fractions. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_PRECISION_LEVEL, + + /** + * Internationalized descriptions (JSON). + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_DESCRIPTION_I18N, + + /** + * Product image (base64-encoded data URL). + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_IMAGE, + + /** + * Tax information (JSON array). + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TAXES, + + /** + * Total units lost/expired. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_LOST, + + /** + * Storage location (JSON). + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_ADDRESS, + + /** + * Expected restock time. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_NEXT_RESTOCK, + + /** + * Explicit product name (distinct from description). + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_NAME, + + /** + * Category IDs. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_CATEGORIES, + + /** + * Minimum age requirement. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MINIMUM_AGE, + + /** + * Product group ID. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_GROUP_ID, + + /** + * Money pot ID. + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MONEY_POT_ID, + + /** + * Whether the price is net (before tax). + */ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRICE_IS_NET + +}; + + +/** + * Value for an option for the PATCH /private/products/$PRODUCT_ID request. + */ +struct TALER_MERCHANT_PatchPrivateProductOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PatchPrivateProductOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC. + */ + uint32_t total_stock_frac; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_ALLOW_FRACTION. + */ + bool unit_allow_fraction; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_PRECISION_LEVEL. + */ + uint32_t unit_precision_level; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_DESCRIPTION_I18N. + */ + const json_t *description_i18n; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_IMAGE. + */ + const char *image; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TAXES. + */ + const json_t *taxes; + + struct + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK. + * -1 for infinite stock. + */ + int64_t val; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC. + */ + uint32_t frac; + } total_stock; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_LOST. + */ + uint64_t total_lost; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_ADDRESS. + */ + const json_t *address; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_NEXT_RESTOCK. + */ + struct GNUNET_TIME_Timestamp next_restock; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_NAME. + */ + const char *product_name; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_CATEGORIES. + */ + struct + { + unsigned int num; + const uint64_t *cats; + } categories; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MINIMUM_AGE. + */ + uint32_t minimum_age; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_GROUP_ID. + */ + uint64_t product_group_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MONEY_POT_ID. + */ + uint64_t money_pot_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRICE_IS_NET. + */ + bool price_is_net; + + } details; + +}; + + +/** + * Handle for a PATCH /private/products/$PRODUCT_ID operation. + */ +struct TALER_MERCHANT_PatchPrivateProductHandle; + + +/** + * Set up PATCH /private/products/$PRODUCT_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param product_id identifier of the product to update + * @param description new human-readable description + * @param unit unit of measurement + * @param num_prices length of the @e prices array + * @param prices new unit prices + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchPrivateProductHandle * +TALER_MERCHANT_patch_private_product_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *product_id, + const char *description, + const char *unit, + unsigned int num_prices, + const struct TALER_Amount prices[static num_prices]); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PatchPrivateProductOptionValue + */ +#define TALER_MERCHANT_patch_private_product_option_end_() \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_END \ + } + +/** + * Set value and fractional part of total stock. + * + * @param v value part of stock + * @param f fractional stock value + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue + */ +#define TALER_MERCHANT_patch_private_product_option_total_stock(v,f) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC, \ + .details.total_stock.val = (v), \ + .details.total_stock.frac = (f) \ + } + +/** + * Set fractional part of total stock. + * + * @param f fractional stock value + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue + */ +#define TALER_MERCHANT_patch_private_product_option_total_stock_frac(f) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC, \ + .details.total_stock.frac = (f) \ + } + +/** + * Set value part of total stock (-1 for unlimited). + * + * @param v stock value + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue + */ +#define TALER_MERCHANT_patch_private_product_option_total_stock_val(v) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_VAL, \ + .details.total_stock.val = (v) \ + } + +/** + * Set whether fractional quantities are allowed. + * + * @param a true if fractional quantities are allowed + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue + */ +#define TALER_MERCHANT_patch_private_product_option_unit_allow_fraction(a) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_ALLOW_FRACTION, \ + .details.unit_allow_fraction = (a) \ + } + +/** + * Set precision level for fractions. + * + * @param p precision level value + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue + */ +#define TALER_MERCHANT_patch_private_product_option_unit_precision_level(p) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_PRECISION_LEVEL, \ + .details.unit_precision_level = (p) \ + } + +/** + * Set internationalized descriptions. + * + * @param d descriptions JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_description_i18n(d) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_DESCRIPTION_I18N, \ + .details.description_i18n = (d) \ + } + +/** + * Set product image (base64-encoded data URL). + * + * @param i image string + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_image(i) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_IMAGE, \ + .details.image = (i) \ + } + +/** + * Set tax information. + * + * @param t taxes JSON array + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_taxes(t) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TAXES, \ + .details.taxes = (t) \ + } + +/** + * Set total units lost/expired. + * + * @param l total lost value + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_total_lost(l) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_LOST, \ + .details.total_lost = (l) \ + } + +/** + * Set storage address. + * + * @param a address JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_address(a) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_ADDRESS, \ + .details.address = (a) \ + } + +/** + * Set expected restock time. + * + * @param r restock timestamp + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_next_restock(r) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_NEXT_RESTOCK, \ + .details.next_restock = (r) \ + } + +/** + * Set explicit product name (distinct from description). + * + * @param n product name string + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_product_name(n) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_NAME, \ + .details.product_name = (n) \ + } + +/** + * Set category IDs. + * + * @param n number of categories + * @param c array of category IDs + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_categories(n,c) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_CATEGORIES, \ + .details.categories = { .num = (n), .cats = (c) } \ + } + +/** + * Set minimum age requirement. + * + * @param a minimum age (0 for none) + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_minimum_age(a) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MINIMUM_AGE, \ + .details.minimum_age = (a) \ + } + +/** + * Set product group ID. + * + * @param g product group ID + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_product_group_id(g) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_GROUP_ID, \ + .details.product_group_id = (g) \ + } + +/** + * Set money pot ID. + * + * @param m money pot ID + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_money_pot_id(m) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MONEY_POT_ID, \ + .details.money_pot_id = (m) \ + } + +/** + * Set whether the price is net (before tax). + * + * @param b true if price is net + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_product_option_price_is_net(b) \ + (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRICE_IS_NET, \ + .details.price_is_net = (b) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param pph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_patch_private_product_set_options_ ( + struct TALER_MERCHANT_PatchPrivateProductHandle *pph, + unsigned int num_options, + const struct TALER_MERCHANT_PatchPrivateProductOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_patch_private_product_set_options ( + * pph, + * TALER_MERCHANT_patch_private_product_option_total_stock_frac (500), + * TALER_MERCHANT_patch_private_product_option_unit_allow_fraction (true)); + * + * @param pph the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_patch_private_product_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_patch_private_product_set_options(pph,...) \ + TALER_MERCHANT_patch_private_product_set_options_ ( \ + pph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PatchPrivateProductOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_patch_private_product_option_end_ () } \ + )) + + +/** + * Response details for a PATCH /private/products/$PRODUCT_ID request. + */ +struct TALER_MERCHANT_PatchPrivateProductResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchPrivateProductCallback. + */ +#define TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /private/products/$PRODUCT_ID request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchPrivateProductCallback)( + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchPrivateProductResponse *result); + + +/** + * Start PATCH /private/products/$PRODUCT_ID operation. + * + * @param[in,out] pph operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_private_product_start ( + struct TALER_MERCHANT_PatchPrivateProductHandle *pph, + TALER_MERCHANT_PatchPrivateProductCallback cb, + TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /private/products/$PRODUCT_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] pph operation to cancel + */ +void +TALER_MERCHANT_patch_private_product_cancel ( + struct TALER_MERCHANT_PatchPrivateProductHandle *pph); + + +#endif /* _TALER_MERCHANT__PATCH_PRIVATE_PRODUCTS_PRODUCT_ID_H */ diff --git a/src/include/taler/merchant/patch-private-templates-TEMPLATE_ID.h b/src/include/taler/merchant/patch-private-templates-TEMPLATE_ID.h @@ -0,0 +1,223 @@ +/* + 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/merchant/patch-private-templates-TEMPLATE_ID.h + * @brief C interface for PATCH /private/templates/$TEMPLATE_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_PRIVATE_TEMPLATES_TEMPLATE_ID_H +#define _TALER_MERCHANT__PATCH_PRIVATE_TEMPLATES_TEMPLATE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the PATCH /private/templates/$TEMPLATE_ID request. + */ +enum TALER_MERCHANT_PatchPrivateTemplateOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_END = 0, + + /** + * Editable defaults (JSON object) for the template. + */ + TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_EDITABLE_DEFAULTS + +}; + + +/** + * Value for an option for the PATCH /private/templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_PatchPrivateTemplateOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PatchPrivateTemplateOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_EDITABLE_DEFAULTS. + */ + const json_t *editable_defaults; + + } details; + +}; + + +/** + * Handle for a PATCH /private/templates/$TEMPLATE_ID operation. + */ +struct TALER_MERCHANT_PatchPrivateTemplateHandle; + + +/** + * Set up PATCH /private/templates/$TEMPLATE_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param template_id identifier of the template to update + * @param template_description new human-readable description + * @param otp_id new OTP device ID, or NULL to remove association + * @param template_contract new template contract (JSON) + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchPrivateTemplateHandle * +TALER_MERCHANT_patch_private_template_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *template_id, + const char *template_description, + const char *otp_id, + json_t *template_contract); + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_patch_private_template_option_end_() \ + (const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_END \ + } + +/** + * Set editable defaults. + * + * @param ed editable defaults (JSON object) + * @return representation of the option + */ +#define TALER_MERCHANT_patch_private_template_option_editable_defaults(ed) \ + (const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_EDITABLE_DEFAULTS, \ + .details.editable_defaults = (ed) \ + } + + +/** + * Set the requested options for the operation. + * + * @param tph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_patch_private_template_set_options_ ( + struct TALER_MERCHANT_PatchPrivateTemplateHandle *tph, + unsigned int num_options, + const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param tph the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_patch_private_template_set_options(tph,...) \ + TALER_MERCHANT_patch_private_template_set_options_ ( \ + tph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_patch_private_template_option_end_ () } \ + )) + + +/** + * Response details for a PATCH /private/templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_PatchPrivateTemplateResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchPrivateTemplateCallback. + */ +#define TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /private/templates/$TEMPLATE_ID request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchPrivateTemplateCallback)( + TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchPrivateTemplateResponse *result); + + +/** + * Start PATCH /private/templates/$TEMPLATE_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_private_template_start ( + struct TALER_MERCHANT_PatchPrivateTemplateHandle *handle, + TALER_MERCHANT_PatchPrivateTemplateCallback cb, + TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /private/templates/$TEMPLATE_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_patch_private_template_cancel ( + struct TALER_MERCHANT_PatchPrivateTemplateHandle *handle); + + +#endif /* _TALER_MERCHANT__PATCH_PRIVATE_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/merchant/patch-private-units-UNIT.h b/src/include/taler/merchant/patch-private-units-UNIT.h @@ -0,0 +1,376 @@ +/* + 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/merchant/patch-private-units-UNIT.h + * @brief C interface for PATCH /private/units/$UNIT + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_PRIVATE_UNITS_UNIT_H +#define _TALER_MERCHANT__PATCH_PRIVATE_UNITS_UNIT_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the PATCH /private/units/$UNIT request. + */ +enum TALER_MERCHANT_PatchPrivateUnitOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_END = 0, + + /** + * Set the long name of the unit. + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG, + + /** + * Set the short name (symbol) of the unit. + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT, + + /** + * Set internationalized long names (JSON). + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG_I18N, + + /** + * Set internationalized short names (JSON). + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT_I18N, + + /** + * Set whether fractional quantities are allowed. + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ALLOW_FRACTION, + + /** + * Set precision level for fractions. + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_PRECISION_LEVEL, + + /** + * Set active status of the unit. + */ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ACTIVE + +}; + + +/** + * Value for an option for the PATCH /private/units/$UNIT request. + */ +struct TALER_MERCHANT_PatchPrivateUnitOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PatchPrivateUnitOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG. + */ + const char *unit_name_long; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT. + */ + const char *unit_name_short; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG_I18N. + */ + const json_t *unit_name_long_i18n; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT_I18N. + */ + const json_t *unit_name_short_i18n; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ALLOW_FRACTION. + */ + bool unit_allow_fraction; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_PRECISION_LEVEL. + */ + uint32_t unit_precision_level; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ACTIVE. + */ + bool unit_active; + + } details; + +}; + + +/** + * Handle for a PATCH /private/units/$UNIT operation. + */ +struct TALER_MERCHANT_PatchPrivateUnitHandle; + + +/** + * Set up PATCH /private/units/$UNIT operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param unit_id identifier of the unit to update + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchPrivateUnitHandle * +TALER_MERCHANT_patch_private_unit_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *unit_id); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_end_() \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_END \ + } + +/** + * Set the long name of the unit. + * + * @param n long name to set + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_unit_name_long(n) \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG, \ + .details.unit_name_long = (n) \ + } + +/** + * Set the short name (symbol) of the unit. + * + * @param n short name to set + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_unit_name_short(n) \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT, \ + .details.unit_name_short = (n) \ + } + +/** + * Set internationalized long names. + * + * @param j JSON object with internationalized long names + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_unit_name_long_i18n(j) \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG_I18N \ + , \ + .details.unit_name_long_i18n = (j) \ + } + +/** + * Set internationalized short names. + * + * @param j JSON object with internationalized short names + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_unit_name_short_i18n(j) \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT_I18N, \ + .details.unit_name_short_i18n = (j) \ + } + +/** + * Set whether fractional quantities are allowed. + * + * @param a true if fractional quantities are allowed + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_unit_allow_fraction(a) \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ALLOW_FRACTION \ + , \ + .details.unit_allow_fraction = (a) \ + } + +/** + * Set precision level for fractions. + * + * @param p precision level value + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_unit_precision_level(p) \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_PRECISION_LEVEL, \ + .details.unit_precision_level = (p) \ + } + +/** + * Set active status of the unit. + * + * @param a true if the unit should be active + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue + */ +#define TALER_MERCHANT_patch_private_unit_option_unit_active(a) \ + (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ACTIVE, \ + .details.unit_active = (a) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param uph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_patch_private_unit_set_options_ ( + struct TALER_MERCHANT_PatchPrivateUnitHandle *uph, + unsigned int num_options, + const struct TALER_MERCHANT_PatchPrivateUnitOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_patch_private_unit_set_options ( + * uph, + * TALER_MERCHANT_patch_private_unit_option_unit_name_long ("Kilogram"), + * TALER_MERCHANT_patch_private_unit_option_unit_active (true)); + * + * @param uph the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_patch_private_unit_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_patch_private_unit_set_options(uph,...) \ + TALER_MERCHANT_patch_private_unit_set_options_ ( \ + uph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PatchPrivateUnitOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_patch_private_unit_option_end_ () } \ + )) + + +/** + * Response details for a PATCH /private/units/$UNIT request. + */ +struct TALER_MERCHANT_PatchPrivateUnitResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchPrivateUnitCallback. + */ +#define TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /private/units/$UNIT request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchPrivateUnitCallback)( + TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchPrivateUnitResponse *result); + + +/** + * Start PATCH /private/units/$UNIT operation. + * + * @param[in,out] uph operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_private_unit_start ( + struct TALER_MERCHANT_PatchPrivateUnitHandle *uph, + TALER_MERCHANT_PatchPrivateUnitCallback cb, + TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /private/units/$UNIT operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] uph operation to cancel + */ +void +TALER_MERCHANT_patch_private_unit_cancel ( + struct TALER_MERCHANT_PatchPrivateUnitHandle *uph); + + +#endif /* _TALER_MERCHANT__PATCH_PRIVATE_UNITS_UNIT_H */ diff --git a/src/include/taler/merchant/patch-private-webhooks-WEBHOOK_ID.h b/src/include/taler/merchant/patch-private-webhooks-WEBHOOK_ID.h @@ -0,0 +1,260 @@ +/* + 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/merchant/patch-private-webhooks-WEBHOOK_ID.h + * @brief C interface for PATCH /private/webhooks/$WEBHOOK_ID + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__PATCH_PRIVATE_WEBHOOKS_WEBHOOK_ID_H +#define _TALER_MERCHANT__PATCH_PRIVATE_WEBHOOKS_WEBHOOK_ID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the PATCH /private/webhooks/$WEBHOOK_ID request. + */ +enum TALER_MERCHANT_PatchPrivateWebhookOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_END = 0, + + /** + * Set the header template. + */ + TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_HEADER_TEMPLATE, + + /** + * Set the body template. + */ + TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_BODY_TEMPLATE + +}; + + +/** + * Value for an option for the PATCH /private/webhooks/$WEBHOOK_ID request. + */ +struct TALER_MERCHANT_PatchPrivateWebhookOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PatchPrivateWebhookOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_HEADER_TEMPLATE. + */ + const char *header_template; + + /** + * Value if @e option is + * #TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_BODY_TEMPLATE. + */ + const char *body_template; + + } details; + +}; + + +/** + * Handle for a PATCH /private/webhooks/$WEBHOOK_ID operation. + */ +struct TALER_MERCHANT_PatchPrivateWebhookHandle; + + +/** + * Set up PATCH /private/webhooks/$WEBHOOK_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param webhook_id identifier of the webhook to update + * @param event_type new event type + * @param url_template new notification URL template + * @param http_method new HTTP method + * @return handle to operation, NULL on error + */ +struct TALER_MERCHANT_PatchPrivateWebhookHandle * +TALER_MERCHANT_patch_private_webhook_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *webhook_id, + const char *event_type, + const char *url_template, + const char *http_method); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PatchPrivateWebhookOptionValue + */ +#define TALER_MERCHANT_patch_private_webhook_option_end_() \ + (const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue) \ + { \ + .option = TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_END \ + } + +/** + * Set header template. + * + * @param ht header template string to set + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateWebhookOptionValue + */ +#define TALER_MERCHANT_patch_private_webhook_option_header_template(ht) \ + (const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_HEADER_TEMPLATE, \ + .details.header_template = (ht) \ + } + +/** + * Set body template. + * + * @param bt body template string to set + * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateWebhookOptionValue + */ +#define TALER_MERCHANT_patch_private_webhook_option_body_template(bt) \ + (const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_BODY_TEMPLATE, \ + .details.body_template = (bt) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param wph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_patch_private_webhook_set_options_ ( + struct TALER_MERCHANT_PatchPrivateWebhookHandle *wph, + unsigned int num_options, + const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_patch_private_webhook_set_options ( + * wph, + * TALER_MERCHANT_patch_private_webhook_option_header_template ( + * "Content-Type: application/json")); + * + * @param wph the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_patch_private_webhook_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_patch_private_webhook_set_options(wph,...) \ + TALER_MERCHANT_patch_private_webhook_set_options_ ( \ + wph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_patch_private_webhook_option_end_ () } \ + )) + + +/** + * Response details for a PATCH /private/webhooks/$WEBHOOK_ID request. + */ +struct TALER_MERCHANT_PatchPrivateWebhookResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +#ifndef TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PatchPrivateWebhookCallback. + */ +#define TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE */ + +/** + * Callback for a PATCH /private/webhooks/$WEBHOOK_ID request. + * + * @param cls closure + * @param result response details + */ +typedef void +(*TALER_MERCHANT_PatchPrivateWebhookCallback)( + TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PatchPrivateWebhookResponse *result); + + +/** + * Start PATCH /private/webhooks/$WEBHOOK_ID operation. + * + * @param[in,out] handle operation to start + * @param cb function to call with the result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_patch_private_webhook_start ( + struct TALER_MERCHANT_PatchPrivateWebhookHandle *handle, + TALER_MERCHANT_PatchPrivateWebhookCallback cb, + TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel PATCH /private/webhooks/$WEBHOOK_ID operation. + * This function must not be called by clients after the + * callback has been invoked. + * + * @param[in] handle operation to cancel + */ +void +TALER_MERCHANT_patch_private_webhook_cancel ( + struct TALER_MERCHANT_PatchPrivateWebhookHandle *handle); + + +#endif /* _TALER_MERCHANT__PATCH_PRIVATE_WEBHOOKS_WEBHOOK_ID_H */ diff --git a/src/include/taler/merchant/post-management-instances-INSTANCE-auth.h b/src/include/taler/merchant/post-management-instances-INSTANCE-auth.h @@ -0,0 +1,223 @@ +/* + 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/merchant/post-management-instances-INSTANCE-auth.h + * @brief C interface for the POST /management/instances/$INSTANCE/auth endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_INSTANCE_AUTH_H +#define _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_INSTANCE_AUTH_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a POST /management/instances/$INSTANCE/auth request. + */ +struct TALER_MERCHANT_PostManagementInstancesAuthHandle; + + +/** + * Response details for a POST /management/instances/$INSTANCE/auth request. + */ +struct TALER_MERCHANT_PostManagementInstancesAuthResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + /** + * Details on #MHD_HTTP_ACCEPTED. + */ + struct TALER_MERCHANT_MfaChallengeResponse accepted; + } details; + +}; + + +/** + * Options for POST /management/instances/$INSTANCE/auth. + */ +enum TALER_MERCHANT_PostManagementInstancesAuthOption +{ + /** + * Sentinel value, end of options. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_END = 0, + + /** + * Set the authentication password. If not set (or set to NULL), + * the "external" authentication method is used. + * Value type: const char *. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_PASSWORD +}; + + +/** + * Value for a POST /management/instances/$INSTANCE/auth option. + */ +struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue +{ + /** + * Which option is being set. + */ + enum TALER_MERCHANT_PostManagementInstancesAuthOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_PASSWORD. + */ + const char *password; + + } details; +}; + + +/** + * Set password. + * + * @param pw password to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_auth_option_password(pw) \ + (const struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_PASSWORD, \ + .details.password = (pw) \ + } + + +/** + * Set up POST /management/instances/$INSTANCE/auth operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param instance_id identifier of the instance + * @return handle to operation + */ +struct TALER_MERCHANT_PostManagementInstancesAuthHandle * +TALER_MERCHANT_post_management_instances_auth_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id); + + +/** + * Set options for POST /management/instances/$INSTANCE/auth operation. + * + * @param[in,out] piah the handle to set options for + * @param num_options length of the @a options array + * @param options array of option values (terminated with _END) + */ +void +TALER_MERCHANT_post_management_instances_auth_set_options_ ( + struct TALER_MERCHANT_PostManagementInstancesAuthHandle *piah, + unsigned int num_options, + const struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue options[]); + + +/** + * Maximum number of options for set_options macro. + */ +#define TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTIONS_ARRAY_MAX_SIZE 4 + +/** + * Set options for POST /management/instances/$INSTANCE/auth operation. + * Variadic macro wrapper around + * #TALER_MERCHANT_post_management_instances_auth_set_options_(). + * + * @param piah the handle to set options for + * @param ... option values (automatically terminated with _END) + */ +#define TALER_MERCHANT_post_management_instances_auth_set_options(piah, ...) \ + do { \ + struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue __opts[] = { \ + __VA_ARGS__, \ + { .option = TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_END } \ + }; \ + TALER_MERCHANT_post_management_instances_auth_set_options_ ( \ + piah, \ + sizeof (__opts) / sizeof (__opts[0]) - 1, \ + __opts); \ + } while (0) + + +#ifndef TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostManagementInstancesAuthCallback. + */ +#define TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE */ + +/** + * Callback for a POST /management/instances/$INSTANCE/auth request. + * + * @param cls closure + * @param iar response details + */ +typedef void +(*TALER_MERCHANT_PostManagementInstancesAuthCallback)( + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostManagementInstancesAuthResponse *iar); + + +/** + * Start POST /management/instances/$INSTANCE/auth operation. + * + * @param[in,out] piah operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_management_instances_auth_start ( + struct TALER_MERCHANT_PostManagementInstancesAuthHandle *piah, + TALER_MERCHANT_PostManagementInstancesAuthCallback cb, + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /management/instances/$INSTANCE/auth operation. This function + * must not be called by clients after the + * TALER_MERCHANT_PostManagementInstancesAuthCallback has been invoked (as in + * those cases it'll be called internally by the implementation already). + * + * @param[in] piah operation to cancel + */ +void +TALER_MERCHANT_post_management_instances_auth_cancel ( + struct TALER_MERCHANT_PostManagementInstancesAuthHandle *piah); + + +#endif /* _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_INSTANCE_AUTH_H */ diff --git a/src/include/taler/merchant/post-management-instances.h b/src/include/taler/merchant/post-management-instances.h @@ -0,0 +1,452 @@ +/* + 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/merchant/post-management-instances.h + * @brief C interface for the POST /management/instances endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_H +#define _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the POST /management/instances request. + */ +enum TALER_MERCHANT_PostManagementInstancesOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_END = 0, + + /** + * Set the default pay delay. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, + + /** + * Set the default refund delay. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, + + /** + * Set the default wire transfer delay. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, + + /** + * Set the default wire transfer rounding interval. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, + + /** + * Set the email address. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_EMAIL, + + /** + * Set the phone number. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, + + /** + * Set the website URL. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_WEBSITE, + + /** + * Set the logo. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_LOGO, + + /** + * Set the authentication password. + */ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_AUTH_PASSWORD + +}; + + +/** + * Value for an option for the POST /management/instances request. + */ +struct TALER_MERCHANT_PostManagementInstancesOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostManagementInstancesOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY. + */ + struct GNUNET_TIME_Relative default_pay_delay; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY. + */ + struct GNUNET_TIME_Relative default_refund_delay; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY. + */ + struct GNUNET_TIME_Relative default_wire_transfer_delay; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL. + */ + enum GNUNET_TIME_RounderInterval default_wire_transfer_rounding_interval; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_EMAIL. + */ + const char *email; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER. + */ + const char *phone_number; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_WEBSITE. + */ + const char *website; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_LOGO. + */ + const char *logo; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_AUTH_PASSWORD. + */ + const char *auth_password; + + } details; + +}; + + +/** + * Handle for a POST /management/instances request. + */ +struct TALER_MERCHANT_PostManagementInstancesHandle; + + +/** + * Response details for a POST /management/instances request. + */ +struct TALER_MERCHANT_PostManagementInstancesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + /** + * Details on #MHD_HTTP_ACCEPTED. + */ + struct TALER_MERCHANT_MfaChallengeResponse accepted; + } details; + +}; + + +/** + * Set up POST /management/instances operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param instance_id identifier for the new instance + * @param name human-readable name + * @param address address (JSON) + * @param jurisdiction jurisdiction (JSON) + * @param use_stefan whether to use the STEFAN curve for fee calculations + * @return handle to operation + */ +struct TALER_MERCHANT_PostManagementInstancesHandle * +TALER_MERCHANT_post_management_instances_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id, + const char *name, + const json_t *address, + const json_t *jurisdiction, + bool use_stefan); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PostManagementInstancesOptionValue + */ +#define TALER_MERCHANT_post_management_instances_option_end_() \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_END \ + } + +/** + * Set default pay delay. + * + * @param d delay to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_default_pay_delay(d) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, \ + .details.default_pay_delay = (d) \ + } + +/** + * Set default refund delay. + * + * @param d delay to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_default_refund_delay(d) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, \ + .details.default_refund_delay = (d) \ + } + +/** + * Set default wire transfer delay. + * + * @param d delay to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_default_wire_transfer_delay(d) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, \ + .details.default_wire_transfer_delay = (d) \ + } + +/** + * Set default wire transfer rounding interval. + * + * @param ri rounding interval to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_default_wire_transfer_rounding_interval(ri) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, \ + .details.default_wire_transfer_rounding_interval = (ri) \ + } + +/** + * Set email address. + * + * @param e email to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_email(e) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_EMAIL, \ + .details.email = (e) \ + } + +/** + * Set phone number. + * + * @param p phone number to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_phone_number(p) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, \ + .details.phone_number = (p) \ + } + +/** + * Set website URL. + * + * @param w website to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_website(w) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_WEBSITE, \ + .details.website = (w) \ + } + +/** + * Set logo. + * + * @param l logo to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_logo(l) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_LOGO, \ + .details.logo = (l) \ + } + +/** + * Set authentication password. + * + * @param pw password to set + * @return representation of the option + */ +#define TALER_MERCHANT_post_management_instances_option_auth_password(pw) \ + (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_AUTH_PASSWORD, \ + .details.auth_password = (pw) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param pmih the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_management_instances_set_options_ ( + struct TALER_MERCHANT_PostManagementInstancesHandle *pmih, + unsigned int num_options, + const struct TALER_MERCHANT_PostManagementInstancesOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_post_management_instances_set_options ( + * pmih, + * TALER_MERCHANT_post_management_instances_option_email ( + * "foo@example.com")); + * + * @param pmih the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_post_management_instances_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_management_instances_set_options(pmih,...) \ + TALER_MERCHANT_post_management_instances_set_options_ ( \ + pmih, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostManagementInstancesOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_management_instances_option_end_ () \ + } \ + )) + + +#ifndef TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostManagementInstancesCallback. + */ +#define TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE */ + +/** + * Callback for a POST /management/instances request. + * + * @param cls closure + * @param mir response details + */ +typedef void +(*TALER_MERCHANT_PostManagementInstancesCallback)( + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostManagementInstancesResponse *mir); + + +/** + * Start POST /management/instances operation. + * + * @param[in,out] pmih operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_management_instances_start ( + struct TALER_MERCHANT_PostManagementInstancesHandle *pmih, + TALER_MERCHANT_PostManagementInstancesCallback cb, + TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /management/instances operation. This function must not be + * called by clients after the TALER_MERCHANT_PostManagementInstancesCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] pmih operation to cancel + */ +void +TALER_MERCHANT_post_management_instances_cancel ( + struct TALER_MERCHANT_PostManagementInstancesHandle *pmih); + + +#endif /* _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_H */ diff --git a/src/include/taler/merchant/post-orders-ORDER_ID-abort.h b/src/include/taler/merchant/post-orders-ORDER_ID-abort.h @@ -0,0 +1,250 @@ +/* + 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/merchant/post-orders-ORDER_ID-abort.h + * @brief C interface for the POST /orders/$ORDER_ID/abort endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_ABORT_H +#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_ABORT_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a POST /orders/$ORDER_ID/abort request. + */ +struct TALER_MERCHANT_PostOrdersAbortHandle; + + +/** + * One coin used in an abort request. + */ +struct TALER_MERCHANT_PostOrdersAbortCoin +{ + + /** + * Base URL of the exchange this coin was issued by. + */ + const char *exchange_url; + + /** + * Public key of the coin. + */ + struct TALER_CoinSpendPublicKeyP coin_pub; + + /** + * Total amount contributed including deposit fee. + */ + struct TALER_Amount amount_with_fee; + + /** + * Hash of the denomination public key. + */ + struct TALER_DenominationHashP denom_pub_hash; + + /** + * Denomination signature over the coin. + */ + struct TALER_DenominationSignature denom_sig; + + /** + * Amount contributed without the deposit fee. + */ + struct TALER_Amount contribution; + +}; + + +/** + * Result for one coin from an abort operation. + */ +struct TALER_MERCHANT_PostOrdersAbortedCoin +{ + + /** + * Exchange signature confirming the refund. + */ + struct TALER_ExchangeSignatureP exchange_sig; + + /** + * Exchange public key used for @e exchange_sig. + */ + struct TALER_ExchangePublicKeyP exchange_pub; + + /** + * Public key of the coin. + */ + struct TALER_CoinSpendPublicKeyP coin_pub; + +}; + + +/** + * Response details for a POST /orders/$ORDER_ID/abort request. + */ +struct TALER_MERCHANT_PostOrdersAbortResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of aborted coins in @a aborts. + */ + unsigned int num_aborts; + + /** + * Array of aborted coin results. + */ + const struct TALER_MERCHANT_PostOrdersAbortedCoin *aborts; + + } ok; + + /** + * Details on #MHD_HTTP_BAD_GATEWAY. + * The response body has the same refunds array as on + * #MHD_HTTP_OK, but at least one coin had an exchange error. + */ + struct + { + + /** + * Number of aborted coins in @a aborts. + */ + unsigned int num_aborts; + + /** + * Array of aborted coin results. + */ + const struct TALER_MERCHANT_PostOrdersAbortedCoin *aborts; + + } bad_gateway; + + /** + * Details on #MHD_HTTP_GATEWAY_TIMEOUT. + */ + struct + { + + /** + * Taler error code from the exchange, if available. + */ + enum TALER_ErrorCode exchange_ec; + + /** + * HTTP status code returned by the exchange, if available. + * 0 if no exchange was involved or the request timed out + * before a response was received. + */ + unsigned int exchange_http_status; + + } gateway_timeout; + + } details; + +}; + + +/** + * Set up POST /orders/$ORDER_ID/abort operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order to abort + * @param merchant_pub merchant public key + * @param h_contract hash of the contract terms + * @param num_coins number of coins in @a coins + * @param coins array of coins used in the aborted payment + * @return handle to operation + */ +struct TALER_MERCHANT_PostOrdersAbortHandle * +TALER_MERCHANT_post_orders_abort_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct TALER_PrivateContractHashP *h_contract, + unsigned int num_coins, + const struct TALER_MERCHANT_PostOrdersAbortCoin coins[static num_coins]); + + +#ifndef TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostOrdersAbortCallback. + */ +#define TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE */ + +/** + * Callback for a POST /orders/$ORDER_ID/abort request. + * + * @param cls closure + * @param oar response details + */ +typedef void +(*TALER_MERCHANT_PostOrdersAbortCallback)( + TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostOrdersAbortResponse *oar); + + +/** + * Start POST /orders/$ORDER_ID/abort operation. + * + * @param[in,out] poah operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_orders_abort_start ( + struct TALER_MERCHANT_PostOrdersAbortHandle *poah, + TALER_MERCHANT_PostOrdersAbortCallback cb, + TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /orders/$ORDER_ID/abort operation. This function must not be + * called by clients after the TALER_MERCHANT_PostOrdersAbortCallback has + * been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] poah operation to cancel + */ +void +TALER_MERCHANT_post_orders_abort_cancel ( + struct TALER_MERCHANT_PostOrdersAbortHandle *poah); + + +#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_ABORT_H */ diff --git a/src/include/taler/merchant/post-orders-ORDER_ID-claim.h b/src/include/taler/merchant/post-orders-ORDER_ID-claim.h @@ -0,0 +1,252 @@ +/* + 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/merchant/post-orders-ORDER_ID-claim.h + * @brief C interface for the POST /orders/$ORDER_ID/claim endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_CLAIM_H +#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_CLAIM_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /orders/$ORDER_ID/claim request. + */ +enum TALER_MERCHANT_PostOrdersClaimOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_END = 0, + + /** + * Claim token for the order. + */ + TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_TOKEN + +}; + + +/** + * Value for an option for the POST /orders/$ORDER_ID/claim request. + */ +struct TALER_MERCHANT_PostOrdersClaimOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostOrdersClaimOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_TOKEN. + */ + const struct TALER_ClaimTokenP *token; + + } details; + +}; + + +/** + * Handle for a POST /orders/$ORDER_ID/claim request. + */ +struct TALER_MERCHANT_PostOrdersClaimHandle; + + +/** + * Response details for a POST /orders/$ORDER_ID/claim request. + */ +struct TALER_MERCHANT_PostOrdersClaimResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * The claimed contract terms. + */ + const json_t *contract_terms; + + /** + * Hash of the contract terms. + */ + struct TALER_PrivateContractHashP h_contract_terms; + + /** + * Merchant signature over the contract terms. + */ + struct TALER_MerchantSignatureP merchant_sig; + + } ok; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PostOrdersClaimOptionValue + */ +#define TALER_MERCHANT_post_orders_claim_option_end_() \ + (const struct TALER_MERCHANT_PostOrdersClaimOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_END \ + } + +/** + * Set claim token. + * + * @param t claim token to use + * @return representation of the option as a struct TALER_MERCHANT_PostOrdersClaimOptionValue + */ +#define TALER_MERCHANT_post_orders_claim_option_token(t) \ + (const struct TALER_MERCHANT_PostOrdersClaimOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_TOKEN, \ + .details.token = (t) \ + } + + +/** + * Set the requested options for the operation. + * + * @param poch the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_orders_claim_set_options_ ( + struct TALER_MERCHANT_PostOrdersClaimHandle *poch, + unsigned int num_options, + const struct TALER_MERCHANT_PostOrdersClaimOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param poch the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_orders_claim_set_options(poch,...) \ + TALER_MERCHANT_post_orders_claim_set_options_ ( \ + poch, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostOrdersClaimOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_orders_claim_option_end_ () } \ + )) + + +/** + * Set up POST /orders/$ORDER_ID/claim operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order to claim + * @param nonce wallet nonce for claiming + * @return handle to operation + */ +struct TALER_MERCHANT_PostOrdersClaimHandle * +TALER_MERCHANT_post_orders_claim_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + const struct GNUNET_CRYPTO_EddsaPublicKey *nonce); + + +#ifndef TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostOrdersClaimCallback. + */ +#define TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE */ + +/** + * Callback for a POST /orders/$ORDER_ID/claim request. + * + * @param cls closure + * @param ocr response details + */ +typedef void +(*TALER_MERCHANT_PostOrdersClaimCallback)( + TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostOrdersClaimResponse *ocr); + + +/** + * Start POST /orders/$ORDER_ID/claim operation. + * + * @param[in,out] poch operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_orders_claim_start ( + struct TALER_MERCHANT_PostOrdersClaimHandle *poch, + TALER_MERCHANT_PostOrdersClaimCallback cb, + TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /orders/$ORDER_ID/claim operation. This function must not be + * called by clients after the TALER_MERCHANT_PostOrdersClaimCallback has + * been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] poch operation to cancel + */ +void +TALER_MERCHANT_post_orders_claim_cancel ( + struct TALER_MERCHANT_PostOrdersClaimHandle *poch); + + +#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_CLAIM_H */ diff --git a/src/include/taler/merchant/post-orders-ORDER_ID-paid.h b/src/include/taler/merchant/post-orders-ORDER_ID-paid.h @@ -0,0 +1,227 @@ +/* + 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/merchant/post-orders-ORDER_ID-paid.h + * @brief C interface for the POST /orders/$ORDER_ID/paid endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAID_H +#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /orders/$ORDER_ID/paid request. + */ +enum TALER_MERCHANT_PostOrdersPaidOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_ORDERS_PAID_OPTION_END = 0, + +}; + + +/** + * Value for an option for the POST /orders/$ORDER_ID/paid request. + */ +struct TALER_MERCHANT_PostOrdersPaidOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostOrdersPaidOption option; + + /** + * Specific option value. + */ + union + { + + } details; + +}; + + +/** + * Handle for a POST /orders/$ORDER_ID/paid request. + */ +struct TALER_MERCHANT_PostOrdersPaidHandle; + + +/** + * Response details for a POST /orders/$ORDER_ID/paid request. + */ +struct TALER_MERCHANT_PostOrdersPaidResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Response details depending on HTTP status. + */ + union + { + + /** + * Details if HTTP status is #MHD_HTTP_OK. + */ + struct + { + + /** + * POS confirmation string, or NULL if not available. + */ + const char *pos_confirmation; + + /** + * True if the order has been refunded. + */ + bool refunded; + + } ok; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PostOrdersPaidOptionValue + */ +#define TALER_MERCHANT_post_orders_paid_option_end_() \ + (const struct TALER_MERCHANT_PostOrdersPaidOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAID_OPTION_END \ + } + + +/** + * Set the requested options for the operation. + * + * @param poph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_orders_paid_set_options_ ( + struct TALER_MERCHANT_PostOrdersPaidHandle *poph, + unsigned int num_options, + const struct TALER_MERCHANT_PostOrdersPaidOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param poph the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_orders_paid_set_options(poph,...) \ + TALER_MERCHANT_post_orders_paid_set_options_ ( \ + poph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostOrdersPaidOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_orders_paid_option_end_ () } \ + )) + + +/** + * Set up POST /orders/$ORDER_ID/paid operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order + * @param session_id session identifier + * @param h_contract_terms hash of the contract terms + * @param merchant_sig merchant signature over the session data + * @return handle to operation + */ +struct TALER_MERCHANT_PostOrdersPaidHandle * +TALER_MERCHANT_post_orders_paid_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + const char *session_id, + const struct TALER_PrivateContractHashP *h_contract_terms, + const struct TALER_MerchantSignatureP *merchant_sig); + + +#ifndef TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostOrdersPaidCallback. + */ +#define TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE */ + +/** + * Callback for a POST /orders/$ORDER_ID/paid request. + * + * @param cls closure + * @param opr response details + */ +typedef void +(*TALER_MERCHANT_PostOrdersPaidCallback)( + TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostOrdersPaidResponse *opr); + + +/** + * Start POST /orders/$ORDER_ID/paid operation. + * + * @param[in,out] poph operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_orders_paid_start ( + struct TALER_MERCHANT_PostOrdersPaidHandle *poph, + TALER_MERCHANT_PostOrdersPaidCallback cb, + TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /orders/$ORDER_ID/paid operation. This function must not be + * called by clients after the TALER_MERCHANT_PostOrdersPaidCallback has + * been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] poph operation to cancel + */ +void +TALER_MERCHANT_post_orders_paid_cancel ( + struct TALER_MERCHANT_PostOrdersPaidHandle *poph); + + +#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAID_H */ diff --git a/src/include/taler/merchant/post-orders-ORDER_ID-pay.h b/src/include/taler/merchant/post-orders-ORDER_ID-pay.h @@ -0,0 +1,788 @@ +/* + 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/merchant/post-orders-ORDER_ID-pay.h + * @brief C interface for the POST /orders/$ORDER_ID/pay endpoint + * @author Christian Grothoff + * @author Marcello Stanisci + */ +#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAY_H +#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAY_H + +#include <taler/merchant/common.h> + +/** + * Forward-declaration here to keep the API stable even if + * the Donau header is not available. + */ +struct DONAU_BlindedUniqueDonorIdentifierKeyPair; + +/** + * One coin used to pay (frontend / external wallet mode). + */ +struct TALER_MERCHANT_PostOrdersPayPaidCoin +{ + + /** + * Denomination public key. + */ + struct TALER_DenominationPublicKey denom_pub; + + /** + * Hash of the denomination public key. + */ + struct TALER_DenominationHashP denom_pub_hash; + + /** + * Denomination signature over the coin. + */ + struct TALER_DenominationSignature denom_sig; + + /** + * Face value of the denomination. + */ + struct TALER_Amount denom_value; + + /** + * Public key of the coin. + */ + struct TALER_CoinSpendPublicKeyP coin_pub; + + /** + * Signature by the coin authorizing the deposit. + */ + struct TALER_CoinSpendSignatureP coin_sig; + + /** + * Hash of the age commitment for this coin. + */ + struct TALER_AgeCommitmentHashP h_age_commitment; + + /** + * Set to true if this coin has an age commitment. + */ + bool has_age_commitment; + + /** + * Total amount contributed including deposit fee. + */ + struct TALER_Amount amount_with_fee; + + /** + * Amount contributed without the deposit fee. + */ + struct TALER_Amount amount_without_fee; + + /** + * Deposit fee for this coin. + */ + struct TALER_Amount deposit_fee; + + /** + * Base URL of the exchange this coin was issued by. + */ + char *exchange_url; + +}; + + +/** + * One coin used to pay (wallet-internal mode, private key available). + */ +struct TALER_MERCHANT_PostOrdersPayCoin +{ + + /** + * Denomination public key. + */ + struct TALER_DenominationPublicKey denom_pub; + + /** + * Denomination signature over the coin. + */ + struct TALER_DenominationSignature denom_sig; + + /** + * Face value of the denomination. + */ + struct TALER_Amount denom_value; + + /** + * Private key of the coin (to sign the deposit). + */ + struct TALER_CoinSpendPrivateKeyP coin_priv; + + /** + * Hash of the age commitment for this coin, or + * all zeros if none. + */ + struct TALER_AgeCommitmentHashP h_age_commitment; + + /** + * Total amount contributed including deposit fee. + */ + struct TALER_Amount amount_with_fee; + + /** + * Amount contributed without the deposit fee. + */ + struct TALER_Amount amount_without_fee; + + /** + * URL of the exchange that issued @e coin_priv. + */ + char *exchange_url; + +}; + + +/** + * Token to use for payment (public form, already obtained). + */ +struct TALER_MERCHANT_PostOrdersPayUsedToken +{ + + /** + * Signature on TALER_TokenUseRequestPS made with the token use private key. + */ + struct TALER_TokenUseSignatureP token_sig; + + /** + * Public key of the token. + */ + struct TALER_TokenUsePublicKeyP token_pub; + + /** + * Unblinded signature made by the token issue public key of the merchant. + */ + struct TALER_TokenIssueSignature ub_sig; + + /** + * Token issue public key associated with this token. + */ + struct TALER_TokenIssuePublicKey issue_pub; + +}; + + +/** + * Information we need from the wallet to use a token for an order. + */ +struct TALER_MERCHANT_PostOrdersPayUseToken +{ + + /** + * Private key of the token (to sign the use authorization). + */ + struct TALER_TokenUsePrivateKeyP token_priv; + + /** + * Unblinded signature made by the token issue public key of the merchant. + */ + struct TALER_TokenIssueSignature ub_sig; + + /** + * Token issue public key associated with this token. + */ + struct TALER_TokenIssuePublicKey issue_pub; + +}; + + +/** + * Output token: used both as input to pay (envelope to be signed) + * and as output in the pay response (blind signature received). + */ +struct TALER_MERCHANT_PostOrdersPayOutputToken +{ + + /** + * Blinded token envelope to be signed by the issuer (input to pay). + */ + struct TALER_TokenEnvelope envelope; + + /** + * Blinded token issue signature received from the issuer (output of pay). + */ + struct TALER_BlindedTokenIssueSignature blinded_sig; + +}; + + +/** + * Possible options for the POST /orders/$ORDER_ID/pay request. + */ +enum TALER_MERCHANT_PostOrdersPayOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_END = 0, + + /** + * Session identifier for session-bound payments. + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_SESSION_ID, + + /** + * Wallet-specific data (JSON). + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_WALLET_DATA, + + /** + * Used tokens (public form, for frontend mode). + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USED_TOKENS, + + /** + * Use tokens (private form, for wallet mode). + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USE_TOKENS, + + /** + * Output tokens (for wallet mode). + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS, + + /** + * Output tokens as JSON array (for frontend mode). + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS_JSON, + + /** + * Output donation receipts. + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_DONAU, + + /** + * Payment choice index (wallet mode). + */ + TALER_MERCHANT_POST_ORDERS_PAY_OPTION_CHOICE_INDEX + +}; + + +/** + * Value for an option for the POST /orders/$ORDER_ID/pay request. + */ +struct TALER_MERCHANT_PostOrdersPayOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostOrdersPayOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_SESSION_ID. + */ + const char *session_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_WALLET_DATA. + */ + const json_t *wallet_data; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USED_TOKENS. + */ + struct + { + /** + * Length of @e tokens array + */ + unsigned int num; + const struct TALER_MERCHANT_PostOrdersPayUsedToken *tokens; + } used_tokens; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USE_TOKENS. + */ + struct + { + /** + * Length of @e tokens array + */ + unsigned int num; + const struct TALER_MERCHANT_PostOrdersPayUseToken *tokens; + } use_tokens; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS. + */ + struct + { + /** + * Length of @e tokens array + */ + unsigned int num; + const struct TALER_MERCHANT_PostOrdersPayOutputToken *tokens; + } output_tokens; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS_JSON. + */ + json_t *output_tokens_json; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_DONAU. + */ + struct + { + /** + * Base URL of the donau. + */ + const char *donau_base_url; + + /** + * Array of blinded dontation receipts. + */ + const struct DONAU_BlindedUniqueDonorIdentifierKeyPair *bkps; + + /** + * Length of @e bkps array + */ + size_t num_bkps; + + /** + * Year for which the donation receipts are issued. + */ + uint64_t year; + } output_donau; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_CHOICE_INDEX. + */ + int choice_index; + + } details; + +}; + + +/** + * Handle for a POST /orders/$ORDER_ID/pay request. + */ +struct TALER_MERCHANT_PostOrdersPayHandle; + + +/** + * Response details for a POST /orders/$ORDER_ID/pay request. + */ +struct TALER_MERCHANT_PostOrdersPayResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Merchant signature confirming the payment. + */ + struct TALER_MerchantSignatureP merchant_sig; + + /** + * POS confirmation string, or NULL if not applicable. + */ + const char *pos_confirmation; + + /** + * Number of output tokens in @a tokens. + */ + unsigned int num_tokens; + + /** + * Array of output tokens issued upon payment. + */ + struct TALER_MERCHANT_PostOrdersPayOutputToken *tokens; + + } ok; + + /** + * Details on #MHD_HTTP_CONFLICT. + * Set when a coin was already spent (insufficient funds) or + * the order was already fully paid. + */ + struct + { + + /** + * Base URL of the exchange that reported the conflict, + * or NULL if not applicable. + */ + const char *exchange_url; + + /** + * Taler error code from the exchange, if available. + */ + enum TALER_ErrorCode exchange_ec; + + /** + * HTTP status code returned by the exchange, if available. + */ + unsigned int exchange_http_status; + + } conflict; + + /** + * Details on #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. + */ + struct + { + + /** + * Number of exchange URLs in @a exchanges. + */ + unsigned int num_exchanges; + + /** + * Array of exchange URLs that refused the payment for legal reasons. + */ + const char **exchanges; + + } unavailable_for_legal_reasons; + + /** + * Details on #MHD_HTTP_BAD_GATEWAY. + * The merchant's interaction with the exchange failed. + */ + struct + { + + /** + * Base URL of the exchange that returned an error, + * or NULL if not available. + */ + const char *exchange_url; + + /** + * Taler error code from the exchange, if available. + */ + enum TALER_ErrorCode exchange_ec; + + /** + * HTTP status code returned by the exchange, if available. + */ + unsigned int exchange_http_status; + + } bad_gateway; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_orders_pay_option_end_() \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_END \ + } + +/** + * Set session identifier. + * + * @param s session ID + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_session_id(s) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_SESSION_ID, \ + .details.session_id = (s) \ + } + +/** + * Set wallet-specific data. + * + * @param w wallet data JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_wallet_data(w) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_WALLET_DATA, \ + .details.wallet_data = (w) \ + } + +/** + * Set used tokens (public form, for frontend mode). + * + * @param n number of tokens + * @param t array of used tokens + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_used_tokens(n,t) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USED_TOKENS, \ + .details.used_tokens = { .num = (n), .tokens = (t) } \ + } + +/** + * Set use tokens (private form, for wallet mode). + * + * @param n number of tokens + * @param t array of use tokens + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_use_tokens(n,t) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USE_TOKENS, \ + .details.use_tokens = { .num = (n), .tokens = (t) } \ + } + +/** + * Set output tokens (for wallet mode). + * + * @param n number of output tokens + * @param t array of output tokens + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_output_tokens(n,t) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS, \ + .details.output_tokens = { .num = (n), .tokens = (t) } \ + } + +/** + * Set output tokens as JSON array (for frontend mode). + * + * @param j JSON array describing desired output tokens + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_output_tokens_json(j) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS_JSON, \ + .details.output_tokens_json = (j) \ + } + + +/** + * Set blinded donation receipts as output. + * + * @param u base URL of the selected Donau + * @param y year for which receipts are requested + * @param l length of the @a bkps array + * @param a array of blinded donation receipts + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_output_donau(u,y,l,a) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_DONAU, \ + .details.output_donau.donau_base_url = (u), \ + .details.output_donau.bkps = (a), \ + .details.output_donau.num_bkps = (l), \ + .details.output_donau.year = (y) \ + } + +/** + * Set payment choice index (wallet mode). + * Use -1 to indicate no choice (the default). + * + * @param i choice index + * @return representation of the option + */ +#define TALER_MERCHANT_post_orders_pay_option_choice_index(i) \ + (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_CHOICE_INDEX, \ + .details.choice_index = (i) \ + } + + +/** + * Set the requested options for the operation. + * + * @param poph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_orders_pay_set_options_ ( + struct TALER_MERCHANT_PostOrdersPayHandle *poph, + unsigned int num_options, + const struct TALER_MERCHANT_PostOrdersPayOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param poph the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_orders_pay_set_options(poph,...) \ + TALER_MERCHANT_post_orders_pay_set_options_ ( \ + poph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostOrdersPayOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_orders_pay_option_end_ () } \ + )) + + +/** + * Set up POST /orders/$ORDER_ID/pay operation in frontend mode + * (coins already signed by the wallet). + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order to pay + * @param num_coins number of coins in @a coins + * @param coins array of coins to pay with (already signed) + * @return handle to operation + */ +struct TALER_MERCHANT_PostOrdersPayHandle * +TALER_MERCHANT_post_orders_pay_frontend_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + unsigned int num_coins, + const struct TALER_MERCHANT_PostOrdersPayPaidCoin coins[static num_coins]); + + +/** + * Set up POST /orders/$ORDER_ID/pay operation in wallet-internal mode + * (signing done internally). + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order to pay + * @param h_contract_terms hash of the contract terms + * @param amount total payment amount + * @param max_fee maximum acceptable fee + * @param merchant_pub merchant public key + * @param merchant_sig merchant signature + * @param timestamp contract timestamp + * @param refund_deadline refund deadline + * @param pay_deadline payment deadline + * @param h_wire hash of the merchant wire details + * @param num_coins number of coins in @a coins + * @param coins array of coins with private keys + * @return handle to operation + */ +struct TALER_MERCHANT_PostOrdersPayHandle * +TALER_MERCHANT_post_orders_pay_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + const struct TALER_PrivateContractHashP *h_contract_terms, + const struct TALER_Amount *amount, + const struct TALER_Amount *max_fee, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct TALER_MerchantSignatureP *merchant_sig, + struct GNUNET_TIME_Timestamp timestamp, + struct GNUNET_TIME_Timestamp refund_deadline, + struct GNUNET_TIME_Timestamp pay_deadline, + const struct TALER_MerchantWireHashP *h_wire, + unsigned int num_coins, + const struct TALER_MERCHANT_PostOrdersPayCoin coins[static num_coins]); + + +#ifndef TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostOrdersPayCallback. + */ +#define TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE */ + +/** + * Callback for a POST /orders/$ORDER_ID/pay request. + * + * @param cls closure + * @param opr response details + */ +typedef void +(*TALER_MERCHANT_PostOrdersPayCallback)( + TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostOrdersPayResponse *opr); + + +/** + * Start POST /orders/$ORDER_ID/pay operation. + * + * @param[in,out] poph operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_orders_pay_start ( + struct TALER_MERCHANT_PostOrdersPayHandle *poph, + TALER_MERCHANT_PostOrdersPayCallback cb, + TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /orders/$ORDER_ID/pay operation. This function must not be + * called by clients after the TALER_MERCHANT_PostOrdersPayCallback has + * been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] poph operation to cancel + */ +void +TALER_MERCHANT_post_orders_pay_cancel ( + struct TALER_MERCHANT_PostOrdersPayHandle *poph); + + +#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAY_H */ diff --git a/src/include/taler/merchant/post-orders-ORDER_ID-refund.h b/src/include/taler/merchant/post-orders-ORDER_ID-refund.h @@ -0,0 +1,221 @@ +/* + 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/merchant/post-orders-ORDER_ID-refund.h + * @brief C interface for the POST /orders/$ORDER_ID/refund endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_REFUND_H +#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_REFUND_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a POST /orders/$ORDER_ID/refund request. + */ +struct TALER_MERCHANT_PostOrdersRefundHandle; + + +/** + * Details about one refund from the exchange. + */ +struct TALER_MERCHANT_PostOrdersRefundDetail +{ + + /** + * Exchange signature confirming the refund. + */ + struct TALER_ExchangeSignatureP exchange_sig; + + /** + * Exchange public key used for @e exchange_sig. + */ + struct TALER_ExchangePublicKeyP exchange_pub; + + /** + * Hash of the contract terms. + */ + struct TALER_PrivateContractHashP h_contract_terms; + + /** + * Merchant public key. + */ + struct TALER_MerchantPublicKeyP merchant_pub; + + /** + * Refund transaction ID. + */ + uint64_t rtransaction_id; + + /** + * Public key of the refunded coin. + */ + struct TALER_CoinSpendPublicKeyP coin_pub; + + /** + * Refund amount. + */ + struct TALER_Amount refund_amount; + + /** + * Refund fee charged by the exchange. + */ + struct TALER_Amount refund_fee; + + /** + * HTTP status returned by the exchange for this refund, 0 if not yet + * obtained. + */ + unsigned int exchange_http_status; + + /** + * Taler error code returned by the exchange. + */ + enum TALER_ErrorCode ec; + + /** + * Full exchange reply (JSON), or NULL. + */ + const json_t *exchange_reply; + + /** + * HTTP response details from the exchange. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Response details for a POST /orders/$ORDER_ID/refund request. + */ +struct TALER_MERCHANT_PostOrdersRefundResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Number of refund details in @a refunds. + */ + unsigned int num_refunds; + + /** + * Array of refund details. + */ + const struct TALER_MERCHANT_PostOrdersRefundDetail *refunds; + + /** + * Total effective refund amount. + */ + struct TALER_Amount refund_amount; + + /** + * Merchant public key. + */ + struct TALER_MerchantPublicKeyP merchant_pub; + + } ok; + + } details; + +}; + + +/** + * Set up POST /orders/$ORDER_ID/refund operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order + * @param h_contract_terms hash of the contract terms + * @return handle to operation + */ +struct TALER_MERCHANT_PostOrdersRefundHandle * +TALER_MERCHANT_post_orders_refund_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + const struct TALER_PrivateContractHashP *h_contract_terms); + + +#ifndef TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostOrdersRefundCallback. + */ +#define TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE */ + +/** + * Callback for a POST /orders/$ORDER_ID/refund request. + * + * @param cls closure + * @param orr response details + */ +typedef void +(*TALER_MERCHANT_PostOrdersRefundCallback)( + TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostOrdersRefundResponse *orr); + + +/** + * Start POST /orders/$ORDER_ID/refund operation. + * + * @param[in,out] porh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_orders_refund_start ( + struct TALER_MERCHANT_PostOrdersRefundHandle *porh, + TALER_MERCHANT_PostOrdersRefundCallback cb, + TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /orders/$ORDER_ID/refund operation. This function must not be + * called by clients after the TALER_MERCHANT_PostOrdersRefundCallback has + * been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] porh operation to cancel + */ +void +TALER_MERCHANT_post_orders_refund_cancel ( + struct TALER_MERCHANT_PostOrdersRefundHandle *porh); + + +#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_REFUND_H */ diff --git a/src/include/taler/merchant/post-private-accounts.h b/src/include/taler/merchant/post-private-accounts.h @@ -0,0 +1,301 @@ +/* + 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/merchant/post-private-accounts.h + * @brief C interface for the POST /private/accounts endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_ACCOUNTS_H +#define _TALER_MERCHANT__POST_PRIVATE_ACCOUNTS_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /private/accounts request. + */ +enum TALER_MERCHANT_PostPrivateAccountsOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_END = 0, + + /** + * URL of the credit facade. + */ + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_URL, + + /** + * Credentials for the credit facade (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_CREDENTIALS, + + /** + * Extra wire subject metadata (restricted text). + */ + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_EXTRA_WIRE_SUBJECT_METADATA + +}; + + +/** + * Value for an option for the POST /private/accounts request. + */ +struct TALER_MERCHANT_PostPrivateAccountsOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateAccountsOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_URL. + */ + const char *credit_facade_url; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_CREDENTIALS. + */ + const json_t *credit_facade_credentials; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_EXTRA_WIRE_SUBJECT_METADATA. + */ + const char *extra_wire_subject_metadata; + + } details; + +}; + + +/** + * Handle for a POST /private/accounts request. + */ +struct TALER_MERCHANT_PostPrivateAccountsHandle; + + +/** + * Response details for a POST /private/accounts request. + */ +struct TALER_MERCHANT_PostPrivateAccountsResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Hash of the wire details for the newly created account. + */ + struct TALER_MerchantWireHashP h_wire; + + /** + * Salt used in the wire hash computation. + */ + struct TALER_WireSaltP salt; + + } ok; + + /** + * Details on #MHD_HTTP_ACCEPTED. + */ + struct TALER_MERCHANT_MfaChallengeResponse accepted; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PostPrivateAccountsOptionValue + */ +#define TALER_MERCHANT_post_private_accounts_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_END \ + } + +/** + * Set credit facade URL. + * + * @param u credit facade URL + * @return representation of the option as a struct TALER_MERCHANT_PostPrivateAccountsOptionValue + */ +#define TALER_MERCHANT_post_private_accounts_option_credit_facade_url(u) \ + (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_URL, \ + .details.credit_facade_url = (u) \ + } + +/** + * Set credit facade credentials. + * + * @param c credentials JSON object + * @return representation of the option as a struct TALER_MERCHANT_PostPrivateAccountsOptionValue + */ +#define TALER_MERCHANT_post_private_accounts_option_credit_facade_credentials(c) \ + (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_CREDENTIALS, \ + .details.credit_facade_credentials = (c) \ + } + +/** + * Set extra wire subject metadata. + * + * @param m extra wire subject metadata (JSON) + * @return representation of the option as a struct TALER_MERCHANT_PostPrivateAccountsOptionValue + */ +#define TALER_MERCHANT_post_private_accounts_option_extra_wire_subject_metadata(m) \ + (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_EXTRA_WIRE_SUBJECT_METADATA, \ + .details.extra_wire_subject_metadata = (m) \ + } + + +/** + * Set the requested options for the operation. + * + * @param ppah the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_accounts_set_options_ ( + struct TALER_MERCHANT_PostPrivateAccountsHandle *ppah, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateAccountsOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppah the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_accounts_set_options(ppah,...) \ + TALER_MERCHANT_post_private_accounts_set_options_ ( \ + ppah, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateAccountsOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_accounts_option_end_ () } \ + )) + + +/** + * Set up POST /private/accounts operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param payto_uri payto URI of the account to add + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateAccountsHandle * +TALER_MERCHANT_post_private_accounts_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + struct TALER_FullPayto payto_uri); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateAccountsCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/accounts request. + * + * @param cls closure + * @param apr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateAccountsCallback)( + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateAccountsResponse *apr); + + +/** + * Start POST /private/accounts operation. + * + * @param[in,out] ppah operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_accounts_start ( + struct TALER_MERCHANT_PostPrivateAccountsHandle *ppah, + TALER_MERCHANT_PostPrivateAccountsCallback cb, + TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/accounts operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateAccountsCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppah operation to cancel + */ +void +TALER_MERCHANT_post_private_accounts_cancel ( + struct TALER_MERCHANT_PostPrivateAccountsHandle *ppah); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_ACCOUNTS_H */ diff --git a/src/include/taler/merchant/post-private-categories.h b/src/include/taler/merchant/post-private-categories.h @@ -0,0 +1,240 @@ +/* + 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/merchant/post-private-categories.h + * @brief C interface for the POST /private/categories endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_CATEGORIES_H +#define _TALER_MERCHANT__POST_PRIVATE_CATEGORIES_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /private/categories request. + */ +enum TALER_MERCHANT_PostPrivateCategoriesOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_END = 0, + + /** + * Internationalized names (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_NAME_I18N + +}; + + +/** + * Value for an option for the POST /private/categories request. + */ +struct TALER_MERCHANT_PostPrivateCategoriesOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateCategoriesOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_NAME_I18N. + */ + const json_t *name_i18n; + + } details; + +}; + + +/** + * Handle for a POST /private/categories request. + */ +struct TALER_MERCHANT_PostPrivateCategoriesHandle; + + +/** + * Response details for a POST /private/categories request. + */ +struct TALER_MERCHANT_PostPrivateCategoriesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Numeric identifier of the newly created category. + */ + uint64_t category_id; + + } ok; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_categories_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_END \ + } + +/** + * Set internationalized names. + * + * @param n names JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_categories_option_name_i18n(n) \ + (const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_NAME_I18N, \ + .details.name_i18n = (n) \ + } + + +/** + * Set the requested options for the operation. + * + * @param ppch the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_categories_set_options_ ( + struct TALER_MERCHANT_PostPrivateCategoriesHandle *ppch, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppch the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_categories_set_options(ppch,...) \ + TALER_MERCHANT_post_private_categories_set_options_ ( \ + ppch, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_categories_option_end_ () } \ + )) + + +/** + * Set up POST /private/categories operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param name human-readable name of the category + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateCategoriesHandle * +TALER_MERCHANT_post_private_categories_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *name); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateCategoriesCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/categories request. + * + * @param cls closure + * @param cpr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateCategoriesCallback)( + TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateCategoriesResponse *cpr); + + +/** + * Start POST /private/categories operation. + * + * @param[in,out] ppch operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_categories_start ( + struct TALER_MERCHANT_PostPrivateCategoriesHandle *ppch, + TALER_MERCHANT_PostPrivateCategoriesCallback cb, + TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/categories operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateCategoriesCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppch operation to cancel + */ +void +TALER_MERCHANT_post_private_categories_cancel ( + struct TALER_MERCHANT_PostPrivateCategoriesHandle *ppch); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_CATEGORIES_H */ diff --git a/src/include/taler/merchant/post-private-donau.h b/src/include/taler/merchant/post-private-donau.h @@ -0,0 +1,224 @@ +/* + 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/merchant/post-private-donau.h + * @brief C interface for the POST /private/donau endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_DONAU_H +#define _TALER_MERCHANT__POST_PRIVATE_DONAU_H + +#include <taler/merchant/common.h> + + +/** + * Donau charity structure for POST /private/donau. + */ +struct TALER_MERCHANT_Charity +{ + + /** + * Base URL of the Donau/charity service. + */ + const char *charity_url; + + /** + * Charity identifier at the Donau service. + */ + uint64_t charity_id; + +}; + + +/** + * Possible options for the POST /private/donau request. + */ +enum TALER_MERCHANT_PostPrivateDonauOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_END = 0, + +}; + + +/** + * Value for an option for the POST /private/donau request. + */ +struct TALER_MERCHANT_PostPrivateDonauOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateDonauOption option; + + /** + * Specific option value. + */ + union + { + + } details; + +}; + + +/** + * Handle for a POST /private/donau request. + */ +struct TALER_MERCHANT_PostPrivateDonauHandle; + + +/** + * Response details for a POST /private/donau request. + */ +struct TALER_MERCHANT_PostPrivateDonauResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + /** + * Details on #MHD_HTTP_ACCEPTED. + */ + struct TALER_MERCHANT_MfaChallengeResponse accepted; + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_donau_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateDonauOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_END \ + } + +/** + * Set the requested options for the operation. + * + * @param ppdh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_donau_set_options_ ( + struct TALER_MERCHANT_PostPrivateDonauHandle *ppdh, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateDonauOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppdh the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_donau_set_options(ppdh,...) \ + TALER_MERCHANT_post_private_donau_set_options_ ( \ + ppdh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateDonauOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_donau_option_end_ () } \ + )) + + +/** + * Set up POST /private/donau operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param charity charity information to register + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateDonauHandle * +TALER_MERCHANT_post_private_donau_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_MERCHANT_Charity *charity); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateDonauCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/donau request. + * + * @param cls closure + * @param pdr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateDonauCallback)( + TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateDonauResponse *pdr); + + +/** + * Start POST /private/donau operation. + * + * @param[in,out] ppdh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_donau_start ( + struct TALER_MERCHANT_PostPrivateDonauHandle *ppdh, + TALER_MERCHANT_PostPrivateDonauCallback cb, + TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/donau operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateDonauCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppdh operation to cancel + */ +void +TALER_MERCHANT_post_private_donau_cancel ( + struct TALER_MERCHANT_PostPrivateDonauHandle *ppdh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_DONAU_H */ diff --git a/src/include/taler/merchant/post-private-orders-ORDER_ID-refund.h b/src/include/taler/merchant/post-private-orders-ORDER_ID-refund.h @@ -0,0 +1,143 @@ +/* + 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/merchant/post-private-orders-ORDER_ID-refund.h + * @brief C interface for the POST /private/orders/$ORDER_ID/refund endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_ORDERS_ORDER_ID_REFUND_H +#define _TALER_MERCHANT__POST_PRIVATE_ORDERS_ORDER_ID_REFUND_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a POST /private/orders/$ORDER_ID/refund request. + */ +struct TALER_MERCHANT_PostPrivateOrdersRefundHandle; + + +/** + * Response details for a POST /private/orders/$ORDER_ID/refund request. + */ +struct TALER_MERCHANT_PostPrivateOrdersRefundResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Taler refund URI for the wallet. + */ + const char *taler_refund_uri; + + /** + * Hash of the contract terms for this order. + */ + struct TALER_PrivateContractHashP h_contract; + + } ok; + + } details; + +}; + + +/** + * Set up POST /private/orders/$ORDER_ID/refund operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order_id identifier of the order to refund + * @param refund amount to refund + * @param reason human-readable reason for the refund + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateOrdersRefundHandle * +TALER_MERCHANT_post_private_orders_refund_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *order_id, + const struct TALER_Amount *refund, + const char *reason); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateOrdersRefundCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/orders/$ORDER_ID/refund request. + * + * @param cls closure + * @param rr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateOrdersRefundCallback)( + TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateOrdersRefundResponse *rr); + + +/** + * Start POST /private/orders/$ORDER_ID/refund operation. + * + * @param[in,out] porh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_orders_refund_start ( + struct TALER_MERCHANT_PostPrivateOrdersRefundHandle *porh, + TALER_MERCHANT_PostPrivateOrdersRefundCallback cb, + TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/orders/$ORDER_ID/refund operation. This function + * must not be called by clients after the + * TALER_MERCHANT_PostPrivateOrdersRefundCallback has been invoked (as in + * those cases it'll be called internally by the implementation already). + * + * @param[in] porh operation to cancel + */ +void +TALER_MERCHANT_post_private_orders_refund_cancel ( + struct TALER_MERCHANT_PostPrivateOrdersRefundHandle *porh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_ORDERS_ORDER_ID_REFUND_H */ diff --git a/src/include/taler/merchant/post-private-orders.h b/src/include/taler/merchant/post-private-orders.h @@ -0,0 +1,536 @@ +/* + 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/merchant/post-private-orders.h + * @brief C interface for the POST /private/orders endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_ORDERS_H +#define _TALER_MERCHANT__POST_PRIVATE_ORDERS_H + +#include <taler/merchant/common.h> + + +/** + * A product from inventory to include in an order. + */ +struct TALER_MERCHANT_PostPrivateOrdersInventoryProduct +{ + + /** + * Identifier of the product. + */ + const char *product_id; + + /** + * Quantity of the product to include. + */ + uint32_t quantity; + + /** + * Fractional part of the quantity. + */ + uint32_t quantity_frac; + + /** + * Money pot to use for this product, overrides value from + * the inventory if given. -1 if not set. + * @since protocol v25. + */ + int32_t product_money_pot; + + /** + * Whether to use fractional quantity. + */ + bool use_fractional_quantity; + +}; + + +/** + * Possible options for the POST /private/orders request. + */ +enum TALER_MERCHANT_PostPrivateOrdersOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_END = 0, + + /** + * Refund delay. + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_REFUND_DELAY, + + /** + * Payment target (type of payment method). + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_PAYMENT_TARGET, + + /** + * Session identifier for session-bound payments. + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_SESSION_ID, + + /** + * Whether to create a claim token. + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_CREATE_TOKEN, + + /** + * OTP device ID. + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_OTP_ID, + + /** + * Inventory products to include in the order. + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_INVENTORY_PRODUCTS, + + /** + * Lock UUIDs for inventory locks. + */ + TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_LOCK_UUIDS + +}; + + +/** + * Value for an option for the POST /private/orders request. + */ +struct TALER_MERCHANT_PostPrivateOrdersOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateOrdersOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_REFUND_DELAY. + */ + struct GNUNET_TIME_Relative refund_delay; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_PAYMENT_TARGET. + */ + const char *payment_target; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_SESSION_ID. + */ + const char *session_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_CREATE_TOKEN. + */ + bool create_token; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_OTP_ID. + */ + const char *otp_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_INVENTORY_PRODUCTS. + */ + struct + { + unsigned int num; + const struct TALER_MERCHANT_PostPrivateOrdersInventoryProduct *products; + } inventory_products; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_LOCK_UUIDS. + */ + struct + { + unsigned int num; + const char **uuids; + } lock_uuids; + + } details; + +}; + + +/** + * Handle for a POST /private/orders request. + */ +struct TALER_MERCHANT_PostPrivateOrdersHandle; + + +/** + * Detail about why a specific exchange was rejected when + * creating an order. + */ +struct TALER_MERCHANT_ExchangeRejectionDetail +{ + + /** + * Base URL of the rejected exchange. + */ + const char *exchange_url; + + /** + * Error code indicating why this exchange was not acceptable. + */ + enum TALER_ErrorCode code; + + /** + * Human-readable hint about the error, or NULL. + */ + const char *hint; + +}; + + +/** + * Response details for a POST /private/orders request. + */ +struct TALER_MERCHANT_PostPrivateOrdersResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Identifier of the created order. + */ + const char *order_id; + + /** + * Claim token, or NULL. + */ + const struct TALER_ClaimTokenP *token; + + /** + * Payment deadline. + */ + struct GNUNET_TIME_Timestamp pay_deadline; + + } ok; + + /** + * Details on #MHD_HTTP_GONE (product out of stock). + */ + struct + { + + /** + * Product that is out of stock. + */ + const char *product_id; + + /** + * Requested quantity (integer part). + */ + uint64_t requested_quantity; + + /** + * Requested quantity (fractional part). + */ + uint32_t requested_quantity_frac; + + /** + * Available quantity (integer part). + */ + uint64_t available_quantity; + + /** + * Available quantity (fractional part). + */ + uint32_t available_quantity_frac; + + /** + * Requested quantity as string in "<integer>[.<fraction>]" format, + * or NULL if not provided. + */ + const char *unit_requested_quantity; + + /** + * Available quantity as string in "<integer>[.<fraction>]" format, + * or NULL if not provided. + */ + const char *unit_available_quantity; + + /** + * Expected restock time. + */ + struct GNUNET_TIME_Timestamp restock_expected; + + } gone; + + /** + * Details on #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. + * @since protocol v25. + */ + struct + { + + /** + * Number of entries in @a exchange_rejections. + */ + unsigned int num_exchange_rejections; + + /** + * Array of exchange rejection details. + */ + const struct TALER_MERCHANT_ExchangeRejectionDetail + *exchange_rejections; + + } unavailable_for_legal_reasons; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_orders_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_END \ + } + +/** + * Set refund delay. + * + * @param d refund delay + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_orders_option_refund_delay(d) \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_REFUND_DELAY, \ + .details.refund_delay = (d) \ + } + +/** + * Set payment target. + * + * @param t payment target string + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_orders_option_payment_target(t) \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_PAYMENT_TARGET, \ + .details.payment_target = (t) \ + } + +/** + * Set session identifier. + * + * @param s session ID + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_orders_option_session_id(s) \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_SESSION_ID, \ + .details.session_id = (s) \ + } + +/** + * Set whether to create a claim token. + * + * @param c true to create token, false to disable + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_orders_option_create_token(c) \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_CREATE_TOKEN, \ + .details.create_token = (c) \ + } + +/** + * Set OTP device ID. + * + * @param o OTP device ID + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_orders_option_otp_id(o) \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_OTP_ID, \ + .details.otp_id = (o) \ + } + +/** + * Set inventory products. + * + * @param n number of products + * @param p array of inventory products + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_orders_option_inventory_products(n,p) \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_INVENTORY_PRODUCTS \ + , \ + .details.inventory_products = { .num = (n), .products = (p) } \ + } + +/** + * Set lock UUIDs. + * + * @param n number of UUIDs + * @param u array of UUID strings + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_orders_option_lock_uuids(n,u) \ + (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_LOCK_UUIDS, \ + .details.lock_uuids = { .num = (n), .uuids = (u) } \ + } + + +/** + * Set the requested options for the operation. + * + * @param ppoh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_orders_set_options_ ( + struct TALER_MERCHANT_PostPrivateOrdersHandle *ppoh, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateOrdersOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppoh the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_orders_set_options(ppoh,...) \ + TALER_MERCHANT_post_private_orders_set_options_ ( \ + ppoh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateOrdersOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_orders_option_end_ () } \ + )) + + +/** + * Set up POST /private/orders operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param order order contract (JSON) + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateOrdersHandle * +TALER_MERCHANT_post_private_orders_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const json_t *order); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateOrdersCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/orders request. + * + * @param cls closure + * @param por response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateOrdersCallback)( + TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateOrdersResponse *por); + + +/** + * Start POST /private/orders operation. + * + * @param[in,out] ppoh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_orders_start ( + struct TALER_MERCHANT_PostPrivateOrdersHandle *ppoh, + TALER_MERCHANT_PostPrivateOrdersCallback cb, + TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/orders operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateOrdersCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppoh operation to cancel + */ +void +TALER_MERCHANT_post_private_orders_cancel ( + struct TALER_MERCHANT_PostPrivateOrdersHandle *ppoh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_ORDERS_H */ diff --git a/src/include/taler/merchant/post-private-otp-devices.h b/src/include/taler/merchant/post-private-otp-devices.h @@ -0,0 +1,238 @@ +/* + 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/merchant/post-private-otp-devices.h + * @brief C interface for the POST /private/otp-devices endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_OTP_DEVICES_H +#define _TALER_MERCHANT__POST_PRIVATE_OTP_DEVICES_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a POST /private/otp-devices request. + */ +struct TALER_MERCHANT_PostPrivateOtpDevicesHandle; + + +/** + * Response details for a POST /private/otp-devices request. + */ +struct TALER_MERCHANT_PostPrivateOtpDevicesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Possible options we can set for the POST /private/otp-devices request. + */ +enum TALER_MERCHANT_PostPrivateOtpDevicesOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_END = 0, + + /** + * Set the initial OTP counter value (for HOTP). + */ + TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_OTP_CTR + +}; + + +/** + * Value for an option for the POST /private/otp-devices request. + */ +struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateOtpDevicesOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_OTP_CTR. + */ + uint64_t otp_ctr; + + } details; + +}; + + +/** + * Set up POST /private/otp-devices operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param otp_device_id identifier for the new OTP device + * @param otp_device_description human-readable description + * @param otp_key base32-encoded OTP secret key + * @param otp_algorithm OTP algorithm to use + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateOtpDevicesHandle * +TALER_MERCHANT_post_private_otp_devices_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *otp_device_id, + const char *otp_device_description, + const char *otp_key, + enum TALER_MerchantConfirmationAlgorithm otp_algorithm); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue + */ +#define TALER_MERCHANT_post_private_otp_devices_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_END \ + } + +/** + * Set the initial counter value (for HOTP). + * + * @param c the counter value + * @return representation of the option as a struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue + */ +#define TALER_MERCHANT_post_private_otp_devices_option_otp_ctr(c) \ + (const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_OTP_CTR, \ + .details.otp_ctr = (c) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param ppoh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_otp_devices_set_options_ ( + struct TALER_MERCHANT_PostPrivateOtpDevicesHandle *ppoh, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_post_private_otp_devices_set_options ( + * ppoh, + * TALER_MERCHANT_post_private_otp_devices_option_otp_ctr (42)); + * + * @param ppoh the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_post_private_otp_devices_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_otp_devices_set_options(ppoh,...) \ + TALER_MERCHANT_post_private_otp_devices_set_options_ ( \ + ppoh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_otp_devices_option_end_ () \ + } \ + )) + + +#ifndef TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateOtpDevicesCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/otp-devices request. + * + * @param cls closure + * @param odr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateOtpDevicesCallback)( + TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateOtpDevicesResponse *odr); + + +/** + * Start POST /private/otp-devices operation. + * + * @param[in,out] ppoh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_otp_devices_start ( + struct TALER_MERCHANT_PostPrivateOtpDevicesHandle *ppoh, + TALER_MERCHANT_PostPrivateOtpDevicesCallback cb, + TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/otp-devices operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateOtpDevicesCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppoh operation to cancel + */ +void +TALER_MERCHANT_post_private_otp_devices_cancel ( + struct TALER_MERCHANT_PostPrivateOtpDevicesHandle *ppoh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_OTP_DEVICES_H */ diff --git a/src/include/taler/merchant/post-private-products-PRODUCT_ID-lock.h b/src/include/taler/merchant/post-private-products-PRODUCT_ID-lock.h @@ -0,0 +1,251 @@ +/* + 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/merchant/post-private-products-PRODUCT_ID-lock.h + * @brief C interface for the POST /private/products/$PRODUCT_ID/lock endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_PRODUCT_ID_LOCK_H +#define _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_PRODUCT_ID_LOCK_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /private/products/$PRODUCT_ID/lock request. + */ +enum TALER_MERCHANT_PostPrivateProductsLockOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_END = 0, + + /** + * Fractional part of the quantity to lock. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_QUANTITY_FRAC, + + /** + * Whether to use fractional quantity. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_USE_FRACTIONAL_QUANTITY + +}; + + +/** + * Value for an option for the POST /private/products/$PRODUCT_ID/lock request. + */ +struct TALER_MERCHANT_PostPrivateProductsLockOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateProductsLockOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_QUANTITY_FRAC. + */ + uint32_t quantity_frac; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_USE_FRACTIONAL_QUANTITY. + */ + bool use_fractional_quantity; + + } details; + +}; + + +/** + * Handle for a POST /private/products/$PRODUCT_ID/lock request. + */ +struct TALER_MERCHANT_PostPrivateProductsLockHandle; + + +/** + * Response details for a POST /private/products/$PRODUCT_ID/lock request. + */ +struct TALER_MERCHANT_PostPrivateProductsLockResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_products_lock_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_END \ + } + +/** + * Set fractional part of quantity. + * + * @param f fractional part + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_lock_option_quantity_frac(f) \ + (const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_QUANTITY_FRAC, \ + .details.quantity_frac = (f) \ + } + +/** + * Set to use fractional quantity. + * + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_lock_option_use_frac_quantity() \ + (const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_USE_FRACTIONAL_QUANTITY, \ + .details.use_fractional_quantity = true \ + } + + +/** + * Set the requested options for the operation. + * + * @param pplh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_products_lock_set_options_ ( + struct TALER_MERCHANT_PostPrivateProductsLockHandle *pplh, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param pplh the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_products_lock_set_options(pplh,...) \ + TALER_MERCHANT_post_private_products_lock_set_options_ ( \ + pplh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_products_lock_option_end_ \ + () } \ + )) + + +/** + * Set up POST /private/products/$PRODUCT_ID/lock operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param product_id identifier of the product to lock + * @param uuid idempotency UUID for this lock operation + * @param duration how long to lock the inventory + * @param quantity number of units to lock + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateProductsLockHandle * +TALER_MERCHANT_post_private_products_lock_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *product_id, + const char *uuid, + struct GNUNET_TIME_Relative duration, + uint64_t quantity); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateProductsLockCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/products/$PRODUCT_ID/lock request. + * + * @param cls closure + * @param plr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateProductsLockCallback)( + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateProductsLockResponse *plr); + + +/** + * Start POST /private/products/$PRODUCT_ID/lock operation. + * + * @param[in,out] pplh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_products_lock_start ( + struct TALER_MERCHANT_PostPrivateProductsLockHandle *pplh, + TALER_MERCHANT_PostPrivateProductsLockCallback cb, + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/products/$PRODUCT_ID/lock operation. This function + * must not be called by clients after the + * TALER_MERCHANT_PostPrivateProductsLockCallback has been invoked (as in + * those cases it'll be called internally by the implementation already). + * + * @param[in] pplh operation to cancel + */ +void +TALER_MERCHANT_post_private_products_lock_cancel ( + struct TALER_MERCHANT_PostPrivateProductsLockHandle *pplh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_PRODUCT_ID_LOCK_H */ diff --git a/src/include/taler/merchant/post-private-products.h b/src/include/taler/merchant/post-private-products.h @@ -0,0 +1,604 @@ +/* + 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/merchant/post-private-products.h + * @brief C interface for the POST /private/products endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_H +#define _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /private/products request. + */ +enum TALER_MERCHANT_PostPrivateProductsOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_END = 0, + + /** + * Internationalized descriptions (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_I18N, + + /** + * Tax information (JSON array). + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TAXES, + + /** + * Storage location (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_ADDRESS, + + /** + * Expected restock time. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_NEXT_RESTOCK, + + /** + * Minimum age requirement. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MINIMUM_AGE, + + /** + * Category IDs. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_CATEGORIES, + + /** + * Value and fractional part of total stock. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK, + + /** + * Value part of total stock (-1 for unlimited). + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_VAL, + + /** + * Fractional part of total stock. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC, + + /** + * Whether fractional quantities are allowed. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_ALLOW_FRACTION, + + /** + * Precision level for fractions. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_PRECISION_LEVEL, + + /** + * Explicit product name (distinct from description). + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_NAME, + + /** + * Product image (base64-encoded data URL). + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_IMAGE, + + /** + * Product group ID. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_ID, + + /** + * Money pot ID. + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MONEY_POT_ID, + + /** + * Whether the price is net (before tax). + */ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRICE_IS_NET + +}; + + +/** + * Value for an option for the POST /private/products request. + */ +struct TALER_MERCHANT_PostPrivateProductsOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateProductsOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_I18N. + */ + const json_t *description_i18n; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TAXES. + */ + const json_t *taxes; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_ADDRESS. + */ + const json_t *address; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_NEXT_RESTOCK. + */ + struct GNUNET_TIME_Timestamp next_restock; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MINIMUM_AGE. + */ + uint32_t minimum_age; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_CATEGORIES. + */ + struct + { + unsigned int num; + const uint64_t *cats; + } categories; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK. + */ + struct + { + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_VAL. + * -1 for infinite stock. + */ + int64_t val; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC. + */ + uint32_t frac; + } total_stock; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_ALLOW_FRACTION. + */ + bool unit_allow_fraction; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_PRECISION_LEVEL. + */ + uint32_t unit_precision_level; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_NAME. + */ + const char *product_name; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_IMAGE. + */ + const char *image; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_ID. + */ + uint64_t product_group_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MONEY_POT_ID. + */ + uint64_t money_pot_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRICE_IS_NET. + */ + bool price_is_net; + + } details; + +}; + + +/** + * Handle for a POST /private/products request. + */ +struct TALER_MERCHANT_PostPrivateProductsHandle; + + +/** + * Response details for a POST /private/products request. + */ +struct TALER_MERCHANT_PostPrivateProductsResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PostPrivateProductsOptionValue + */ +#define TALER_MERCHANT_post_private_products_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_END \ + } + +/** + * Set internationalized descriptions. + * + * @param d descriptions JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_description_i18n(d) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_I18N \ + , \ + .details.description_i18n = (d) \ + } + +/** + * Set tax information. + * + * @param t taxes JSON array + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_taxes(t) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TAXES, \ + .details.taxes = (t) \ + } + +/** + * Set storage address. + * + * @param a address JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_address(a) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_ADDRESS, \ + .details.address = (a) \ + } + +/** + * Set expected restock time. + * + * @param r restock timestamp + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_next_restock(r) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_NEXT_RESTOCK, \ + .details.next_restock = (r) \ + } + +/** + * Set minimum age requirement. + * + * @param a minimum age (0 for none) + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_minimum_age(a) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MINIMUM_AGE, \ + .details.minimum_age = (a) \ + } + +/** + * Set category IDs. + * + * @param n number of categories + * @param c array of category IDs + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_categories(n,c) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_CATEGORIES, \ + .details.categories = { .num = (n), .cats = (c) } \ + } + +/** + * Set fractional part of total stock. + * + * @param f fractional part + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_total_stock_frac(f) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC, \ + .details.total_stock.frac = (f) \ + } + +/** + * Set fractional part of total stock. + * + * @param s total stock amount + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_total_stock_val(s) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_VAL, \ + .details.total_stock.val = (s) \ + } + +/** + * Set stock. + * + * @param s stock value + * @param f fractional stock + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_total_stock(s,f) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK, \ + .details.total_stock.val = (s), \ + .details.total_stock.frac = (f) \ + } + +/** + * Set whether fractional quantities are allowed. + * + * @param b true to allow fractions + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_unit_allow_fraction(b) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_ALLOW_FRACTION, \ + .details.unit_allow_fraction = (b) \ + } + +/** + * Set precision level for fractional quantities. + * + * @param p precision level + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_unit_precision_level(p) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_PRECISION_LEVEL, \ + .details.unit_precision_level = (p) \ + } + + +/** + * Set explicit product name (distinct from description). + * + * @param n product name string + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_product_name(n) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_NAME, \ + .details.product_name = (n) \ + } + +/** + * Set product image (base64-encoded data URL). + * + * @param i image string + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_image(i) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_IMAGE, \ + .details.image = (i) \ + } + +/** + * Set product group ID. + * + * @param g product group ID + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_product_group_id(g) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_ID, \ + .details.product_group_id = (g) \ + } + +/** + * Set money pot ID. + * + * @param m money pot ID + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_money_pot_id(m) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MONEY_POT_ID, \ + .details.money_pot_id = (m) \ + } + +/** + * Set whether the price is net (before tax). + * + * @param b true if price is net + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_products_option_price_is_net(b) \ + (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRICE_IS_NET, \ + .details.price_is_net = (b) \ + } + + +/** + * Set the requested options for the operation. + * + * @param ppph the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_products_set_options_ ( + struct TALER_MERCHANT_PostPrivateProductsHandle *ppph, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateProductsOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppph the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_products_set_options(ppph,...) \ + TALER_MERCHANT_post_private_products_set_options_ ( \ + ppph, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateProductsOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_products_option_end_ () } \ + )) + + +/** + * Set up POST /private/products operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param product_id identifier for the new product + * @param description human-readable product description + * @param unit unit of measurement + * @param price unit price + * @param num_prices length of the @e prices array + * @param prices new unit prices + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateProductsHandle * +TALER_MERCHANT_post_private_products_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *product_id, + const char *description, + const char *unit, + unsigned int num_prices, + const struct TALER_Amount prices[static num_prices]); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateProductsCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/products request. + * + * @param cls closure + * @param ppr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateProductsCallback)( + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateProductsResponse *ppr); + + +/** + * Start POST /private/products operation. + * + * @param[in,out] ppph operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_products_start ( + struct TALER_MERCHANT_PostPrivateProductsHandle *ppph, + TALER_MERCHANT_PostPrivateProductsCallback cb, + TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/products operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateProductsCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppph operation to cancel + */ +void +TALER_MERCHANT_post_private_products_cancel ( + struct TALER_MERCHANT_PostPrivateProductsHandle *ppph); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_H */ diff --git a/src/include/taler/merchant/post-private-templates.h b/src/include/taler/merchant/post-private-templates.h @@ -0,0 +1,249 @@ +/* + 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/merchant/post-private-templates.h + * @brief C interface for the POST /private/templates endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_TEMPLATES_H +#define _TALER_MERCHANT__POST_PRIVATE_TEMPLATES_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /private/templates request. + */ +enum TALER_MERCHANT_PostPrivateTemplatesOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_END = 0, + + /** + * OTP device ID to associate with the template. + */ + TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_OTP_ID, + + /** + * Editable defaults (JSON object) for the template. + */ + TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_EDITABLE_DEFAULTS + +}; + + +/** + * Value for an option for the POST /private/templates request. + */ +struct TALER_MERCHANT_PostPrivateTemplatesOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateTemplatesOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_OTP_ID. + */ + const char *otp_id; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_EDITABLE_DEFAULTS. + */ + const json_t *editable_defaults; + + } details; + +}; + + +/** + * Handle for a POST /private/templates request. + */ +struct TALER_MERCHANT_PostPrivateTemplatesHandle; + + +/** + * Response details for a POST /private/templates request. + */ +struct TALER_MERCHANT_PostPrivateTemplatesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_templates_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_END \ + } + +/** + * Set OTP device ID. + * + * @param o OTP device ID + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_templates_option_otp_id(o) \ + (const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_OTP_ID, \ + .details.otp_id = (o) \ + } + + +/** + * Set editable defaults. + * + * @param ed editable defaults (JSON object) + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_templates_option_editable_defaults(ed) \ + (const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_EDITABLE_DEFAULTS, \ + .details.editable_defaults = (ed) \ + } + + +/** + * Set the requested options for the operation. + * + * @param ppth the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_templates_set_options_ ( + struct TALER_MERCHANT_PostPrivateTemplatesHandle *ppth, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppth the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_templates_set_options(ppth,...) \ + TALER_MERCHANT_post_private_templates_set_options_ ( \ + ppth, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_templates_option_end_ () } \ + )) + + +/** + * Set up POST /private/templates operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param template_id identifier for the new template + * @param template_description human-readable description + * @param template_contract template contract (JSON) + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateTemplatesHandle * +TALER_MERCHANT_post_private_templates_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *template_id, + const char *template_description, + const json_t *template_contract); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateTemplatesCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/templates request. + * + * @param cls closure + * @param ptr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateTemplatesCallback)( + TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateTemplatesResponse *ptr); + + +/** + * Start POST /private/templates operation. + * + * @param[in,out] ppth operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_templates_start ( + struct TALER_MERCHANT_PostPrivateTemplatesHandle *ppth, + TALER_MERCHANT_PostPrivateTemplatesCallback cb, + TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/templates operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateTemplatesCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppth operation to cancel + */ +void +TALER_MERCHANT_post_private_templates_cancel ( + struct TALER_MERCHANT_PostPrivateTemplatesHandle *ppth); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_TEMPLATES_H */ diff --git a/src/include/taler/merchant/post-private-token.h b/src/include/taler/merchant/post-private-token.h @@ -0,0 +1,310 @@ +/* + 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/merchant/post-private-token.h + * @brief C interface for the POST /private/token endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_TOKEN_H +#define _TALER_MERCHANT__POST_PRIVATE_TOKEN_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a POST /private/token request. + */ +struct TALER_MERCHANT_PostPrivateTokenHandle; + + +/** + * Possible options for the POST /private/token request. + */ +enum TALER_MERCHANT_PostPrivateTokenOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_END = 0, + + /** + * Duration for the token validity. + */ + TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DURATION, + + /** + * Whether the token may be refreshed. + */ + TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_REFRESHABLE, + + /** + * Description for the token. + */ + TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DESCRIPTION + +}; + + +/** + * Value for an option for the POST /private/token request. + */ +struct TALER_MERCHANT_PostPrivateTokenOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateTokenOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DURATION. + */ + struct GNUNET_TIME_Relative duration; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_REFRESHABLE. + */ + bool refreshable; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DESCRIPTION. + */ + const char *description; + + } details; + +}; + + +/** + * Response details for a POST /private/token request. + */ +struct TALER_MERCHANT_PostPrivateTokenResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * The access token (RFC 8959 secret-token: URI). + */ + const char *access_token; + + /** + * The scope of the token. + */ + const char *scope; + + /** + * Whether the token may be refreshed. + */ + bool refreshable; + + /** + * When the token expires. + */ + struct GNUNET_TIME_Timestamp expiration; + + } ok; + + /** + * Details on #MHD_HTTP_ACCEPTED. + */ + struct TALER_MERCHANT_MfaChallengeResponse accepted; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_token_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_END \ + } + +/** + * Set duration for token validity. + * + * @param d the duration + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_token_option_duration(d) \ + (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DURATION, \ + .details.duration = (d) \ + } + +/** + * Set whether token is refreshable. + * + * @param r true if token may be refreshed + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_token_option_refreshable(r) \ + (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_REFRESHABLE, \ + .details.refreshable = (r) \ + } + +/** + * Set description for the token. + * + * @param d description string + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_token_option_description(d) \ + (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DESCRIPTION, \ + .details.description = (d) \ + } + + +/** + * Set the requested options for the operation. + * + * @param ppth the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_token_set_options_ ( + struct TALER_MERCHANT_PostPrivateTokenHandle *ppth, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateTokenOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppth the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_token_set_options(ppth,...) \ + TALER_MERCHANT_post_private_token_set_options_ ( \ + ppth, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateTokenOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_token_option_end_ () } \ + )) + + +/** + * Set up POST /private/token operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param instance_id identifier of the instance + * @param scope scope for the token + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateTokenHandle * +TALER_MERCHANT_post_private_token_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *instance_id, + const char *scope); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateTokenCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/token request. + * + * @param cls closure + * @param ptr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateTokenCallback)( + TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateTokenResponse *ptr); + + +/** + * Start POST /private/token operation. + * + * @param[in,out] ppth operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_token_start ( + struct TALER_MERCHANT_PostPrivateTokenHandle *ppth, + TALER_MERCHANT_PostPrivateTokenCallback cb, + TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/token operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateTokenCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppth operation to cancel + */ +void +TALER_MERCHANT_post_private_token_cancel ( + struct TALER_MERCHANT_PostPrivateTokenHandle *ppth); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_TOKEN_H */ diff --git a/src/include/taler/merchant/post-private-tokenfamilies.h b/src/include/taler/merchant/post-private-tokenfamilies.h @@ -0,0 +1,261 @@ +/* + 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/merchant/post-private-tokenfamilies.h + * @brief C interface for the POST /private/tokenfamilies endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_TOKENFAMILIES_H +#define _TALER_MERCHANT__POST_PRIVATE_TOKENFAMILIES_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /private/tokenfamilies request. + */ +enum TALER_MERCHANT_PostPrivateTokenfamiliesOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_END = 0, + + /** + * Internationalized descriptions (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_DESCRIPTION_I18N, + + /** + * Extra data (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_EXTRA_DATA + +}; + + +/** + * Value for an option for the POST /private/tokenfamilies request. + */ +struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateTokenfamiliesOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_DESCRIPTION_I18N. + */ + const json_t *description_i18n; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_EXTRA_DATA. + */ + const json_t *extra_data; + + } details; + +}; + + +/** + * Handle for a POST /private/tokenfamilies request. + */ +struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle; + + +/** + * Response details for a POST /private/tokenfamilies request. + */ +struct TALER_MERCHANT_PostPrivateTokenfamiliesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_tokenfamilies_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_END \ + } + +/** + * Set internationalized descriptions. + * + * @param d descriptions JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_tokenfamilies_option_description_i18n(d) \ + (const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_DESCRIPTION_I18N, \ + .details.description_i18n = (d) \ + } + +/** + * Set extra data. + * + * @param e extra data JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_tokenfamilies_option_extra_data(e) \ + (const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_EXTRA_DATA, \ + .details.extra_data = (e) \ + } + + +/** + * Set the requested options for the operation. + * + * @param ptfh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_tokenfamilies_set_options_ ( + struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle *ptfh, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ptfh the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_tokenfamilies_set_options(ptfh,...) \ + TALER_MERCHANT_post_private_tokenfamilies_set_options_ ( \ + ptfh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_tokenfamilies_option_end_ \ + () } \ + )) + + +/** + * Set up POST /private/tokenfamilies operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param slug URL-safe slug identifier for the new token family + * @param name human-readable name + * @param description human-readable description + * @param valid_after start of validity period + * @param valid_before end of validity period + * @param duration duration of individual token validity + * @param validity_granularity granularity for validity alignment + * @param start_offset offset from purchase to start of validity + * @param kind kind of token family ("subscription" or "discount") + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle * +TALER_MERCHANT_post_private_tokenfamilies_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *slug, + const char *name, + const char *description, + struct GNUNET_TIME_Timestamp valid_after, + struct GNUNET_TIME_Timestamp valid_before, + struct GNUNET_TIME_Relative duration, + struct GNUNET_TIME_Relative validity_granularity, + struct GNUNET_TIME_Relative start_offset, + const char *kind); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateTokenfamiliesCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/tokenfamilies request. + * + * @param cls closure + * @param tfr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateTokenfamiliesCallback)( + TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateTokenfamiliesResponse *tfr); + + +/** + * Start POST /private/tokenfamilies operation. + * + * @param[in,out] ptfh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_tokenfamilies_start ( + struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle *ptfh, + TALER_MERCHANT_PostPrivateTokenfamiliesCallback cb, + TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/tokenfamilies operation. This function must not be + * called by clients after the + * TALER_MERCHANT_PostPrivateTokenfamiliesCallback has been invoked (as in + * those cases it'll be called internally by the implementation already). + * + * @param[in] ptfh operation to cancel + */ +void +TALER_MERCHANT_post_private_tokenfamilies_cancel ( + struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle *ptfh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_TOKENFAMILIES_H */ diff --git a/src/include/taler/merchant/post-private-transfers.h b/src/include/taler/merchant/post-private-transfers.h @@ -0,0 +1,145 @@ +/* + 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/merchant/post-private-transfers.h + * @brief C interface for the POST /private/transfers endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_TRANSFERS_H +#define _TALER_MERCHANT__POST_PRIVATE_TRANSFERS_H + +#include <taler/merchant/common.h> + + +/** + * Handle for a POST /private/transfers request. + */ +struct TALER_MERCHANT_PostPrivateTransfersHandle; + + +/** + * Response details for a POST /private/transfers request. + */ +struct TALER_MERCHANT_PostPrivateTransfersResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_BAD_GATEWAY (exchange returned an error). + */ + struct + { + + /** + * Error code returned by the exchange. + */ + enum TALER_ErrorCode exchange_ec; + + /** + * HTTP status code returned by the exchange. + */ + unsigned int exchange_http_status; + + } bad_gateway; + + } details; + +}; + + +/** + * Set up POST /private/transfers operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param credit_amount amount credited in this transfer + * @param wtid wire transfer identifier + * @param payto_uri payto URI of the merchant account that received the funds + * @param exchange_url base URL of the exchange that made the transfer + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateTransfersHandle * +TALER_MERCHANT_post_private_transfers_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_Amount *credit_amount, + const struct TALER_WireTransferIdentifierRawP *wtid, + struct TALER_FullPayto payto_uri, + const char *exchange_url); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateTransfersCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/transfers request. + * + * @param cls closure + * @param ptr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateTransfersCallback)( + TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateTransfersResponse *ptr); + + +/** + * Start POST /private/transfers operation. + * + * @param[in,out] ppth operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_transfers_start ( + struct TALER_MERCHANT_PostPrivateTransfersHandle *ppth, + TALER_MERCHANT_PostPrivateTransfersCallback cb, + TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/transfers operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateTransfersCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppth operation to cancel + */ +void +TALER_MERCHANT_post_private_transfers_cancel ( + struct TALER_MERCHANT_PostPrivateTransfersHandle *ppth); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_TRANSFERS_H */ diff --git a/src/include/taler/merchant/post-private-units.h b/src/include/taler/merchant/post-private-units.h @@ -0,0 +1,328 @@ +/* + 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/merchant/post-private-units.h + * @brief C interface for the POST /private/units endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_UNITS_H +#define _TALER_MERCHANT__POST_PRIVATE_UNITS_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /private/units request. + */ +enum TALER_MERCHANT_PostPrivateUnitsOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_END = 0, + + /** + * Internationalized long names (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_LONG_I18N, + + /** + * Internationalized short names (JSON). + */ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_SHORT_I18N, + + /** + * Whether fractional quantities are allowed (bool). + * Default: false. + */ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ALLOW_FRACTION, + + /** + * Precision level for fractional quantities (uint32_t). + * Default: 0. + */ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_PRECISION_LEVEL, + + /** + * Whether the unit is active (bool). + * Default: true. + */ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ACTIVE + +}; + + +/** + * Value for an option for the POST /private/units request. + */ +struct TALER_MERCHANT_PostPrivateUnitsOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateUnitsOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_LONG_I18N. + */ + const json_t *unit_name_long_i18n; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_SHORT_I18N. + */ + const json_t *unit_name_short_i18n; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ALLOW_FRACTION. + */ + bool unit_allow_fraction; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_PRECISION_LEVEL. + */ + uint32_t unit_precision_level; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ACTIVE. + */ + bool unit_active; + + } details; + +}; + + +/** + * Handle for a POST /private/units request. + */ +struct TALER_MERCHANT_PostPrivateUnitsHandle; + + +/** + * Response details for a POST /private/units request. + */ +struct TALER_MERCHANT_PostPrivateUnitsResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_private_units_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_END \ + } + +/** + * Set internationalized long names. + * + * @param j long names JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_units_option_unit_name_long_i18n(j) \ + (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_LONG_I18N \ + , \ + .details.unit_name_long_i18n = (j) \ + } + +/** + * Set internationalized short names. + * + * @param j short names JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_units_option_unit_name_short_i18n(j) \ + (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_SHORT_I18N, \ + .details.unit_name_short_i18n = (j) \ + } + + +/** + * Set whether fractional quantities are allowed. + * + * @param v true to allow fractions + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_units_option_unit_allow_fraction(v) \ + (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ALLOW_FRACTION, \ + .details.unit_allow_fraction = (v) \ + } + +/** + * Set the precision level for fractional quantities. + * + * @param v precision level + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_units_option_unit_precision_level(v) \ + (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_PRECISION_LEVEL, \ + .details.unit_precision_level = (v) \ + } + +/** + * Set whether the unit is active. + * + * @param v true if active + * @return representation of the option + */ +#define TALER_MERCHANT_post_private_units_option_unit_active(v) \ + (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ACTIVE, \ + .details.unit_active = (v) \ + } + + +/** + * Set the requested options for the operation. + * + * @param ppuh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_units_set_options_ ( + struct TALER_MERCHANT_PostPrivateUnitsHandle *ppuh, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateUnitsOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param ppuh the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_units_set_options(ppuh,...) \ + TALER_MERCHANT_post_private_units_set_options_ ( \ + ppuh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateUnitsOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_units_option_end_ () } \ + )) + + +/** + * Set up POST /private/units operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param unit_id identifier for the new unit + * @param unit_name_long long human-readable name + * @param unit_name_short short symbol for the unit + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateUnitsHandle * +TALER_MERCHANT_post_private_units_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *unit_id, + const char *unit_name_long, + const char *unit_name_short); + + +#ifndef TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateUnitsCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/units request. + * + * @param cls closure + * @param pur response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateUnitsCallback)( + TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateUnitsResponse *pur); + + +/** + * Start POST /private/units operation. + * + * @param[in,out] ppuh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_units_start ( + struct TALER_MERCHANT_PostPrivateUnitsHandle *ppuh, + TALER_MERCHANT_PostPrivateUnitsCallback cb, + TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/units operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateUnitsCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppuh operation to cancel + */ +void +TALER_MERCHANT_post_private_units_cancel ( + struct TALER_MERCHANT_PostPrivateUnitsHandle *ppuh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_UNITS_H */ diff --git a/src/include/taler/merchant/post-private-webhooks.h b/src/include/taler/merchant/post-private-webhooks.h @@ -0,0 +1,263 @@ +/* + 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/merchant/post-private-webhooks.h + * @brief C interface for the POST /private/webhooks endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_PRIVATE_WEBHOOKS_H +#define _TALER_MERCHANT__POST_PRIVATE_WEBHOOKS_H + +#include <taler/merchant/common.h> + + +/** + * Possible options we can set for the POST /private/webhooks request. + */ +enum TALER_MERCHANT_PostPrivateWebhooksOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_END = 0, + + /** + * Set the header template. + */ + TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_HEADER_TEMPLATE, + + /** + * Set the body template. + */ + TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_BODY_TEMPLATE + +}; + + +/** + * Value for an option for the POST /private/webhooks request. + */ +struct TALER_MERCHANT_PostPrivateWebhooksOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostPrivateWebhooksOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_HEADER_TEMPLATE. + */ + const char *header_template; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_BODY_TEMPLATE. + */ + const char *body_template; + + } details; + +}; + + +/** + * Handle for a POST /private/webhooks request. + */ +struct TALER_MERCHANT_PostPrivateWebhooksHandle; + + +/** + * Response details for a POST /private/webhooks request. + */ +struct TALER_MERCHANT_PostPrivateWebhooksResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + +}; + + +/** + * Set up POST /private/webhooks operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param webhook_id identifier for the new webhook + * @param event_type event type that triggers this webhook + * @param notification_url URL to send notifications to + * @param http_method HTTP method to use for notifications + * @return handle to operation + */ +struct TALER_MERCHANT_PostPrivateWebhooksHandle * +TALER_MERCHANT_post_private_webhooks_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *webhook_id, + const char *event_type, + const char *notification_url, + const char *http_method); + + +/** + * Terminate the list of the options. + * + * @return the terminating object of struct TALER_MERCHANT_PostPrivateWebhooksOptionValue + */ +#define TALER_MERCHANT_post_private_webhooks_option_end_() \ + (const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_END \ + } + +/** + * Set header template. + * + * @param ht header template string to set + * @return representation of the option as a struct TALER_MERCHANT_PostPrivateWebhooksOptionValue + */ +#define TALER_MERCHANT_post_private_webhooks_option_header_template(ht) \ + (const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_HEADER_TEMPLATE, \ + .details.header_template = (ht) \ + } + +/** + * Set body template. + * + * @param bt body template string to set + * @return representation of the option as a struct TALER_MERCHANT_PostPrivateWebhooksOptionValue + */ +#define TALER_MERCHANT_post_private_webhooks_option_body_template(bt) \ + (const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue) \ + { \ + .option = \ + TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_BODY_TEMPLATE, \ + .details.body_template = (bt) \ + } + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * @param ppwh the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_private_webhooks_set_options_ ( + struct TALER_MERCHANT_PostPrivateWebhooksHandle *ppwh, + unsigned int num_options, + const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * If any option fail other options may be or may be not applied. + * + * It should be used with helpers that create required options, for example: + * + * TALER_MERCHANT_post_private_webhooks_set_options ( + * ppwh, + * TALER_MERCHANT_post_private_webhooks_option_header_template ( + * "Content-Type: application/json")); + * + * @param ppwh the request to set the options for + * @param ... the list of the options, each option must be created + * by helpers TALER_MERCHANT_post_private_webhooks_option_NAME(VALUE) + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_private_webhooks_set_options(ppwh,...) \ + TALER_MERCHANT_post_private_webhooks_set_options_ ( \ + ppwh, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_private_webhooks_option_end_ () } \ + )) + + +#ifndef TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostPrivateWebhooksCallback. + */ +#define TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE */ + +/** + * Callback for a POST /private/webhooks request. + * + * @param cls closure + * @param wpr response details + */ +typedef void +(*TALER_MERCHANT_PostPrivateWebhooksCallback)( + TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostPrivateWebhooksResponse *wpr); + + +/** + * Start POST /private/webhooks operation. + * + * @param[in,out] ppwh operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_private_webhooks_start ( + struct TALER_MERCHANT_PostPrivateWebhooksHandle *ppwh, + TALER_MERCHANT_PostPrivateWebhooksCallback cb, + TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /private/webhooks operation. This function must not be + * called by clients after the TALER_MERCHANT_PostPrivateWebhooksCallback + * has been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] ppwh operation to cancel + */ +void +TALER_MERCHANT_post_private_webhooks_cancel ( + struct TALER_MERCHANT_PostPrivateWebhooksHandle *ppwh); + + +#endif /* _TALER_MERCHANT__POST_PRIVATE_WEBHOOKS_H */ diff --git a/src/include/taler/merchant/post-templates-TEMPLATE_ID.h b/src/include/taler/merchant/post-templates-TEMPLATE_ID.h @@ -0,0 +1,298 @@ +/* + 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/merchant/post-templates-TEMPLATE_ID.h + * @brief C interface for the POST /templates/$TEMPLATE_ID endpoint + * @author Christian Grothoff + */ +#ifndef _TALER_MERCHANT__POST_TEMPLATES_TEMPLATE_ID_H +#define _TALER_MERCHANT__POST_TEMPLATES_TEMPLATE_ID_H + +#include <taler/merchant/common.h> + + +/** + * Possible options for the POST /templates/$TEMPLATE_ID request. + */ +enum TALER_MERCHANT_PostTemplatesOption +{ + /** + * End of list of options. + */ + TALER_MERCHANT_POST_TEMPLATES_OPTION_END = 0, + + /** + * Order summary. + */ + TALER_MERCHANT_POST_TEMPLATES_OPTION_SUMMARY, + + /** + * Total amount for the order. + */ + TALER_MERCHANT_POST_TEMPLATES_OPTION_AMOUNT, + + /** + * Detailed contract customization (JSON). + */ + TALER_MERCHANT_POST_TEMPLATES_OPTION_DETAILS + +}; + + +/** + * Value for an option for the POST /templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_PostTemplatesOptionValue +{ + + /** + * Type of the option being set. + */ + enum TALER_MERCHANT_PostTemplatesOption option; + + /** + * Specific option value. + */ + union + { + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_TEMPLATES_OPTION_SUMMARY. + */ + const char *summary; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_TEMPLATES_OPTION_AMOUNT. + */ + const struct TALER_Amount *amount; + + /** + * Value if @e option is + * #TALER_MERCHANT_POST_TEMPLATES_OPTION_DETAILS. + */ + const json_t *details; + + } details; + +}; + + +/** + * Handle for a POST /templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_PostTemplatesHandle; + + +/** + * Response details for a POST /templates/$TEMPLATE_ID request. + */ +struct TALER_MERCHANT_PostTemplatesResponse +{ + + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on the HTTP status code. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * Identifier of the created order. + */ + const char *order_id; + + /** + * Claim token, or NULL. + */ + const struct TALER_ClaimTokenP *token; + + /** + * Payment deadline. + */ + struct GNUNET_TIME_Timestamp pay_deadline; + + } ok; + + } details; + +}; + + +/** + * Terminate the list of the options. + * + * @return the terminating object + */ +#define TALER_MERCHANT_post_templates_option_end_() \ + (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_END \ + } + +/** + * Set order summary. + * + * @param s summary string + * @return representation of the option + */ +#define TALER_MERCHANT_post_templates_option_summary(s) \ + (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_SUMMARY, \ + .details.summary = (s) \ + } + +/** + * Set total amount. + * + * @param a amount + * @return representation of the option + */ +#define TALER_MERCHANT_post_templates_option_amount(a) \ + (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_AMOUNT, \ + .details.amount = (a) \ + } + +/** + * Set detailed contract customization. + * + * @param d details JSON object + * @return representation of the option + */ +#define TALER_MERCHANT_post_templates_option_details(d) \ + (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ + { \ + .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_DETAILS, \ + .details.details = (d) \ + } + + +/** + * Set the requested options for the operation. + * + * @param pth the request to set the options for + * @param num_options length of the @a options array + * @param options an array of options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +enum GNUNET_GenericReturnValue +TALER_MERCHANT_post_templates_set_options_ ( + struct TALER_MERCHANT_PostTemplatesHandle *pth, + unsigned int num_options, + const struct TALER_MERCHANT_PostTemplatesOptionValue *options); + + +/** + * Set the requested options for the operation. + * + * @param pth the request to set the options for + * @param ... the list of the options + * @return #GNUNET_OK on success, + * #GNUNET_NO on failure, + * #GNUNET_SYSERR on internal error + */ +#define TALER_MERCHANT_post_templates_set_options(pth,...) \ + TALER_MERCHANT_post_templates_set_options_ ( \ + pth, \ + TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ + ((const struct TALER_MERCHANT_PostTemplatesOptionValue[]) \ + {__VA_ARGS__, TALER_MERCHANT_post_templates_option_end_ () } \ + )) + + +/** + * Set up POST /templates/$TEMPLATE_ID operation. + * Note that you must explicitly start the operation after + * possibly setting options. + * + * @param ctx the context + * @param url base URL of the merchant backend + * @param template_id identifier of the template to use + * @return handle to operation + */ +struct TALER_MERCHANT_PostTemplatesHandle * +TALER_MERCHANT_post_templates_create ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *template_id); + + +#ifndef TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE +/** + * Type of the closure used by + * the #TALER_MERCHANT_PostTemplatesCallback. + */ +#define TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE void +#endif /* TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE */ + +/** + * Callback for a POST /templates/$TEMPLATE_ID request. + * + * @param cls closure + * @param ptr response details + */ +typedef void +(*TALER_MERCHANT_PostTemplatesCallback)( + TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE *cls, + const struct TALER_MERCHANT_PostTemplatesResponse *ptr); + + +/** + * Start POST /templates/$TEMPLATE_ID operation. + * + * @param[in,out] pth operation to start + * @param cb function to call with the merchant's result + * @param cb_cls closure for @a cb + * @return status code, #TALER_EC_NONE on success + */ +enum TALER_ErrorCode +TALER_MERCHANT_post_templates_start ( + struct TALER_MERCHANT_PostTemplatesHandle *pth, + TALER_MERCHANT_PostTemplatesCallback cb, + TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE *cb_cls); + + +/** + * Cancel POST /templates/$TEMPLATE_ID operation. This function must not be + * called by clients after the TALER_MERCHANT_PostTemplatesCallback has + * been invoked (as in those cases it'll be called internally by the + * implementation already). + * + * @param[in] pth operation to cancel + */ +void +TALER_MERCHANT_post_templates_cancel ( + struct TALER_MERCHANT_PostTemplatesHandle *pth); + + +#endif /* _TALER_MERCHANT__POST_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/taler-merchant/Makefile.am b/src/include/taler/taler-merchant/Makefile.am @@ -1,74 +0,0 @@ -# This Makefile.am is in the public domain -SUBDIRS = . -talermerchantincludedir = $(includedir)/taler/taler-merchant - -talermerchantinclude_HEADERS = \ - common.h \ - delete-management-instances-INSTANCE.h \ - delete-private-accounts-H_WIRE.h \ - delete-private-donau-DONAU_SERIAL.h \ - delete-private-orders-ORDER_ID.h \ - delete-private-otp-devices-DEVICE_ID.h \ - delete-private-products-PRODUCT_ID.h \ - delete-private-templates-TEMPLATE_ID.h \ - delete-private-token.h \ - delete-private-tokens-SERIAL.h \ - delete-private-transfers-TID.h \ - delete-private-units-UNIT.h \ - delete-private-webhooks-WEBHOOK_ID.h \ - get-config.h \ - get-management-instances.h \ - get-management-instances-INSTANCE.h \ - get-private-kyc.h \ - get-private-statistics-amount-SLUG.h \ - get-private-statistics-counter-SLUG.h \ - get-orders-ORDER_ID.h \ - get-private-accounts.h \ - get-private-accounts-H_WIRE.h \ - get-private-donau.h \ - get-private-orders.h \ - get-private-orders-ORDER_ID.h \ - get-private-otp-devices.h \ - get-private-otp-devices-DEVICE_ID.h \ - get-private-products.h \ - get-private-products-PRODUCT_ID.h \ - get-private-templates.h \ - get-private-templates-TEMPLATE_ID.h \ - get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h \ - get-private-transfers.h \ - get-private-units.h \ - get-private-units-UNIT.h \ - get-private-webhooks.h \ - get-private-webhooks-WEBHOOK_ID.h \ - get-products-IMAGE_HASH-image.h \ - get-templates-TEMPLATE_ID.h \ - patch-management-instances-INSTANCE.h \ - patch-private-accounts-H_WIRE.h \ - patch-private-otp-devices-DEVICE_ID.h \ - patch-private-orders-ORDER_ID-forget.h \ - patch-private-products-PRODUCT_ID.h \ - patch-private-templates-TEMPLATE_ID.h \ - patch-private-units-UNIT.h \ - patch-private-webhooks-WEBHOOK_ID.h \ - post-management-instances.h \ - post-management-instances-INSTANCE-auth.h \ - post-orders-ORDER_ID-abort.h \ - post-orders-ORDER_ID-claim.h \ - post-orders-ORDER_ID-paid.h \ - post-orders-ORDER_ID-pay.h \ - post-orders-ORDER_ID-refund.h \ - post-private-accounts.h \ - post-private-categories.h \ - post-private-donau.h \ - post-private-orders.h \ - post-private-orders-ORDER_ID-refund.h \ - post-private-otp-devices.h \ - post-private-products.h \ - post-private-products-PRODUCT_ID-lock.h \ - post-private-templates.h \ - post-private-tokenfamilies.h \ - post-private-token.h \ - post-private-transfers.h \ - post-private-units.h \ - post-private-webhooks.h \ - post-templates-TEMPLATE_ID.h diff --git a/src/include/taler/taler-merchant/common.h b/src/include/taler/taler-merchant/common.h @@ -1,445 +0,0 @@ -/* - 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/common.h - * @brief Common functions of libtalermerchant not specific to a particular endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__COMMON_H -#define _TALER_MERCHANT__COMMON_H - -#include <jansson.h> -#include <taler/taler_util.h> -#include <taler/taler_error_codes.h> -#include <taler/taler_exchange_service.h> -#include <gnunet/gnunet_curl_lib.h> -#include <donau/donau_service.h> - - -/** - * Maximum number of options that can be set in one set_options - * call. Used as a dummy for "infinite" in the varargs case. - */ -#define TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE UINT_MAX - - -/** - * General information about the HTTP response we obtained - * from the merchant for a request. - */ -struct TALER_MERCHANT_HttpResponse -{ - - /** - * The complete JSON reply. NULL if we failed to parse the - * reply (too big, invalid JSON). - */ - const json_t *reply; - - /** - * Set to the human-readable 'hint' that is optionally - * provided by the merchant together with errors. NULL - * if no hint was provided or if there was no error. - */ - const char *hint; - - /** - * HTTP status code for the response. 0 if the - * HTTP request failed and we did not get any answer, or - * if the answer was invalid and we set @a ec to a - * client-side error code. - */ - unsigned int http_status; - - /** - * Taler error code. #TALER_EC_NONE if everything was - * OK. Usually set to the "code" field of an error - * response, but may be set to values created at the - * client side, for example when the response was - * not in JSON format or was otherwise ill-formed. - */ - enum TALER_ErrorCode ec; - - /** - * HTTP status code returned by the exchange, if - * the merchant forwarded an exchange error to us. - * Set to 0 if there was no exchange involved. - */ - unsigned int exchange_http_status; - - /** - * JSON reply from the exchange, if the merchant - * forwarded an exchange error to us. NULL otherwise. - */ - const json_t *exchange_reply; - - /** - * Taler error code from the exchange, if the merchant - * forwarded an exchange error to us. - */ - enum TALER_ErrorCode exchange_code; - - /** - * Human-readable hint from the exchange, if the merchant - * forwarded an exchange error to us. NULL otherwise. - */ - const char *exchange_hint; - -}; - - -/** - * Parse URI data for taler://pay/ URIs. - */ -struct TALER_MERCHANT_PayUriData -{ - - /** - * Hostname (and possibly port) of the merchant backend. - */ - char *merchant_host; - - /** - * Prefix path at the merchant backend (may be NULL). - */ - char *merchant_prefix_path; - - /** - * The order ID. - */ - char *order_id; - - /** - * The session ID (may be NULL if none given). - */ - char *session_id; - - /** - * Claim token (may be NULL if not given in the URI). - */ - struct TALER_ClaimTokenP *claim_token; - - /** - * Subscription session ID (SSID), may be NULL. - */ - char *ssid; - - /** - * Set to true if taler+http:// was used (test only). - */ - bool use_http; - -}; - - -/** - * Parse URI data for taler://refund/ URIs. - */ -struct TALER_MERCHANT_RefundUriData -{ - - /** - * Hostname (and possibly port) of the merchant backend. - */ - char *merchant_host; - - /** - * Prefix path at the merchant backend (may be NULL). - */ - char *merchant_prefix_path; - - /** - * The order ID. - */ - char *order_id; - - /** - * Subscription session ID (SSID), may be NULL. - */ - char *ssid; - - /** - * Set to true if taler+http:// was used (test only). - */ - bool use_http; - -}; - -/** - * Entry for one measurement unit. - */ -struct TALER_MERCHANT_UnitEntry -{ - - /** - * Identifier of the unit. - */ - const char *unit; - - /** - * Long (human-readable) name of the unit. - */ - const char *unit_name_long; - - /** - * Short symbol for the unit. - */ - const char *unit_name_short; - - const json_t *unit_name_long_i18n; - - const json_t *unit_name_short_i18n; - - /** - * Whether fractional quantities are allowed. - */ - bool unit_allow_fraction; - - /** - * Precision level for fractional quantities. - */ - uint32_t unit_precision_level; - - /** - * Whether this unit is currently active. - */ - bool unit_active; - - bool unit_builtin; - - /** - * Serial number of this unit in the database. - */ - uint64_t unit_serial; -}; - - -/** - * Wire transfer information associated with a paid order. - */ -struct TALER_MERCHANT_WireTransfer -{ - - /** - * Base URL of the exchange that made the transfer. - */ - const char *exchange_url; - - /** - * When the transfer took place (note: may not be exact, - * as the time at which the exchange initiated the transfer - * may differ from the time the bank or the merchant observed). - * Zero if not known. - */ - struct GNUNET_TIME_Timestamp execution_time; - - /** - * Wire transfer subject. - */ - struct TALER_WireTransferIdentifierRawP wtid; - - /** - * Total amount that was transferred. - */ - struct TALER_Amount total_amount; - - /** - * Deposit fees paid to the exchange for this order. - * @since protocol v26. - */ - struct TALER_Amount deposit_fee; - - /** - * Whether this transfer was confirmed by the merchant using - * the POST /transfers API, or whether it was merely claimed - * by the exchange. - */ - bool confirmed; - - /** - * Transfer serial ID of this wire transfer, useful as - * offset for the GET /private/incoming endpoint. - * @since protocol v25. - */ - uint64_t expected_transfer_serial_id; - -}; - - -/** - * Type of a statistics metric / aggregation mode. - */ -enum TALER_MERCHANT_StatisticsType -{ - /** - * Return statistics aggregated by bucket. - */ - TALER_MERCHANT_STATISTICS_BY_BUCKET = 0, - - /** - * Return statistics aggregated by time interval. - */ - TALER_MERCHANT_STATISTICS_BY_INTERVAL = 1, - - /** - * Return all available statistics (both buckets and intervals). - */ - TALER_MERCHANT_STATISTICS_ALL = 2 -}; - - -/** - * Information about a single MFA challenge sent by the merchant. - */ -struct TALER_MERCHANT_MfaChallengeEntry -{ - - /** - * Hint about where the challenge was sent (e.g. masked phone/email). - */ - const char *tan_info; - - /** - * Channel used for the challenge ("sms", "email", "totp"). - */ - const char *tan_channel; - - /** - * Challenge identifier (format: "$SERIAL-$H_BODY_HEX"). - */ - const char *challenge_id; - -}; - - -/** - * Response from the merchant requiring multi-factor authentication. - * Returned as HTTP 202 Accepted. - */ -struct TALER_MERCHANT_MfaChallengeResponse -{ - - /** - * If true, all challenges must be solved (AND combination). - * If false, solving any one challenge suffices (OR combination). - */ - bool combi_and; - - /** - * Number of entries in @e challenges. - */ - unsigned int challenges_length; - - /** - * Array of MFA challenges the client must solve. - */ - struct TALER_MERCHANT_MfaChallengeEntry *challenges; - -}; - - -/** - * Free data within a #TALER_MERCHANT_MfaChallengeResponse (but not - * the struct itself). - * - * @param cr response to clean up - */ -void -TALER_MERCHANT_mfa_challenge_response_free ( - struct TALER_MERCHANT_MfaChallengeResponse *cr); - - -/** - * Parse a taler://pay/ URI into its components. - * - * @param pay_uri the URI to parse - * @param[out] parse_data parsed URI data, to be freed with - * #TALER_MERCHANT_parse_pay_uri_free() - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_parse_pay_uri (const char *pay_uri, - struct TALER_MERCHANT_PayUriData *parse_data); - - -/** - * Free a #TALER_MERCHANT_PayUriData previously obtained from - * #TALER_MERCHANT_parse_pay_uri(). - * - * @param[in] parse_data the data to free (fields only, not the struct itself) - */ -void -TALER_MERCHANT_parse_pay_uri_free ( - struct TALER_MERCHANT_PayUriData *parse_data); - - -/** - * Parse a taler://refund/ URI into its components. - * - * @param refund_uri the URI to parse - * @param[out] parse_data parsed URI data, to be freed with - * #TALER_MERCHANT_parse_refund_uri_free() - * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_parse_refund_uri ( - const char *refund_uri, - struct TALER_MERCHANT_RefundUriData *parse_data); - - -/** - * Free a #TALER_MERCHANT_RefundUriData previously obtained from - * #TALER_MERCHANT_parse_refund_uri(). - * - * @param[in] parse_data the data to free (fields only, not the struct itself) - */ -void -TALER_MERCHANT_parse_refund_uri_free ( - struct TALER_MERCHANT_RefundUriData *parse_data); - - -/** - * Format a quantity into its decimal string representation. - * - * @param quantity integer part of the quantity - * @param quantity_frac fractional part - * @param[out] buffer output buffer - * @param buffer_length size of @a buffer - */ -void -TALER_MERCHANT_format_quantity_string (uint64_t quantity, - uint32_t quantity_frac, - char *buffer, - size_t buffer_length); - - -/** - * Format a stock value into its decimal string representation. - * - * @param total_stock integer part of the stock value - * @param total_stock_frac fractional part - * @param[out] buffer output buffer - * @param buffer_length size of @a buffer - */ -void -TALER_MERCHANT_format_stock_string (uint64_t total_stock, - uint32_t total_stock_frac, - char *buffer, - size_t buffer_length); - - -#endif diff --git a/src/include/taler/taler-merchant/delete-management-instances-INSTANCE.h b/src/include/taler/taler-merchant/delete-management-instances-INSTANCE.h @@ -1,192 +0,0 @@ -/* - 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/delete-management-instances-INSTANCE.h - * @brief C interface for DELETE /management/instances/$INSTANCE - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_MANAGEMENT_INSTANCES_INSTANCE_H -#define _TALER_MERCHANT__DELETE_MANAGEMENT_INSTANCES_INSTANCE_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /management/instances/$INSTANCE operation. - */ -struct TALER_MERCHANT_DeleteManagementInstanceHandle; - - -/** - * Set up DELETE /management/instances/$INSTANCE operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param instance_id identifier of the instance to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeleteManagementInstanceHandle * -TALER_MERCHANT_delete_management_instance_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id); - - -/** - * Options for DELETE /management/instances/$INSTANCE. - */ -enum TALER_MERCHANT_DeleteManagementInstanceOption -{ - /** - * Sentinel value, end of options. - */ - TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTION_END = 0, - - /** - * If set, purge (hard delete) the instance, removing all data. - * Without this option, a soft delete is performed (preserves data). - * Value type: none (presence of option means purge=yes). - */ - TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTION_PURGE -}; - - -/** - * Value for a DELETE /management/instances/$INSTANCE option. - */ -struct TALER_MERCHANT_DeleteManagementInstanceOptionValue -{ - /** - * Which option is being set. - */ - enum TALER_MERCHANT_DeleteManagementInstanceOption option; -}; - - -/** - * Set options for DELETE /management/instances/$INSTANCE operation. - * - * @param[in,out] handle the handle to set options for - * @param num_options length of the @a options array - * @param options array of option values (terminated with _END) - */ -void -TALER_MERCHANT_delete_management_instance_set_options_ ( - struct TALER_MERCHANT_DeleteManagementInstanceHandle *handle, - unsigned int num_options, - const struct TALER_MERCHANT_DeleteManagementInstanceOptionValue options[]); - - -/** - * Maximum number of options for set_options macro. - */ -#define TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTIONS_ARRAY_MAX_SIZE 4 - -/** - * Set options for DELETE /management/instances/$INSTANCE operation. - * Variadic macro wrapper around - * #TALER_MERCHANT_delete_management_instance_set_options_(). - * - * @param handle the handle to set options for - * @param ... option values (automatically terminated with _END) - */ -#define TALER_MERCHANT_delete_management_instance_set_options(handle, ...) \ - do { \ - struct TALER_MERCHANT_DeleteManagementInstanceOptionValue __opts[] = { \ - __VA_ARGS__, \ - { .option = TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_OPTION_END } \ - }; \ - TALER_MERCHANT_delete_management_instance_set_options_ ( \ - handle, \ - sizeof (__opts) / sizeof (__opts[0]) - 1, \ - __opts); \ - } while (0) - - -/** - * Response details for a DELETE /management/instances/$INSTANCE request. - */ -struct TALER_MERCHANT_DeleteManagementInstanceResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on HTTP status code. - */ - union - { - /** - * Details in case HTTP status code is #MHD_HTTP_ACCEPTED. - */ - struct TALER_MERCHANT_MfaChallengeResponse accepted; - } details; -}; - - -#ifndef TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeleteManagementInstanceCallback. - */ -#define TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /management/instances/$INSTANCE request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeleteManagementInstanceCallback)( - TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeleteManagementInstanceResponse *result); - - -/** - * Start DELETE /management/instances/$INSTANCE operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_management_instance_start ( - struct TALER_MERCHANT_DeleteManagementInstanceHandle *handle, - TALER_MERCHANT_DeleteManagementInstanceCallback cb, - TALER_MERCHANT_DELETE_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /management/instances/$INSTANCE operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_management_instance_cancel ( - struct TALER_MERCHANT_DeleteManagementInstanceHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_MANAGEMENT_INSTANCES_INSTANCE_H */ diff --git a/src/include/taler/taler-merchant/delete-private-accounts-H_WIRE.h b/src/include/taler/taler-merchant/delete-private-accounts-H_WIRE.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-accounts-H_WIRE.h - * @brief C interface for DELETE /private/accounts/$H_WIRE - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_ACCOUNTS_H_WIRE_H -#define _TALER_MERCHANT__DELETE_PRIVATE_ACCOUNTS_H_WIRE_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/accounts/$H_WIRE operation. - */ -struct TALER_MERCHANT_DeletePrivateAccountHandle; - - -/** - * Set up DELETE /private/accounts/$H_WIRE operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param h_wire hash of the wire details identifying the account to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateAccountHandle * -TALER_MERCHANT_delete_private_account_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_MerchantWireHashP *h_wire); - - -/** - * Response details for a DELETE /private/accounts/$H_WIRE request. - */ -struct TALER_MERCHANT_DeletePrivateAccountResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateAccountCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/accounts/$H_WIRE request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateAccountCallback)( - TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateAccountResponse *result); - - -/** - * Start DELETE /private/accounts/$H_WIRE operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_account_start ( - struct TALER_MERCHANT_DeletePrivateAccountHandle *handle, - TALER_MERCHANT_DeletePrivateAccountCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_ACCOUNT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/accounts/$H_WIRE operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_account_cancel ( - struct TALER_MERCHANT_DeletePrivateAccountHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_ACCOUNTS_H_WIRE_H */ diff --git a/src/include/taler/taler-merchant/delete-private-donau-DONAU_SERIAL.h b/src/include/taler/taler-merchant/delete-private-donau-DONAU_SERIAL.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-donau-DONAU_SERIAL.h - * @brief C interface for DELETE /private/donau/$DONAU_SERIAL - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_DONAU_DONAU_SERIAL_H -#define _TALER_MERCHANT__DELETE_PRIVATE_DONAU_DONAU_SERIAL_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/donau/$DONAU_SERIAL operation. - */ -struct TALER_MERCHANT_DeletePrivateDonauHandle; - - -/** - * Set up DELETE /private/donau/$DONAU_SERIAL operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param charity_id charity identifier to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateDonauHandle * -TALER_MERCHANT_delete_private_donau_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - uint64_t charity_id); - - -/** - * Response details for a DELETE /private/donau/$DONAU_SERIAL request. - */ -struct TALER_MERCHANT_DeletePrivateDonauResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateDonauCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/donau/$DONAU_SERIAL request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateDonauCallback)( - TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateDonauResponse *result); - - -/** - * Start DELETE /private/donau/$DONAU_SERIAL operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_donau_start ( - struct TALER_MERCHANT_DeletePrivateDonauHandle *handle, - TALER_MERCHANT_DeletePrivateDonauCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_DONAU_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/donau/$DONAU_SERIAL operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_donau_cancel ( - struct TALER_MERCHANT_DeletePrivateDonauHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_DONAU_DONAU_SERIAL_H */ diff --git a/src/include/taler/taler-merchant/delete-private-orders-ORDER_ID.h b/src/include/taler/taler-merchant/delete-private-orders-ORDER_ID.h @@ -1,197 +0,0 @@ -/* - 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/delete-private-orders-ORDER_ID.h - * @brief C interface for DELETE /private/orders/$ORDER_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H -#define _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/orders/$ORDER_ID operation. - */ -struct TALER_MERCHANT_DeletePrivateOrderHandle; - - -/** - * Set up DELETE /private/orders/$ORDER_ID operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param order_id identifier of the order to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateOrderHandle * -TALER_MERCHANT_delete_private_order_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id); - - -/** - * Options for DELETE /private/orders/$ORDER_ID. - */ -enum TALER_MERCHANT_DeletePrivateOrderOption -{ - /** - * Sentinel value, end of options. - */ - TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_END = 0, - - /** - * If set, force deletion even if order has payments. - * Value type: none (presence of option means force=true). - */ - TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_FORCE -}; - - -/** - * Value for a DELETE /private/orders/$ORDER_ID option. - */ -struct TALER_MERCHANT_DeletePrivateOrderOptionValue -{ - /** - * Which option is being set. - */ - enum TALER_MERCHANT_DeletePrivateOrderOption option; -}; - - -/** - * Ends list of options. - */ -#define TALER_MERCHANT_delete_private_order_set_option_end() \ - (struct TALER_MERCHANT_DeletePrivateOrderOptionValue) \ - { .option = TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_END } - -/** - * Force deletion even if the order has been claimed. - */ -#define TALER_MERCHANT_delete_private_order_set_option_force() \ - (struct TALER_MERCHANT_DeletePrivateOrderOptionValue) \ - { .option = TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTION_FORCE } - - -/** - * Set options for DELETE /private/orders/$ORDER_ID operation. - * - * @param[in,out] handle the handle to set options for - * @param num_options length of the @a options array - * @param options array of option values (terminated with _END) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_delete_private_order_set_options_ ( - struct TALER_MERCHANT_DeletePrivateOrderHandle *handle, - unsigned int num_options, - const struct TALER_MERCHANT_DeletePrivateOrderOptionValue options[]); - - -/** - * Maximum number of options for set_options macro. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTIONS_ARRAY_MAX_SIZE 4 - -/** - * Set options for DELETE /private/orders/$ORDER_ID operation. - * Variadic macro wrapper around - * #TALER_MERCHANT_delete_private_order_set_options_(). - * - * @param handle the handle to set options for - * @param ... option values (automatically terminated with _END) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_delete_private_order_set_options(handle, ...) \ - TALER_MERCHANT_delete_private_order_set_options_ ( \ - handle, \ - TALER_MERCHANT_DELETE_PRIVATE_ORDER_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_DeletePrivateOrderOptionValue[]) \ - {__VA_ARGS__, \ - TALER_MERCHANT_delete_private_order_set_option_end () } \ - )) - -/** - * Response details for a DELETE /private/orders/$ORDER_ID request. - */ -struct TALER_MERCHANT_DeletePrivateOrderResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateOrderCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/orders/$ORDER_ID request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateOrderCallback)( - TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateOrderResponse *result); - - -/** - * Start DELETE /private/orders/$ORDER_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_order_start ( - struct TALER_MERCHANT_DeletePrivateOrderHandle *handle, - TALER_MERCHANT_DeletePrivateOrderCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_ORDER_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/orders/$ORDER_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_order_cancel ( - struct TALER_MERCHANT_DeletePrivateOrderHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_ORDERS_ORDER_ID_H */ diff --git a/src/include/taler/taler-merchant/delete-private-otp-devices-DEVICE_ID.h b/src/include/taler/taler-merchant/delete-private-otp-devices-DEVICE_ID.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-otp-devices-DEVICE_ID.h - * @brief C interface for DELETE /private/otp-devices/$DEVICE_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_OTP_DEVICES_DEVICE_ID_H -#define _TALER_MERCHANT__DELETE_PRIVATE_OTP_DEVICES_DEVICE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/otp-devices/$DEVICE_ID operation. - */ -struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle; - - -/** - * Set up DELETE /private/otp-devices/$DEVICE_ID operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param otp_device_id identifier of the OTP device to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle * -TALER_MERCHANT_delete_private_otp_device_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *otp_device_id); - - -/** - * Response details for a DELETE /private/otp-devices/$DEVICE_ID request. - */ -struct TALER_MERCHANT_DeletePrivateOtpDeviceResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateOtpDeviceCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/otp-devices/$DEVICE_ID request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateOtpDeviceCallback)( - TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateOtpDeviceResponse *result); - - -/** - * Start DELETE /private/otp-devices/$DEVICE_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_otp_device_start ( - struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle *handle, - TALER_MERCHANT_DeletePrivateOtpDeviceCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/otp-devices/$DEVICE_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_otp_device_cancel ( - struct TALER_MERCHANT_DeletePrivateOtpDeviceHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_OTP_DEVICES_DEVICE_ID_H */ diff --git a/src/include/taler/taler-merchant/delete-private-products-PRODUCT_ID.h b/src/include/taler/taler-merchant/delete-private-products-PRODUCT_ID.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-products-PRODUCT_ID.h - * @brief C interface for DELETE /private/products/$PRODUCT_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_PRODUCTS_PRODUCT_ID_H -#define _TALER_MERCHANT__DELETE_PRIVATE_PRODUCTS_PRODUCT_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/products/$PRODUCT_ID operation. - */ -struct TALER_MERCHANT_DeletePrivateProductHandle; - - -/** - * Set up DELETE /private/products/$PRODUCT_ID operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param product_id identifier of the product to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateProductHandle * -TALER_MERCHANT_delete_private_product_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *product_id); - - -/** - * Response details for a DELETE /private/products/$PRODUCT_ID request. - */ -struct TALER_MERCHANT_DeletePrivateProductResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateProductCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/products/$PRODUCT_ID request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateProductCallback)( - TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateProductResponse *result); - - -/** - * Start DELETE /private/products/$PRODUCT_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_product_start ( - struct TALER_MERCHANT_DeletePrivateProductHandle *handle, - TALER_MERCHANT_DeletePrivateProductCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_PRODUCT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/products/$PRODUCT_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_product_cancel ( - struct TALER_MERCHANT_DeletePrivateProductHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_PRODUCTS_PRODUCT_ID_H */ diff --git a/src/include/taler/taler-merchant/delete-private-templates-TEMPLATE_ID.h b/src/include/taler/taler-merchant/delete-private-templates-TEMPLATE_ID.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-templates-TEMPLATE_ID.h - * @brief C interface for DELETE /private/templates/$TEMPLATE_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TEMPLATES_TEMPLATE_ID_H -#define _TALER_MERCHANT__DELETE_PRIVATE_TEMPLATES_TEMPLATE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/templates/$TEMPLATE_ID operation. - */ -struct TALER_MERCHANT_DeletePrivateTemplateHandle; - - -/** - * Set up DELETE /private/templates/$TEMPLATE_ID operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param template_id identifier of the template to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateTemplateHandle * -TALER_MERCHANT_delete_private_template_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *template_id); - - -/** - * Response details for a DELETE /private/templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_DeletePrivateTemplateResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateTemplateCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/templates/$TEMPLATE_ID request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateTemplateCallback)( - TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateTemplateResponse *result); - - -/** - * Start DELETE /private/templates/$TEMPLATE_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_template_start ( - struct TALER_MERCHANT_DeletePrivateTemplateHandle *handle, - TALER_MERCHANT_DeletePrivateTemplateCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_TEMPLATE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/templates/$TEMPLATE_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_template_cancel ( - struct TALER_MERCHANT_DeletePrivateTemplateHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/taler-merchant/delete-private-token.h b/src/include/taler/taler-merchant/delete-private-token.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-token.h - * @brief C interface for DELETE /private/token - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H -#define _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/token operation. - */ -struct TALER_MERCHANT_DeletePrivateTokenHandle; - - -/** - * Set up DELETE /private/token operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param instance_id identifier of the instance - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateTokenHandle * -TALER_MERCHANT_delete_private_token_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id); - - -/** - * Response details for a DELETE /private/token request. - */ -struct TALER_MERCHANT_DeletePrivateTokenResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateTokenCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/token request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateTokenCallback)( - TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateTokenResponse *result); - - -/** - * Start DELETE /private/token operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_token_start ( - struct TALER_MERCHANT_DeletePrivateTokenHandle *handle, - TALER_MERCHANT_DeletePrivateTokenCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/token operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_token_cancel ( - struct TALER_MERCHANT_DeletePrivateTokenHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H */ diff --git a/src/include/taler/taler-merchant/delete-private-tokens-SERIAL.h b/src/include/taler/taler-merchant/delete-private-tokens-SERIAL.h @@ -1,112 +0,0 @@ -/* - 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/delete-private-tokens-SERIAL.h - * @brief C interface for DELETE /private/tokens/$SERIAL - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TOKENS_SERIAL_H -#define _TALER_MERCHANT__DELETE_PRIVATE_TOKENS_SERIAL_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/tokens/$SERIAL operation. - */ -struct TALER_MERCHANT_DeletePrivateTokensSerialHandle; - - -/** - * Set up DELETE /private/tokens/$SERIAL operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param instance_id identifier of the instance - * @param serial serial number of the token to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateTokensSerialHandle * -TALER_MERCHANT_delete_private_tokens_serial_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id, - uint64_t serial); - - -/** - * Response details for a DELETE /private/tokens/$SERIAL request. - */ -struct TALER_MERCHANT_DeletePrivateTokensSerialResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateTokensSerialCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/tokens/$SERIAL request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateTokensSerialCallback)( - TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateTokensSerialResponse *result); - - -/** - * Start DELETE /private/tokens/$SERIAL operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_tokens_serial_start ( - struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *handle, - TALER_MERCHANT_DeletePrivateTokensSerialCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/tokens/$SERIAL operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_tokens_serial_cancel ( - struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TOKENS_SERIAL_H */ diff --git a/src/include/taler/taler-merchant/delete-private-transfers-TID.h b/src/include/taler/taler-merchant/delete-private-transfers-TID.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-transfers-TID.h - * @brief C interface for DELETE /private/transfers/$TID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TRANSFERS_TID_H -#define _TALER_MERCHANT__DELETE_PRIVATE_TRANSFERS_TID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/transfers/$TID operation. - */ -struct TALER_MERCHANT_DeletePrivateTransferHandle; - - -/** - * Set up DELETE /private/transfers/$TID operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param wire_transfer_serial serial number of the wire transfer to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateTransferHandle * -TALER_MERCHANT_delete_private_transfer_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - uint64_t wire_transfer_serial); - - -/** - * Response details for a DELETE /private/transfers/$TID request. - */ -struct TALER_MERCHANT_DeletePrivateTransferResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateTransferCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/transfers/$TID request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateTransferCallback)( - TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateTransferResponse *result); - - -/** - * Start DELETE /private/transfers/$TID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_transfer_start ( - struct TALER_MERCHANT_DeletePrivateTransferHandle *handle, - TALER_MERCHANT_DeletePrivateTransferCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_TRANSFER_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/transfers/$TID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_transfer_cancel ( - struct TALER_MERCHANT_DeletePrivateTransferHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TRANSFERS_TID_H */ diff --git a/src/include/taler/taler-merchant/delete-private-units-UNIT.h b/src/include/taler/taler-merchant/delete-private-units-UNIT.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-units-UNIT.h - * @brief C interface for DELETE /private/units/$UNIT - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_UNITS_UNIT_H -#define _TALER_MERCHANT__DELETE_PRIVATE_UNITS_UNIT_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/units/$UNIT operation. - */ -struct TALER_MERCHANT_DeletePrivateUnitHandle; - - -/** - * Set up DELETE /private/units/$UNIT operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param unit_id identifier of the unit to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateUnitHandle * -TALER_MERCHANT_delete_private_unit_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *unit_id); - - -/** - * Response details for a DELETE /private/units/$UNIT request. - */ -struct TALER_MERCHANT_DeletePrivateUnitResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateUnitCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/units/$UNIT request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateUnitCallback)( - TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateUnitResponse *result); - - -/** - * Start DELETE /private/units/$UNIT operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_unit_start ( - struct TALER_MERCHANT_DeletePrivateUnitHandle *handle, - TALER_MERCHANT_DeletePrivateUnitCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_UNIT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/units/$UNIT operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_unit_cancel ( - struct TALER_MERCHANT_DeletePrivateUnitHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_UNITS_UNIT_H */ diff --git a/src/include/taler/taler-merchant/delete-private-webhooks-WEBHOOK_ID.h b/src/include/taler/taler-merchant/delete-private-webhooks-WEBHOOK_ID.h @@ -1,110 +0,0 @@ -/* - 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/delete-private-webhooks-WEBHOOK_ID.h - * @brief C interface for DELETE /private/webhooks/$WEBHOOK_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__DELETE_PRIVATE_WEBHOOKS_WEBHOOK_ID_H -#define _TALER_MERCHANT__DELETE_PRIVATE_WEBHOOKS_WEBHOOK_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a DELETE /private/webhooks/$WEBHOOK_ID operation. - */ -struct TALER_MERCHANT_DeletePrivateWebhookHandle; - - -/** - * Set up DELETE /private/webhooks/$WEBHOOK_ID operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx curl context - * @param url merchant backend base URL - * @param webhook_id identifier of the webhook to delete - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_DeletePrivateWebhookHandle * -TALER_MERCHANT_delete_private_webhook_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *webhook_id); - - -/** - * Response details for a DELETE /private/webhooks/$WEBHOOK_ID request. - */ -struct TALER_MERCHANT_DeletePrivateWebhookResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_DeletePrivateWebhookCallback. - */ -#define TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE */ - -/** - * Type of the function that receives the result of a - * DELETE /private/webhooks/$WEBHOOK_ID request. - * - * @param cls closure - * @param result result returned by the HTTP server - */ -typedef void -(*TALER_MERCHANT_DeletePrivateWebhookCallback)( - TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_DeletePrivateWebhookResponse *result); - - -/** - * Start DELETE /private/webhooks/$WEBHOOK_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_delete_private_webhook_start ( - struct TALER_MERCHANT_DeletePrivateWebhookHandle *handle, - TALER_MERCHANT_DeletePrivateWebhookCallback cb, - TALER_MERCHANT_DELETE_PRIVATE_WEBHOOK_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel DELETE /private/webhooks/$WEBHOOK_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_delete_private_webhook_cancel ( - struct TALER_MERCHANT_DeletePrivateWebhookHandle *handle); - - -#endif /* _TALER_MERCHANT__DELETE_PRIVATE_WEBHOOKS_WEBHOOK_ID_H */ diff --git a/src/include/taler/taler-merchant/get-config.h b/src/include/taler/taler-merchant/get-config.h @@ -1,308 +0,0 @@ -/* - 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/get-config.h - * @brief C interface for the GET /config endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_CONFIG_H -#define _TALER_MERCHANT__GET_CONFIG_H - -#include <taler/taler-merchant/common.h> - - -/** - * Version compatibility status for the merchant backend. - */ -enum TALER_MERCHANT_GetConfigVersionCompatibility -{ - /** - * The client and server are at the same version. - */ - TALER_MERCHANT_GET_CONFIG_VC_MATCH = 0, - - /** - * The server is running a newer API version. - */ - TALER_MERCHANT_GET_CONFIG_VC_NEWER = 1, - - /** - * The server is running an older API version. - */ - TALER_MERCHANT_GET_CONFIG_VC_OLDER = 2, - - /** - * The versions are incompatible. - */ - TALER_MERCHANT_GET_CONFIG_VC_INCOMPATIBLE = 4, - - /** - * A protocol error occurred. - */ - TALER_MERCHANT_GET_CONFIG_VC_PROTOCOL_ERROR = 8 -}; - - -/** - * Information about an exchange as returned in the config response. - */ -struct TALER_MERCHANT_GetConfigExchangeInfo -{ - - /** - * Base URL of the exchange. - */ - const char *base_url; - - /** - * Currency served by this exchange. - */ - const char *currency; - - /** - * Master public key of the exchange. - */ - struct TALER_MasterPublicKeyP master_pub; - -}; - - -/** - * Handle for a GET /config request. - */ -struct TALER_MERCHANT_GetConfigHandle; - - -/** - * Response details for a GET /config request. - */ -struct TALER_MERCHANT_GetConfigResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * API version string. - */ - const char *version; - - /** - * Currency used by this merchant backend. - */ - const char *currency; - - /** - * Compatibility status with the client library. - */ - enum TALER_MERCHANT_GetConfigVersionCompatibility compat; - - /** - * Number of exchanges in @a exchanges. - */ - unsigned int num_exchanges; - - /** - * Array of exchange configurations. - */ - const struct TALER_MERCHANT_GetConfigExchangeInfo *exchanges; - - /** - * Number of currency specifications in @a cspecs. - */ - unsigned int num_cspecs; - - /** - * Array of currency specifications. - */ - const struct TALER_CurrencySpecification *cspecs; - - /** - * Currency information returned by the backend. - */ - struct - { - /** - * Currency string. - */ - const char *currency; - - /** - * Version string. - */ - const char *version; - } ci; - - /** - * Implementation identifier (e.g. - * "urn:net:taler:specs:taler-merchant:c-reference"). - * NULL if not provided. - */ - const char *implementation; - - /** - * Whether the backend supports self-provisioning. - */ - bool have_self_provisioning; - - /** - * Whether the backend was compiled with Donau support. - */ - bool have_donau; - - /** - * Allowed payment target types (as a string). - * NULL if not provided. - */ - const char *payment_target_types; - - /** - * Payment target regex (as a string). - * NULL if not provided. - */ - const char *payment_target_regex; - - /** - * Mandatory TAN channels (JSON array of strings). - * NULL if not provided. - */ - const json_t *mandatory_tan_channels; - - /** - * Default pay delay. - */ - struct GNUNET_TIME_Relative default_pay_delay; - - /** - * Default refund delay. - */ - struct GNUNET_TIME_Relative default_refund_delay; - - /** - * Default wire transfer delay. - */ - struct GNUNET_TIME_Relative default_wire_transfer_delay; - - /** - * Default persona. - */ - const char *default_persona; - - /** - * Report generators (JSON array of strings). - * NULL if not provided. - * // FIXME: split up into array of strings? - */ - const json_t *report_generators; - - /** - * Phone regex for validation. - * NULL if not provided. - */ - const char *phone_regex; - - /** - * SPA configuration options (JSON object). - * NULL if not provided. - */ - const json_t *spa_options; - - } ok; - - } details; - -}; - - -/** - * Set up GET /config operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetConfigHandle * -TALER_MERCHANT_get_config_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetConfigCallback. - */ -#define TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE */ - -/** - * Callback for a GET /config request. - * - * @param cls closure - * @param cr response details - */ -typedef void -(*TALER_MERCHANT_GetConfigCallback)( - TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetConfigResponse *cr); - - -/** - * Start GET /config operation. - * - * @param[in,out] gch operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_config_start ( - struct TALER_MERCHANT_GetConfigHandle *gch, - TALER_MERCHANT_GetConfigCallback cb, - TALER_MERCHANT_GET_CONFIG_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /config operation. This function must not be called - * by clients after the TALER_MERCHANT_GetConfigCallback has been - * invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gch operation to cancel - */ -void -TALER_MERCHANT_get_config_cancel ( - struct TALER_MERCHANT_GetConfigHandle *gch); - - -#endif /* _TALER_MERCHANT__GET_CONFIG_H */ diff --git a/src/include/taler/taler-merchant/get-management-instances-INSTANCE.h b/src/include/taler/taler-merchant/get-management-instances-INSTANCE.h @@ -1,267 +0,0 @@ -/* - 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/get-management-instances-INSTANCE.h - * @brief C interface for GET /management/instances/$INSTANCE of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H -#define _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /management/instances/$INSTANCE request. - */ -struct TALER_MERCHANT_GetManagementInstanceHandle; - - -/** - * Account details for a merchant wire account - * as returned by GET /management/instances/$INSTANCE. - */ -struct TALER_MERCHANT_ManagementAccountEntry -{ - - /** - * Full payto URI of the account. - */ - struct TALER_FullPayto payto_uri; - - /** - * URL of the credit facade (optional, may be NULL). - */ - const char *credit_facade_url; - - /** - * Hash of the wire details. - */ - struct TALER_MerchantWireHashP h_wire; - - /** - * Salt used to compute @e h_wire. - */ - struct TALER_WireSaltP salt; - - /** - * True if the account is active. - */ - bool active; - -}; - - -/** - * Detailed information about a merchant instance. - */ -struct TALER_MERCHANT_GetManagementInstanceDetails -{ - - /** - * Human-readable name of the instance. - */ - const char *name; - - /** - * Public key of the merchant instance. - */ - struct TALER_MerchantPublicKeyP merchant_pub; - - /** - * Whether to use the STEFAN curve for fee calculations. - */ - bool use_stefan; - - /** - * Default wire transfer delay. - */ - struct GNUNET_TIME_Relative default_wire_transfer_delay; - - /** - * Default payment deadline. - */ - struct GNUNET_TIME_Relative default_pay_delay; - - /** - * Default refund deadline. - */ - struct GNUNET_TIME_Relative default_refund_delay; - - /** - * Default wire transfer rounding interval. - */ - enum GNUNET_TIME_RounderInterval default_wire_transfer_rounding_interval; - - /** - * Merchant address (JSON). - */ - const json_t *address; - - /** - * Merchant jurisdiction (JSON). - */ - const json_t *jurisdiction; - - /** - * Email address of the merchant (optional, may be NULL). - */ - const char *email; - - /** - * Whether the email address has been validated. - * Only meaningful if @e email is not NULL. - */ - bool email_validated; - - /** - * Phone number of the merchant (optional, may be NULL). - */ - const char *phone_number; - - /** - * Whether the phone number has been validated. - * Only meaningful if @e phone_number is not NULL. - */ - bool phone_validated; - - /** - * Website URL of the merchant (optional, may be NULL). - */ - const char *website; - - /** - * Logo of the merchant (optional, may be NULL). - */ - const char *logo; - -}; - - -/** - * Response details for a GET /management/instances/$INSTANCE request. - */ -struct TALER_MERCHANT_GetManagementInstanceResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Detailed information about the instance. - */ - struct TALER_MERCHANT_GetManagementInstanceDetails details; - - /** - * Number of accounts in @a accounts. - */ - unsigned int accounts_length; - - /** - * Array of account entries. - */ - const struct TALER_MERCHANT_ManagementAccountEntry *accounts; - - } ok; - - } details; - -}; - - -/** - * Set up GET /management/instances/$INSTANCE operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param instance_id identifier of the instance to retrieve, - * NULL for admin instance - * @return handle to operation - */ -struct TALER_MERCHANT_GetManagementInstanceHandle * -TALER_MERCHANT_get_management_instance_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id); - - -#ifndef TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetManagementInstanceCallback. - */ -#define TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE */ - -/** - * Callback for a GET /management/instances/$INSTANCE request. - * - * @param cls closure - * @param igr response details - */ -typedef void -(*TALER_MERCHANT_GetManagementInstanceCallback)( - TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetManagementInstanceResponse *igr); - - -/** - * Start GET /management/instances/$INSTANCE operation. - * - * @param[in,out] gmi operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_management_instance_start ( - struct TALER_MERCHANT_GetManagementInstanceHandle *gmi, - TALER_MERCHANT_GetManagementInstanceCallback cb, - TALER_MERCHANT_GET_MANAGEMENT_INSTANCE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /management/instances/$INSTANCE operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetManagementInstanceCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gmi operation to cancel - */ -void -TALER_MERCHANT_get_management_instance_cancel ( - struct TALER_MERCHANT_GetManagementInstanceHandle *gmi); - - -#endif /* _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_INSTANCE_H */ diff --git a/src/include/taler/taler-merchant/get-management-instances.h b/src/include/taler/taler-merchant/get-management-instances.h @@ -1,181 +0,0 @@ -/* - 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/get-management-instances.h - * @brief C interface for the GET /management/instances endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H -#define _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /management/instances request. - */ -struct TALER_MERCHANT_GetManagementInstancesHandle; - - -/** - * Information about one merchant instance. - */ -struct TALER_MERCHANT_GetManagementInstancesInstanceInfo -{ - - /** - * Instance identifier string. - */ - const char *id; - - /** - * Human-readable name of the instance. - */ - const char *name; - - /** - * Public key of the instance. - */ - struct TALER_MerchantPublicKeyP merchant_pub; - - /** - * JSON array of supported payment targets. - */ - const json_t *payment_targets; - - /** - * Website URL of the instance, or NULL if not set. - */ - const char *website; - - /** - * Logo (data URL) of the instance, or NULL if not set. - */ - const char *logo; - - /** - * True if this instance has been deleted. - */ - bool deleted; - -}; - - -/** - * Response details for a GET /management/instances request. - */ -struct TALER_MERCHANT_GetManagementInstancesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of instances in @a iis. - */ - unsigned int iis_length; - - /** - * Array of instance information. - */ - const struct TALER_MERCHANT_GetManagementInstancesInstanceInfo *iis; - - } ok; - - } details; - -}; - - -/** - * Set up GET /management/instances operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetManagementInstancesHandle * -TALER_MERCHANT_get_management_instances_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetManagementInstancesCallback. - */ -#define TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE */ - -/** - * Callback for a GET /management/instances request. - * - * @param cls closure - * @param igr response details - */ -typedef void -(*TALER_MERCHANT_GetManagementInstancesCallback)( - TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetManagementInstancesResponse *igr); - - -/** - * Start GET /management/instances operation. - * - * @param[in,out] gimh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_management_instances_start ( - struct TALER_MERCHANT_GetManagementInstancesHandle *gimh, - TALER_MERCHANT_GetManagementInstancesCallback cb, - TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /management/instances operation. This function must not be - * called by clients after the TALER_MERCHANT_GetManagementInstancesCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gimh operation to cancel - */ -void -TALER_MERCHANT_get_management_instances_cancel ( - struct TALER_MERCHANT_GetManagementInstancesHandle *gimh); - - -#endif /* _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H */ diff --git a/src/include/taler/taler-merchant/get-orders-ORDER_ID.h b/src/include/taler/taler-merchant/get-orders-ORDER_ID.h @@ -1,450 +0,0 @@ -/* - 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/get-orders-ORDER_ID.h - * @brief C interface for the GET /orders/$ORDER_ID endpoint (wallet-facing) - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_ORDERS_ORDER_ID_H -#define _TALER_MERCHANT__GET_ORDERS_ORDER_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /orders/$ORDER_ID request. - */ -enum TALER_MERCHANT_GetOrdersOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_ORDERS_OPTION_END = 0, - - /** - * Long polling timeout. - */ - TALER_MERCHANT_GET_ORDERS_OPTION_TIMEOUT, - - /** - * Session ID for repurchase detection. - */ - TALER_MERCHANT_GET_ORDERS_OPTION_SESSION_ID, - - /** - * Minimum refund amount to wait for. - */ - TALER_MERCHANT_GET_ORDERS_OPTION_MIN_REFUND, - - /** - * If true, wait until refund is confirmed obtained. - */ - TALER_MERCHANT_GET_ORDERS_OPTION_AWAIT_REFUND_OBTAINED, - - /** - * Hash of the contract terms (for authentication). - */ - TALER_MERCHANT_GET_ORDERS_OPTION_H_CONTRACT, - - /** - * Claim token for unclaimed order authentication. - */ - TALER_MERCHANT_GET_ORDERS_OPTION_TOKEN, - - /** - * Whether refunded orders count for repurchase detection. - */ - TALER_MERCHANT_GET_ORDERS_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE - -}; - - -/** - * Value for an option for the GET /orders/$ORDER_ID request. - */ -struct TALER_MERCHANT_GetOrdersOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetOrdersOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_ORDERS_OPTION_TIMEOUT. - */ - struct GNUNET_TIME_Relative timeout; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_ORDERS_OPTION_SESSION_ID. - */ - const char *session_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_ORDERS_OPTION_MIN_REFUND. - */ - struct TALER_Amount min_refund; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_ORDERS_OPTION_AWAIT_REFUND_OBTAINED. - */ - bool await_refund_obtained; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_ORDERS_OPTION_H_CONTRACT. - */ - struct TALER_PrivateContractHashP h_contract; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_ORDERS_OPTION_TOKEN. - */ - struct TALER_ClaimTokenP token; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_ORDERS_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE. - */ - enum TALER_EXCHANGE_YesNoAll allow_refunded_for_repurchase; - - } details; - -}; - - -/** - * Handle for a GET /orders/$ORDER_ID request (wallet-facing). - */ -struct TALER_MERCHANT_GetOrdersHandle; - - -/** - * Set up GET /orders/$ORDER_ID operation (wallet-facing). - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order to check - * @return handle to operation - */ -struct TALER_MERCHANT_GetOrdersHandle * -TALER_MERCHANT_get_orders_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_end_() \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_END \ - } - -/** - * Set long polling timeout. - * - * @param t timeout to use - * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_timeout(t) \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_TIMEOUT, \ - .details.timeout = (t) \ - } - -/** - * Set session ID for repurchase detection. - * - * @param s session ID to use - * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_session_id(s) \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_SESSION_ID, \ - .details.session_id = (s) \ - } - -/** - * Set minimum refund amount to wait for. - * - * @param a minimum refund amount - * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_min_refund(a) \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_MIN_REFUND, \ - .details.min_refund = (a) \ - } - -/** - * Set await refund obtained flag. - * - * @param b true to wait until refund is confirmed obtained - * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_await_refund_obtained(b) \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_AWAIT_REFUND_OBTAINED, \ - .details.await_refund_obtained = (b) \ - } - -/** - * Set hash of the contract terms (for authentication). - * - * @param h hash of contract terms - * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_h_contract(h) \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_H_CONTRACT, \ - .details.h_contract = (h) \ - } - -/** - * Set claim token for unclaimed order authentication. - * - * @param t claim token - * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_token(t) \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_TOKEN, \ - .details.token = (t) \ - } - -/** - * Set whether refunded orders count for repurchase detection. - * - * @param v yes/no/all value - * @return representation of the option as a struct TALER_MERCHANT_GetOrdersOptionValue - */ -#define TALER_MERCHANT_get_orders_option_allow_refunded_for_repurchase(v) \ - (const struct TALER_MERCHANT_GetOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_ORDERS_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE, \ - .details.allow_refunded_for_repurchase = (v) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param oph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_orders_set_options_ ( - struct TALER_MERCHANT_GetOrdersHandle *oph, - unsigned int num_options, - const struct TALER_MERCHANT_GetOrdersOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_orders_set_options ( - * oph, - * TALER_MERCHANT_get_orders_option_timeout ( - * GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)), - * TALER_MERCHANT_get_orders_option_session_id ("mysession")); - * - * @param oph the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_orders_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_orders_set_options(oph,...) \ - TALER_MERCHANT_get_orders_set_options_ ( \ - oph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetOrdersOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_get_orders_option_end_ () } \ - )) - - -/** - * Response details for a GET /orders/$ORDER_ID request (wallet-facing). - */ -struct TALER_MERCHANT_GetOrdersResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK (order is paid, refund info available). - */ - struct - { - - /** - * True if a refund has been granted. - */ - bool refunded; - - /** - * True if a refund is still pending. - */ - bool refund_pending; - - /** - * Total amount refunded. - */ - struct TALER_Amount refund_amount; - - /** - * Total amount of refunds taken by the wallet so far. - */ - struct TALER_Amount refund_taken; - - } ok; - - /** - * Details on #MHD_HTTP_ACCEPTED (order claimed, goto reorder URL). - */ - struct - { - - /** - * URL where the client should go to create a fresh order - * or trigger repurchase detection. - */ - const char *public_reorder_url; - - } accepted; - - /** - * Details on #MHD_HTTP_PAYMENT_REQUIRED (order not yet paid). - */ - struct - { - - /** - * Taler pay URI for this order. - */ - const char *taler_pay_uri; - - /** - * Order ID of a previously paid order that covers this one, - * or NULL if none. - */ - const char *already_paid_order_id; - - /** - * Fulfillment URL of the order, or NULL if not available. - */ - const char *fulfillment_url; - - } payment_required; - - } details; - -}; - - -#ifndef TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetOrdersCallback. - */ -#define TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE */ - -/** - * Callback for a GET /orders/$ORDER_ID request (wallet-facing). - * - * @param cls closure - * @param owgr response details - */ -typedef void -(*TALER_MERCHANT_GetOrdersCallback)( - TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetOrdersResponse *owgr); - - -/** - * Start GET /orders/$ORDER_ID operation (wallet-facing). - * - * @param[in,out] oph operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_orders_start ( - struct TALER_MERCHANT_GetOrdersHandle *oph, - TALER_MERCHANT_GetOrdersCallback cb, - TALER_MERCHANT_GET_ORDERS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /orders/$ORDER_ID operation (wallet-facing). This function - * must not be called by clients after the TALER_MERCHANT_GetOrdersCallback - * has been invoked (as in those cases it'll be called internally by - * the implementation already). - * - * @param[in] oph operation to cancel - */ -void -TALER_MERCHANT_get_orders_cancel ( - struct TALER_MERCHANT_GetOrdersHandle *oph); - - -#endif /* _TALER_MERCHANT__GET_ORDERS_ORDER_ID_H */ diff --git a/src/include/taler/taler-merchant/get-private-accounts-H_WIRE.h b/src/include/taler/taler-merchant/get-private-accounts-H_WIRE.h @@ -1,177 +0,0 @@ -/* - 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/get-private-accounts-H_WIRE.h - * @brief C interface for GET /private/accounts/$H_WIRE of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H -#define _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/accounts/$H_WIRE request. - */ -struct TALER_MERCHANT_GetPrivateAccountHandle; - - -/** - * Account details for a merchant wire account. - */ -struct TALER_MERCHANT_GetPrivateAccountDetails -{ - - /** - * Hash of the wire details. - */ - struct TALER_MerchantWireHashP h_wire; - - /** - * Salt used in the wire hash computation. - */ - struct TALER_WireSaltP salt; - - /** - * Full payto URI of the account. - */ - struct TALER_FullPayto payto_uri; - - /** - * URL of the credit facade, or NULL if none. - */ - const char *credit_facade_url; - - /** - * Extra wire subject metadata, or NULL if not provided. - * Available since protocol v27. - */ - const json_t *extra_wire_subject_metadata; - - /** - * True if the account is currently active. - */ - bool active; - -}; - - -/** - * Response details for a GET /private/accounts/$H_WIRE request. - */ -struct TALER_MERCHANT_GetPrivateAccountResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Detailed account information. - */ - struct TALER_MERCHANT_GetPrivateAccountDetails ad; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/accounts/$H_WIRE operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param instance_id identifier of the merchant instance - * @param h_wire hash of the wire details identifying the account - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateAccountHandle * -TALER_MERCHANT_get_private_account_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id, - const struct TALER_MerchantWireHashP *h_wire); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateAccountCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/accounts/$H_WIRE request. - * - * @param cls closure - * @param agr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateAccountCallback)( - TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateAccountResponse *agr); - - -/** - * Start GET /private/accounts/$H_WIRE operation. - * - * @param[in,out] gpa operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_account_start ( - struct TALER_MERCHANT_GetPrivateAccountHandle *gpa, - TALER_MERCHANT_GetPrivateAccountCallback cb, - TALER_MERCHANT_GET_PRIVATE_ACCOUNT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/accounts/$H_WIRE operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateAccountCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpa operation to cancel - */ -void -TALER_MERCHANT_get_private_account_cancel ( - struct TALER_MERCHANT_GetPrivateAccountHandle *gpa); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H_WIRE_H */ diff --git a/src/include/taler/taler-merchant/get-private-accounts.h b/src/include/taler/taler-merchant/get-private-accounts.h @@ -1,161 +0,0 @@ -/* - 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/get-private-accounts.h - * @brief C interface for the GET /private/accounts endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H -#define _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/accounts request. - */ -struct TALER_MERCHANT_GetPrivateAccountsHandle; - - -/** - * Account details for a merchant wire account. - */ -struct TALER_MERCHANT_GetPrivateAccountsAccountEntry -{ - - /** - * Hash of the wire details. - */ - struct TALER_MerchantWireHashP h_wire; - - /** - * Full payto URI of the account. - */ - struct TALER_FullPayto payto_uri; - - /** - * True if the account is active. - */ - bool active; - -}; - - -/** - * Response details for a GET /private/accounts request. - */ -struct TALER_MERCHANT_GetPrivateAccountsResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of accounts in @a accounts. - */ - unsigned int accounts_length; - - /** - * Array of account entries. - */ - const struct TALER_MERCHANT_GetPrivateAccountsAccountEntry *accounts; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/accounts operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateAccountsHandle * -TALER_MERCHANT_get_private_accounts_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateAccountsCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/accounts request. - * - * @param cls closure - * @param agr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateAccountsCallback)( - TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateAccountsResponse *agr); - - -/** - * Start GET /private/accounts operation. - * - * @param[in,out] gpah operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_accounts_start ( - struct TALER_MERCHANT_GetPrivateAccountsHandle *gpah, - TALER_MERCHANT_GetPrivateAccountsCallback cb, - TALER_MERCHANT_GET_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/accounts operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateAccountsCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpah operation to cancel - */ -void -TALER_MERCHANT_get_private_accounts_cancel ( - struct TALER_MERCHANT_GetPrivateAccountsHandle *gpah); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_ACCOUNTS_H */ diff --git a/src/include/taler/taler-merchant/get-private-donau.h b/src/include/taler/taler-merchant/get-private-donau.h @@ -1,191 +0,0 @@ -/* - 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/get-private-donau.h - * @brief C interface for the GET /private/donau endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_DONAU_H -#define _TALER_MERCHANT__GET_PRIVATE_DONAU_H - -#include <taler/taler-merchant/common.h> -#include <donau/donau_service.h> - - -/** - * Handle for a GET /private/donau request. - */ -struct TALER_MERCHANT_GetPrivateDonauHandle; - - -/** - * Individual Donau instance details. - */ -struct TALER_MERCHANT_GetPrivateDonauDonauInstanceEntry -{ - /** - * Serial number of the Donau instance in merchant database. - */ - uint64_t donau_instance_serial; - - /** - * The URL of the Donau service. - */ - const char *donau_url; - - /** - * Name of the charity associated with the Donau instance. - */ - const char *charity_name; - - /** - * Public key of the charity. - */ - struct DONAU_CharityPublicKeyP charity_pub_key; - - /** - * ID of the charity on Donau. - */ - uint64_t charity_id; - - /** - * Maximum donation amount per year allowed for the charity. - */ - struct TALER_Amount charity_max_per_year; - - /** - * Total donations received by the charity in the current year. - */ - struct TALER_Amount charity_receipts_to_date; - - /** - * The current year being tracked for donations. - */ - int64_t current_year; - - /** - * Additional key information related to the Donau instance. - */ - const struct DONAU_Keys *donau_keys; -}; - - -/** - * Response details for a GET /private/donau request. - */ -struct TALER_MERCHANT_GetPrivateDonauResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of Donau instances in @a donau_instances. - */ - unsigned int donau_instances_length; - - /** - * Array of Donau instance entries. - */ - const struct TALER_MERCHANT_GetPrivateDonauDonauInstanceEntry * - donau_instances; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/donau operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateDonauHandle * -TALER_MERCHANT_get_private_donau_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateDonauCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/donau request. - * - * @param cls closure - * @param dgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateDonauCallback)( - TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateDonauResponse *dgr); - - -/** - * Start GET /private/donau operation. - * - * @param[in,out] gpdh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_donau_start ( - struct TALER_MERCHANT_GetPrivateDonauHandle *gpdh, - TALER_MERCHANT_GetPrivateDonauCallback cb, - TALER_MERCHANT_GET_PRIVATE_DONAU_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/donau operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateDonauCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpdh operation to cancel - */ -void -TALER_MERCHANT_get_private_donau_cancel ( - struct TALER_MERCHANT_GetPrivateDonauHandle *gpdh); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_DONAU_H */ diff --git a/src/include/taler/taler-merchant/get-private-kyc.h b/src/include/taler/taler-merchant/get-private-kyc.h @@ -1,533 +0,0 @@ -/* - 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/get-private-kyc.h - * @brief C interface for the GET /private/kyc (and /management/instances/$INSTANCE/kyc) endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_KYC_H -#define _TALER_MERCHANT__GET_PRIVATE_KYC_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /private/kyc request. - */ -enum TALER_MERCHANT_GetPrivateKycOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_END = 0, - - /** - * Hash of the wire account to check, or NULL for all. - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_H_WIRE, - - /** - * URL of the exchange to check with, or NULL for any. - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_EXCHANGE_URL, - - /** - * Long-poll target (what status to wait for). - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LPT, - - /** - * Long polling timeout. - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_TIMEOUT, - - /** - * Instance ID for management mode (GET /management/instances/$INSTANCE/kyc). - * If not set, uses the private endpoint (GET /private/kyc). - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_INSTANCE_ID, - - /** - * Long-poll status filter: only return when some account reaches - * this status. String value (since v25). - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_STATUS, - - /** - * Long-poll negated status filter: only return when some account - * no longer matches this status. String value (since v25). - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_STATUS, - - /** - * Long-poll ETag to suppress responses that have not changed. - * ShortHashCode value (since v25). - */ - TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_ETAG - -}; - - -/** - * Value for an option for the GET /private/kyc request. - */ -struct TALER_MERCHANT_GetPrivateKycOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateKycOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_H_WIRE. - */ - const struct TALER_MerchantWireHashP *h_wire; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_EXCHANGE_URL. - */ - const char *exchange_url; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LPT. - */ - enum TALER_EXCHANGE_KycLongPollTarget lpt; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_TIMEOUT. - */ - struct GNUNET_TIME_Relative timeout; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_INSTANCE_ID. - * If set, the management endpoint - * /management/instances/$INSTANCE/kyc is used instead of - * /private/kyc. - */ - const char *instance_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_STATUS. - */ - const char *lp_status; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_STATUS. - */ - const char *lp_not_status; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_ETAG. - */ - const struct GNUNET_ShortHashCode *lp_not_etag; - - } details; - -}; - - -/** - * Handle for a GET /private/kyc (or /management/instances/$INSTANCE/kyc) request. - */ -struct TALER_MERCHANT_GetPrivateKycHandle; - - -/** - * Set up GET /private/kyc operation. - * Note that you must explicitly start the operation after - * possibly setting options. By default, uses the /private/kyc - * endpoint; set the INSTANCE_ID option to use the management - * endpoint instead. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateKycHandle * -TALER_MERCHANT_get_private_kyc_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_END \ - } - -/** - * Set hash of the wire account to check. - * - * @param h pointer to the wire hash to filter by - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_h_wire(h) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_H_WIRE, \ - .details.h_wire = (h) \ - } - -/** - * Set exchange URL to check with. - * - * @param u exchange URL to filter by - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_exchange_url(u) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_EXCHANGE_URL, \ - .details.exchange_url = (u) \ - } - -/** - * Set long-poll target. - * - * @param t long-poll target to wait for - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_lpt(t) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LPT, \ - .details.lpt = (t) \ - } - -/** - * Set long polling timeout. - * - * @param t timeout to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_timeout(t) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_TIMEOUT, \ - .details.timeout = (t) \ - } - -/** - * Set instance ID for management mode. When set, the request uses - * the /management/instances/$INSTANCE/kyc endpoint instead of - * /private/kyc. - * - * @param id instance identifier - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_instance_id(id) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_INSTANCE_ID, \ - .details.instance_id = (id) \ - } - -/** - * Set long-poll status filter. - * - * @param s status string to wait for - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_lp_status(s) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_STATUS, \ - .details.lp_status = (s) \ - } - -/** - * Set long-poll negated status filter. - * - * @param s status string to negate - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_lp_not_status(s) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_STATUS, \ - .details.lp_not_status = (s) \ - } - -/** - * Set long-poll ETag to suppress unchanged responses. - * - * @param e pointer to the short hash code ETag - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateKycOptionValue - */ -#define TALER_MERCHANT_get_private_kyc_option_lp_not_etag(e) \ - (const struct TALER_MERCHANT_GetPrivateKycOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_KYC_OPTION_LP_NOT_ETAG, \ - .details.lp_not_etag = (e) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param kyc the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_kyc_set_options_ ( - struct TALER_MERCHANT_GetPrivateKycHandle *kyc, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateKycOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_kyc_set_options ( - * kyc, - * TALER_MERCHANT_get_private_kyc_option_exchange_url ( - * "https://exchange.example.com/"), - * TALER_MERCHANT_get_private_kyc_option_timeout ( - * GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30))); - * - * @param kyc the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_kyc_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_kyc_set_options(kyc,...) \ - TALER_MERCHANT_get_private_kyc_set_options_ ( \ - kyc, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateKycOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_get_private_kyc_option_end_ () } \ - )) - - -/** - * Information about KYC actions the merchant still must perform. - */ -struct TALER_MERCHANT_GetPrivateKycRedirectDetail -{ - - /** - * Access token the user needs to start a KYC process, - * all zero if a KYC auth transfer must be made first. - */ - struct TALER_AccountAccessTokenP access_token; - - /** - * Base URL of the exchange this is about. - */ - const char *exchange_url; - - /** - * Our bank wire account this is about. - */ - struct TALER_FullPayto payto_uri; - - /** - * Array of length @e limits_length with (exposed) limits that apply to the - * account. - */ - const struct TALER_EXCHANGE_AccountLimit *limits; - - /** - * Array of payto://-URIs with instructions for wire - * transfers to perform a KYC auth wire transfer for - * the given account. Needed if @e access_token is zero - * and @e limits are to be passed. - */ - struct TALER_FullPayto *payto_kycauths; - - /** - * Length of the @e limits array. - */ - unsigned int limits_length; - - /** - * Length of the @e payto_kycauths array. - */ - unsigned int pkycauth_length; - - /** - * HTTP status code returned by the exchange when we asked for - * information about the KYC status. - * 0 if there was no response at all. - */ - unsigned int exchange_http_status; - - /** - * Error code indicating errors the exchange - * returned, or #TALER_EC_NONE for none. - */ - enum TALER_ErrorCode exchange_code; - - /** - * Set to true if @e access_token was not given. - */ - bool no_access_token; - - /** - * Hash of the wire account this entry is about. - */ - struct TALER_MerchantWireHashP h_wire; - - /** - * KYC status string, or NULL if not provided. - */ - const char *status; - - /** - * Currency used by the exchange, or NULL if not provided. - */ - const char *exchange_currency; - - /** - * Set to true if the merchant backend could not - * get the exchanges ``/keys`` and thus could not - * determine default limits or determine an - * @e auth_conflict. - */ - bool no_keys; - - /** - * Set to true if the given account cannot do KYC at the given exchange - * because no wire method exists that could be used to do the KYC auth wire - * transfer. - */ - bool auth_conflict; - -}; - - -/** - * Response details for a KYC status request. - */ -struct TALER_MERCHANT_GetPrivateKycResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of KYC redirect details in @a kycs. - */ - unsigned int kycs_length; - - /** - * Array of KYC redirect details for accounts requiring KYC. - */ - const struct TALER_MERCHANT_GetPrivateKycRedirectDetail *kycs; - - } ok; - - } details; - -}; - - -#ifndef TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateKycCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE */ - -/** - * Callback for a KYC status request. - * - * @param cls closure - * @param kr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateKycCallback)( - TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateKycResponse *kr); - - -/** - * Start GET /private/kyc (or /management/instances/$INSTANCE/kyc) operation. - * - * @param[in,out] kyc operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_kyc_start ( - struct TALER_MERCHANT_GetPrivateKycHandle *kyc, - TALER_MERCHANT_GetPrivateKycCallback cb, - TALER_MERCHANT_GET_PRIVATE_KYC_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/kyc operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateKycCallback - * has been invoked (as in those cases it'll be called internally by - * the implementation already). - * - * @param[in] kyc operation to cancel - */ -void -TALER_MERCHANT_get_private_kyc_cancel ( - struct TALER_MERCHANT_GetPrivateKycHandle *kyc); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_KYC_H */ diff --git a/src/include/taler/taler-merchant/get-private-orders-ORDER_ID.h b/src/include/taler/taler-merchant/get-private-orders-ORDER_ID.h @@ -1,569 +0,0 @@ -/* - 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/get-private-orders-ORDER_ID.h - * @brief C interface for the GET /private/orders/$ORDER_ID endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_ORDERS_ORDER_ID_H -#define _TALER_MERCHANT__GET_PRIVATE_ORDERS_ORDER_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /private/orders/$ORDER_ID request. - */ -enum TALER_MERCHANT_GetPrivateOrderOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_END = 0, - - /** - * Session ID for repurchase detection. - */ - TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_SESSION_ID, - - /** - * Long polling timeout. - */ - TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TIMEOUT, - - /** - * If set to true, try to obtain the wire transfer status - * for this order from the exchange. - * @deprecated since protocol v6. - */ - TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TRANSFER, - - /** - * Long-poll ETag to suppress responses that have not changed. - * ShortHashCode value. - * @since protocol v25. - */ - TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_LP_NOT_ETAG, - - /** - * If true, refunded orders may be returned under - * "already_paid_order_id". - * @since protocol v9. - */ - TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE - -}; - - -/** - * Value for an option for the GET /private/orders/$ORDER_ID request. - */ -struct TALER_MERCHANT_GetPrivateOrderOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateOrderOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_SESSION_ID. - */ - const char *session_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TIMEOUT. - */ - struct GNUNET_TIME_Relative timeout; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TRANSFER. - */ - bool transfer; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_LP_NOT_ETAG. - */ - const struct GNUNET_ShortHashCode *lp_not_etag; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE. - */ - bool allow_refunded_for_repurchase; - - } details; - -}; - - -/** - * Handle for a GET /private/orders/$ORDER_ID request. - */ -struct TALER_MERCHANT_GetPrivateOrderHandle; - - -/** - * Set up GET /private/orders/$ORDER_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateOrderHandle * -TALER_MERCHANT_get_private_order_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateOrderOptionValue - */ -#define TALER_MERCHANT_get_private_order_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_END \ - } - -/** - * Set session ID for repurchase detection. - * - * @param s session ID to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue - */ -#define TALER_MERCHANT_get_private_order_option_session_id(s) \ - (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_SESSION_ID, \ - .details.session_id = (s) \ - } - -/** - * Set long polling timeout. - * - * @param t timeout to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue - */ -#define TALER_MERCHANT_get_private_order_option_timeout(t) \ - (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TIMEOUT, \ - .details.timeout = (t) \ - } - -/** - * Set transfer flag (try to obtain wire transfer status from exchange). - * @deprecated since protocol v6. - * - * @param b true to request wire transfer status - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue - */ -#define TALER_MERCHANT_get_private_order_option_transfer(b) \ - (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_TRANSFER, \ - .details.transfer = (b) \ - } - -/** - * Set long-poll ETag to suppress unchanged responses. - * - * @param e pointer to the short hash code ETag - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue - */ -#define TALER_MERCHANT_get_private_order_option_lp_not_etag(e) \ - (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_LP_NOT_ETAG, \ - .details.lp_not_etag = (e) \ - } - -/** - * Set allow-refunded-for-repurchase flag. - * - * @param b true to allow refunded orders under already_paid_order_id - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrderOptionValue - */ -#define TALER_MERCHANT_get_private_order_option_allow_refunded_for_repurchase(b) \ - (const struct TALER_MERCHANT_GetPrivateOrderOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDER_OPTION_ALLOW_REFUNDED_FOR_REPURCHASE, \ - .details.allow_refunded_for_repurchase = (b) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param oph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_order_set_options_ ( - struct TALER_MERCHANT_GetPrivateOrderHandle *oph, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateOrderOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_order_set_options ( - * oph, - * TALER_MERCHANT_get_private_order_option_session_id ("mysession")); - * - * @param oph the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_order_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_order_set_options(oph,...) \ - TALER_MERCHANT_get_private_order_set_options_ ( \ - oph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateOrderOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_get_private_order_option_end_ () } \ - )) - - -/** - * Order status code. - */ -enum TALER_MERCHANT_OrderStatusCode -{ - /** - * The order is unpaid. - */ - TALER_MERCHANT_OSC_UNPAID = 0, - - /** - * The order has been claimed by a wallet. - */ - TALER_MERCHANT_OSC_CLAIMED = 1, - - /** - * The order has been paid. - */ - TALER_MERCHANT_OSC_PAID = 2 -}; - - -/** - * Refund detail in a paid order (merchant view). - */ -struct TALER_MERCHANT_GetPrivateOrderRefundDetail -{ - - /** - * Human-readable reason given for the refund. - */ - const char *reason; - - /** - * Time when the refund was granted. - */ - struct GNUNET_TIME_Timestamp refund_time; - - /** - * Total amount that was refunded. - */ - struct TALER_Amount refund_amount; - - /** - * True if a refund is still available for the wallet - * for this payment. - */ - bool pending; - -}; - - -/** - * Response details for a GET /private/orders/$ORDER_ID request. - */ -struct TALER_MERCHANT_GetPrivateOrderResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Current status of the order. - */ - enum TALER_MERCHANT_OrderStatusCode status; - - /** - * Details depending on @a status. - */ - union - { - - /** - * Details when @a status is #TALER_MERCHANT_OSC_UNPAID. - */ - struct - { - - /** - * Order ID of a previously paid order that covers this one, - * or NULL if none. - */ - const char *already_paid_order_id; - - /** - * Fulfillment URL of an already paid order, or NULL. - */ - const char *already_paid_fulfillment_url; - - /** - * Taler pay URI for this order. - */ - const char *taler_pay_uri; - - /** - * Short summary of the order. - */ - const char *summary; - - /** - * Proto contract terms (contract terms without nonce). - * @since protocol v25. - */ - const json_t *proto_contract_terms; - - /** - * Status URL for the order. - */ - const char *order_status_url; - - /** - * Timestamp when the order was created. - */ - struct GNUNET_TIME_Timestamp creation_time; - - /** - * Deadline when the offer expires. - * @since protocol v21. - */ - struct GNUNET_TIME_Timestamp pay_deadline; - - } unpaid; - - /** - * Details when @a status is #TALER_MERCHANT_OSC_CLAIMED. - */ - struct - { - - /** - * Contract terms (JSON). - */ - const json_t *contract_terms; - - /** - * Status URL for the order. - * @since protocol v19. - */ - const char *order_status_url; - - } claimed; - - /** - * Details when @a status is #TALER_MERCHANT_OSC_PAID. - */ - struct - { - - /** - * True if a refund has been granted. - */ - bool refunded; - - /** - * True if a refund is still pending at the exchange. - */ - bool refund_pending; - - /** - * True if the payment has been wired to the merchant. - */ - bool wired; - - /** - * Total amount deposited. - */ - struct TALER_Amount deposit_total; - - /** - * Error code from the exchange, or TALER_EC_NONE. - */ - enum TALER_ErrorCode exchange_ec; - - /** - * HTTP status returned by the exchange. - */ - unsigned int exchange_hc; - - /** - * Total amount refunded. - */ - struct TALER_Amount refund_amount; - - /** - * Contract terms (JSON). - */ - const json_t *contract_terms; - - /** - * Number of wire transfers in @a wts. - */ - unsigned int wts_len; - - /** - * Array of wire transfer details. - */ - struct TALER_MERCHANT_WireTransfer *wts; - - /** - * Number of refund details in @a refunds. - */ - unsigned int refunds_len; - - /** - * Array of per-coin refund details. - */ - struct TALER_MERCHANT_GetPrivateOrderRefundDetail *refunds; - - /** - * Timestamp of the last payment. - */ - struct GNUNET_TIME_Timestamp last_payment; - - /** - * Status URL for the order. - */ - const char *order_status_url; - - /** - * Index of the selected choice within the choices array - * of contract terms, or -1 if not set. - * @since protocol v21. - */ - int choice_index; - - } paid; - - } details; - - } ok; - - } details; - -}; - - -#ifndef TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateOrderCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/orders/$ORDER_ID request. - * - * @param cls closure - * @param osr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateOrderCallback)( - TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateOrderResponse *osr); - - -/** - * Start GET /private/orders/$ORDER_ID operation. - * - * @param[in,out] oph operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_order_start ( - struct TALER_MERCHANT_GetPrivateOrderHandle *oph, - TALER_MERCHANT_GetPrivateOrderCallback cb, - TALER_MERCHANT_GET_PRIVATE_ORDER_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/orders/$ORDER_ID operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateOrderCallback - * has been invoked (as in those cases it'll be called internally by - * the implementation already). - * - * @param[in] oph operation to cancel - */ -void -TALER_MERCHANT_get_private_order_cancel ( - struct TALER_MERCHANT_GetPrivateOrderHandle *oph); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_ORDERS_ORDER_ID_H */ diff --git a/src/include/taler/taler-merchant/get-private-orders.h b/src/include/taler/taler-merchant/get-private-orders.h @@ -1,556 +0,0 @@ -/* - 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/get-private-orders.h - * @brief C interface for the GET /private/orders endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_ORDERS_H -#define _TALER_MERCHANT__GET_PRIVATE_ORDERS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /private/orders request. - */ -enum TALER_MERCHANT_GetPrivateOrdersOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_END = 0, - - /** - * Filter by paid status. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_PAID, - - /** - * Filter by refunded status. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_REFUNDED, - - /** - * Filter by wired status. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_WIRED, - - /** - * Return at most N values. Negative values - * to return before offset, positive to return after offset. - * Default is -20. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_LIMIT, - - /** - * Starting row_id for pagination. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_OFFSET, - - /** - * Date threshold for filtering. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_DATE, - - /** - * Long polling timeout. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_TIMEOUT, - - /** - * Filter by session ID. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SESSION_ID, - - /** - * Filter by fulfillment URL. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_FULFILLMENT_URL, - - /** - * Filter by summary text (case-insensitive substring match). - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SUMMARY_FILTER, - - /** - * Only return orders younger than the specified age. - * Only applicable if limit is positive. - * @since protocol v27. - */ - TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_MAX_AGE - -}; - - -/** - * Value for an option for the GET /private/orders request. - */ -struct TALER_MERCHANT_GetPrivateOrdersOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateOrdersOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_PAID. - */ - enum TALER_EXCHANGE_YesNoAll paid; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_REFUNDED. - */ - enum TALER_EXCHANGE_YesNoAll refunded; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_WIRED. - */ - enum TALER_EXCHANGE_YesNoAll wired; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_LIMIT. - */ - int64_t limit; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_OFFSET. - */ - uint64_t offset; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_DATE. - */ - struct GNUNET_TIME_Timestamp date; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_TIMEOUT. - */ - struct GNUNET_TIME_Relative timeout; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SESSION_ID. - */ - const char *session_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_FULFILLMENT_URL. - */ - const char *fulfillment_url; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SUMMARY_FILTER. - */ - const char *summary_filter; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_MAX_AGE. - */ - struct GNUNET_TIME_Relative max_age; - - } details; - -}; - - -/** - * Handle for a GET /private/orders request. - */ -struct TALER_MERCHANT_GetPrivateOrdersHandle; - - -/** - * Set up GET /private/orders operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateOrdersHandle * -TALER_MERCHANT_get_private_orders_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_END \ - } - -/** - * Set filter on paid status. - * - * @param p paid filter to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_paid(p) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_PAID, \ - .details.paid = (p) \ - } - -/** - * Set filter on refunded status. - * - * @param r refunded filter to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_refunded(r) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_REFUNDED, \ - .details.refunded = (r) \ - } - -/** - * Set filter on wired status. - * - * @param w wired filter to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_wired(w) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_WIRED, \ - .details.wired = (w) \ - } - -/** - * Set limit on the number of results to return. - * - * @param l limit on the number of results to return - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_limit(l) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_LIMIT, \ - .details.limit = (l) \ - } - -/** - * Set row offset from which to return results. - * - * @param o offset to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_offset(o) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_OFFSET, \ - .details.offset = (o) \ - } - -/** - * Set date threshold for filtering. - * - * @param d date threshold to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_date(d) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_DATE, \ - .details.date = (d) \ - } - -/** - * Set long polling timeout. - * - * @param t timeout to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_timeout(t) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_TIMEOUT, \ - .details.timeout = (t) \ - } - -/** - * Set session ID filter. - * - * @param s session ID to filter by - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_session_id(s) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SESSION_ID, \ - .details.session_id = (s) \ - } - -/** - * Set fulfillment URL filter. - * - * @param u fulfillment URL to filter by - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_fulfillment_url(u) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_FULFILLMENT_URL, \ - .details.fulfillment_url = (u) \ - } - -/** - * Set summary text filter. - * - * @param f summary filter string (case-insensitive substring match) - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_summary_filter(f) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_SUMMARY_FILTER, \ - .details.summary_filter = (f) \ - } - -/** - * Set maximum age filter. Only return orders younger than the - * specified age. Only applicable if limit is positive. - * @since protocol v27. - * - * @param a maximum age as a relative time - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOrdersOptionValue - */ -#define TALER_MERCHANT_get_private_orders_option_max_age(a) \ - (const struct TALER_MERCHANT_GetPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_ORDERS_OPTION_MAX_AGE, \ - .details.max_age = (a) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param oph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_orders_set_options_ ( - struct TALER_MERCHANT_GetPrivateOrdersHandle *oph, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateOrdersOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_orders_set_options ( - * oph, - * TALER_MERCHANT_get_private_orders_option_paid ( - * TALER_EXCHANGE_YNA_YES), - * TALER_MERCHANT_get_private_orders_option_limit (-20)); - * - * @param oph the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_orders_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_orders_set_options(oph,...) \ - TALER_MERCHANT_get_private_orders_set_options_ ( \ - oph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateOrdersOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_get_private_orders_option_end_ () } \ - )) - - -/** - * Entry for one order in the GET /private/orders response. - */ -struct TALER_MERCHANT_GetPrivateOrdersOrderEntry -{ - - /** - * The order identifier string. - */ - const char *order_id; - - /** - * Timestamp when the order was created. - */ - struct GNUNET_TIME_Timestamp timestamp; - - /** - * Serial number of the order in the database. - */ - uint64_t order_serial; - - /** - * Total amount of the order. - */ - struct TALER_Amount amount; - - /** - * Amount refunded so far. - */ - struct TALER_Amount refund_amount; - - /** - * Amount still pending refund. - */ - struct TALER_Amount pending_refund_amount; - - /** - * Short summary of the order. - */ - const char *summary; - - /** - * True if refund is possible. - */ - bool refundable; - - /** - * True if the order has been paid. - */ - bool paid; - -}; - - -/** - * Response details for a GET /private/orders request. - */ -struct TALER_MERCHANT_GetPrivateOrdersResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of orders in @a orders. - */ - unsigned int orders_length; - - /** - * Array of order entries. - */ - const struct TALER_MERCHANT_GetPrivateOrdersOrderEntry *orders; - - } ok; - - } details; - -}; - - -#ifndef TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateOrdersCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/orders request. - * - * @param cls closure - * @param ogr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateOrdersCallback)( - TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateOrdersResponse *ogr); - - -/** - * Start GET /private/orders operation. - * - * @param[in,out] oph operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_orders_start ( - struct TALER_MERCHANT_GetPrivateOrdersHandle *oph, - TALER_MERCHANT_GetPrivateOrdersCallback cb, - TALER_MERCHANT_GET_PRIVATE_ORDERS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/orders operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateOrdersCallback - * has been invoked (as in those cases it'll be called internally by - * the implementation already). - * - * @param[in] oph operation to cancel - */ -void -TALER_MERCHANT_get_private_orders_cancel ( - struct TALER_MERCHANT_GetPrivateOrdersHandle *oph); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_ORDERS_H */ diff --git a/src/include/taler/taler-merchant/get-private-otp-devices-DEVICE_ID.h b/src/include/taler/taler-merchant/get-private-otp-devices-DEVICE_ID.h @@ -1,304 +0,0 @@ -/* - 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/get-private-otp-devices-DEVICE_ID.h - * @brief C interface for GET /private/otp-devices/$DEVICE_ID of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_DEVICE_ID_H -#define _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_DEVICE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/otp-devices/$DEVICE_ID request. - */ -struct TALER_MERCHANT_GetPrivateOtpDeviceHandle; - - -/** - * Response details for a GET /private/otp-devices/$DEVICE_ID request. - */ -struct TALER_MERCHANT_GetPrivateOtpDeviceResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Human-readable description of the OTP device. - */ - const char *otp_device_description; - - /** - * Current counter value of the OTP device (for HOTP). - */ - uint64_t otp_ctr; - - /** - * Current timestamp in seconds (for TOTP). - */ - uint64_t otp_timestamp_s; - - /** - * POS confirmation text with OTP codes that - * would be returned for a purchase over the - * amount given in the query for the respective - * time and algorithm. NULL if the confirmation - * could not be computed based on the query and - * OTP algorithm. - */ - const char *otp_code; - - /** - * OTP algorithm used. - */ - enum TALER_MerchantConfirmationAlgorithm otp_alg; - - } ok; - - } details; - -}; - - -/** - * Possible options we can set for the GET /private/otp-devices/$DEVICE_ID request. - */ -enum TALER_MERCHANT_GetPrivateOtpDeviceOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_END = 0, - - /** - * Set a fake time for OTP code computation. - */ - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_FAKETIME, - - /** - * Set a price amount for OTP code computation. - */ - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_PRICE - -}; - - -/** - * Value for an option for the GET /private/otp-devices/$DEVICE_ID request. - */ -struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateOtpDeviceOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_FAKETIME. - */ - struct GNUNET_TIME_Timestamp faketime; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_PRICE. - */ - struct TALER_Amount price; - - } details; - -}; - - -/** - * Set up GET /private/otp-devices/$DEVICE_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param otp_device_id identifier of the OTP device to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateOtpDeviceHandle * -TALER_MERCHANT_get_private_otp_device_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *otp_device_id); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue - */ -#define TALER_MERCHANT_get_private_otp_device_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_END \ - } - -/** - * Set a fake time for OTP code computation. - * - * @param t the timestamp to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue - */ -#define TALER_MERCHANT_get_private_otp_device_option_faketime(t) \ - (const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_FAKETIME, \ - .details.faketime = (t) \ - } - -/** - * Set a price amount for OTP code computation. - * - * @param a the amount to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue - */ -#define TALER_MERCHANT_get_private_otp_device_option_price(a) \ - (const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_OPTION_PRICE, \ - .details.price = (a) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param god the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_otp_device_set_options_ ( - struct TALER_MERCHANT_GetPrivateOtpDeviceHandle *god, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_otp_device_set_options ( - * god, - * TALER_MERCHANT_get_private_otp_device_option_faketime (ts), - * TALER_MERCHANT_get_private_otp_device_option_price (amount)); - * - * @param god the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_otp_device_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_otp_device_set_options(god,...) \ - TALER_MERCHANT_get_private_otp_device_set_options_ ( \ - god, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateOtpDeviceOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_get_private_otp_device_option_end_ () } \ - )) - - -#ifndef TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateOtpDeviceCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/otp-devices/$DEVICE_ID request. - * - * @param cls closure - * @param ogr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateOtpDeviceCallback)( - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateOtpDeviceResponse *ogr); - - -/** - * Start GET /private/otp-devices/$DEVICE_ID operation. - * - * @param[in,out] god operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_otp_device_start ( - struct TALER_MERCHANT_GetPrivateOtpDeviceHandle *god, - TALER_MERCHANT_GetPrivateOtpDeviceCallback cb, - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/otp-devices/$DEVICE_ID operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateOtpDeviceCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] god operation to cancel - */ -void -TALER_MERCHANT_get_private_otp_device_cancel ( - struct TALER_MERCHANT_GetPrivateOtpDeviceHandle *god); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_DEVICE_ID_H */ diff --git a/src/include/taler/taler-merchant/get-private-otp-devices.h b/src/include/taler/taler-merchant/get-private-otp-devices.h @@ -1,157 +0,0 @@ -/* - 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/get-private-otp-devices.h - * @brief C interface for the GET /private/otp-devices endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_H -#define _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/otp-devices request. - */ -struct TALER_MERCHANT_GetPrivateOtpDevicesHandle; - - -/** - * Entry for one OTP device. - */ -struct TALER_MERCHANT_GetPrivateOtpDevicesOtpDeviceEntry -{ - - /** - * Identifier of the OTP device. - */ - const char *otp_device_id; - - /** - * Human-readable description of the OTP device. - */ - const char *otp_device_description; - -}; - - -/** - * Response details for a GET /private/otp-devices request. - */ -struct TALER_MERCHANT_GetPrivateOtpDevicesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of OTP devices in @a otp_devices. - */ - unsigned int otp_devices_length; - - /** - * Array of OTP device entries. - */ - const struct TALER_MERCHANT_GetPrivateOtpDevicesOtpDeviceEntry * - otp_devices; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/otp-devices operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateOtpDevicesHandle * -TALER_MERCHANT_get_private_otp_devices_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateOtpDevicesCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/otp-devices request. - * - * @param cls closure - * @param ogr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateOtpDevicesCallback)( - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateOtpDevicesResponse *ogr); - - -/** - * Start GET /private/otp-devices operation. - * - * @param[in,out] gpoh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_otp_devices_start ( - struct TALER_MERCHANT_GetPrivateOtpDevicesHandle *gpoh, - TALER_MERCHANT_GetPrivateOtpDevicesCallback cb, - TALER_MERCHANT_GET_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/otp-devices operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateOtpDevicesCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpoh operation to cancel - */ -void -TALER_MERCHANT_get_private_otp_devices_cancel ( - struct TALER_MERCHANT_GetPrivateOtpDevicesHandle *gpoh); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_OTP_DEVICES_H */ diff --git a/src/include/taler/taler-merchant/get-private-products-PRODUCT_ID.h b/src/include/taler/taler-merchant/get-private-products-PRODUCT_ID.h @@ -1,246 +0,0 @@ -/* - 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/get-private-products-PRODUCT_ID.h - * @brief C interface for GET /private/products/$PRODUCT_ID of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_PRODUCT_ID_H -#define _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_PRODUCT_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/products/$PRODUCT_ID request. - */ -struct TALER_MERCHANT_GetPrivateProductHandle; - - -/** - * Response details for a GET /private/products/$PRODUCT_ID request. - */ -struct TALER_MERCHANT_GetPrivateProductResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Human-readable product name. - */ - const char *product_name; - - /** - * Human-readable product description. - */ - const char *description; - - /** - * Internationalized descriptions (JSON object), or NULL. - */ - const json_t *description_i18n; - - /** - * Unit of measurement for this product. - */ - const char *unit; - - /** - * Number of prices in @a unit_price. - */ - size_t unit_price_len; - - /** - * Array of unit prices (for different payment options). - */ - const struct TALER_Amount *unit_price; - - /** - * Single unit price (first element of @a unit_price, for backwards compatibility). - */ - struct TALER_Amount price; - - /** - * Base64-encoded product image, or empty string. - */ - const char *image; - - /** - * Tax information (JSON array), or NULL. - */ - const json_t *taxes; - - /** - * Total available stock (-1 for unlimited). - */ - int64_t total_stock; - - /** - * Total stock in fractional unit representation. - * Stock level encoded as a decimal string. Preferred source of truth for fractional stock. - */ - const char *unit_total_stock; - - /** - * Whether fractional quantities are allowed. - */ - bool unit_allow_fraction; - - /** - * Precision level for fractional quantities. - */ - uint32_t unit_precision_level; - - /** - * Total number of units sold. - */ - uint64_t total_sold; - - /** - * Total number of units lost/expired. - */ - uint64_t total_lost; - - /** - * Storage location (JSON), or NULL. - */ - const json_t *location; - - /** - * Expected time of next restock (may be zero if unknown). - */ - struct GNUNET_TIME_Timestamp next_restock; - - /** - * Number of categories in @a categories. - */ - unsigned int categories_len; - - /** - * Array of category IDs this product belongs to. - */ - const uint64_t *categories; - - /** - * Product group ID (0 if not set). - */ - uint64_t product_group_id; - - /** - * Money pot ID (0 if not set). - */ - uint64_t money_pot_id; - - /** - * Whether the price is net (excluding taxes). - */ - bool price_is_net; - - /** - * Minimum age required to purchase this product (0 if not set). - */ - uint16_t minimum_age; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/products/$PRODUCT_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param product_id identifier of the product to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateProductHandle * -TALER_MERCHANT_get_private_product_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *product_id); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateProductCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/products/$PRODUCT_ID request. - * - * @param cls closure - * @param pgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateProductCallback)( - TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateProductResponse *pgr); - - -/** - * Start GET /private/products/$PRODUCT_ID operation. - * - * @param[in,out] gpp operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_product_start ( - struct TALER_MERCHANT_GetPrivateProductHandle *gpp, - TALER_MERCHANT_GetPrivateProductCallback cb, - TALER_MERCHANT_GET_PRIVATE_PRODUCT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/products/$PRODUCT_ID operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateProductCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpp operation to cancel - */ -void -TALER_MERCHANT_get_private_product_cancel ( - struct TALER_MERCHANT_GetPrivateProductHandle *gpp); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_PRODUCT_ID_H */ diff --git a/src/include/taler/taler-merchant/get-private-products.h b/src/include/taler/taler-merchant/get-private-products.h @@ -1,401 +0,0 @@ -/* - 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/get-private-products.h - * @brief C interface for the GET /private/products endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_H -#define _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /private/products request. - */ -enum TALER_MERCHANT_GetPrivateProductsOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_END = 0, - - /** - * Return at most N values. Negative for descending by row ID, - * positive for ascending by row ID. Default is 20. - * @since protocol v12. - */ - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_LIMIT, - - /** - * Starting product_serial_id for pagination. - * @since protocol v12. - */ - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_OFFSET, - - /** - * Filter by category name (case-insensitive substring match). - * @since protocol v23. - */ - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_CATEGORY_FILTER, - - /** - * Filter by product name (case-insensitive substring match). - * @since protocol v23. - */ - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_NAME_FILTER, - - /** - * Filter by product description (case-insensitive substring match). - * @since protocol v23. - */ - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_FILTER, - - /** - * Filter by product group serial. - * @since protocol v25. - */ - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_SERIAL - -}; - - -/** - * Value for an option for the GET /private/products request. - */ -struct TALER_MERCHANT_GetPrivateProductsOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateProductsOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_LIMIT. - */ - int64_t limit; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_OFFSET. - */ - uint64_t offset; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_CATEGORY_FILTER. - */ - const char *category_filter; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_NAME_FILTER. - */ - const char *name_filter; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_FILTER. - */ - const char *description_filter; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_SERIAL. - */ - uint64_t product_group_serial; - - } details; - -}; - - -/** - * Handle for a GET /private/products request. - */ -struct TALER_MERCHANT_GetPrivateProductsHandle; - - -/** - * Inventory entry for the GET /private/products response. - */ -struct TALER_MERCHANT_GetPrivateProductsInventoryEntry -{ - - /** - * Identifier of the product. - */ - const char *product_id; - - /** - * Serial ID of the product. - */ - uint64_t product_serial; - -}; - - -/** - * Response details for a GET /private/products request. - */ -struct TALER_MERCHANT_GetPrivateProductsResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of products in @a products. - */ - unsigned int products_length; - - /** - * Array of product entries. - */ - const struct TALER_MERCHANT_GetPrivateProductsInventoryEntry *products; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/products operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateProductsHandle * -TALER_MERCHANT_get_private_products_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateProductsOptionValue - */ -#define TALER_MERCHANT_get_private_products_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_END \ - } - -/** - * Set limit on the number of results to return. - * - * @param l limit on the number of results to return - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue - */ -#define TALER_MERCHANT_get_private_products_option_limit(l) \ - (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_LIMIT, \ - .details.limit = (l) \ - } - -/** - * Set row offset from which to return results. - * - * @param o offset to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue - */ -#define TALER_MERCHANT_get_private_products_option_offset(o) \ - (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_OFFSET, \ - .details.offset = (o) \ - } - -/** - * Set category name filter (case-insensitive substring match). - * - * @param f category filter string - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue - */ -#define TALER_MERCHANT_get_private_products_option_category_filter(f) \ - (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_CATEGORY_FILTER, \ - .details.category_filter = (f) \ - } - -/** - * Set product name filter (case-insensitive substring match). - * - * @param f name filter string - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue - */ -#define TALER_MERCHANT_get_private_products_option_name_filter(f) \ - (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_NAME_FILTER, \ - .details.name_filter = (f) \ - } - -/** - * Set product description filter (case-insensitive substring match). - * - * @param f description filter string - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue - */ -#define TALER_MERCHANT_get_private_products_option_description_filter(f) \ - (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_FILTER, \ - .details.description_filter = (f) \ - } - -/** - * Set product group serial filter. - * - * @param s product group serial to filter by - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateProductsOptionValue - */ -#define TALER_MERCHANT_get_private_products_option_product_group_serial(s) \ - (const struct TALER_MERCHANT_GetPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_SERIAL, \ - .details.product_group_serial = (s) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param gpph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_products_set_options_ ( - struct TALER_MERCHANT_GetPrivateProductsHandle *gpph, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateProductsOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_products_set_options ( - * gpph, - * TALER_MERCHANT_get_private_products_option_limit (20), - * TALER_MERCHANT_get_private_products_option_name_filter ("widget")); - * - * @param gpph the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_products_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_products_set_options(gpph,...) \ - TALER_MERCHANT_get_private_products_set_options_ ( \ - gpph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateProductsOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_get_private_products_option_end_ () } \ - )) - - -#ifndef TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateProductsCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/products request. - * - * @param cls closure - * @param pgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateProductsCallback)( - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateProductsResponse *pgr); - - -/** - * Start GET /private/products operation. - * - * @param[in,out] gpph operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_products_start ( - struct TALER_MERCHANT_GetPrivateProductsHandle *gpph, - TALER_MERCHANT_GetPrivateProductsCallback cb, - TALER_MERCHANT_GET_PRIVATE_PRODUCTS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/products operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateProductsCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpph operation to cancel - */ -void -TALER_MERCHANT_get_private_products_cancel ( - struct TALER_MERCHANT_GetPrivateProductsHandle *gpph); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_PRODUCTS_H */ diff --git a/src/include/taler/taler-merchant/get-private-statistics-amount-SLUG.h b/src/include/taler/taler-merchant/get-private-statistics-amount-SLUG.h @@ -1,342 +0,0 @@ -/* - 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/get-private-statistics-amount-SLUG.h - * @brief C interface for the GET /private/statistics-amount/$SLUG endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_STATISTICS_AMOUNT_SLUG_H -#define _TALER_MERCHANT__GET_PRIVATE_STATISTICS_AMOUNT_SLUG_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /private/statistics-amount/$SLUG request. - */ -enum TALER_MERCHANT_GetPrivateStatisticsAmountOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_END = 0, - - /** - * Aggregation mode to request (BUCKET, INTERVAL, or ANY). - */ - TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_TYPE - -}; - - -/** - * Value for an option for the GET /private/statistics-amount/$SLUG request. - */ -struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateStatisticsAmountOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_TYPE. - */ - enum TALER_MERCHANT_StatisticsType type; - - } details; - -}; - - -/** - * Handle for a GET /private/statistics-amount/$SLUG request. - */ -struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle; - - -/** - * Set up GET /private/statistics-amount/$SLUG operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param slug statistics slug to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle * -TALER_MERCHANT_get_private_statistics_amount_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *slug); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue - */ -#define TALER_MERCHANT_get_private_statistics_amount_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_END \ - } - -/** - * Set aggregation mode type. - * - * @param t aggregation mode to request - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue - */ -#define TALER_MERCHANT_get_private_statistics_amount_option_type(t) \ - (const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_OPTION_TYPE, \ - .details.type = (t) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param sah the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_statistics_amount_set_options_ ( - struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle *sah, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_statistics_amount_set_options ( - * sah, - * TALER_MERCHANT_get_private_statistics_amount_option_type ( - * TALER_MERCHANT_STATISTICS_TYPE_BUCKET)); - * - * @param sah the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_statistics_amount_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_statistics_amount_set_options(sah,...) \ - TALER_MERCHANT_get_private_statistics_amount_set_options_ ( \ - sah, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateStatisticsAmountOptionValue[]) \ - {__VA_ARGS__, \ - TALER_MERCHANT_get_private_statistics_amount_option_end_ () } \ - )) - - -/** - * Statistic amount aggregated by bucket. - */ -struct TALER_MERCHANT_GetPrivateStatisticsAmountByBucket -{ - - /** - * Start time of the bucket (inclusive). - */ - struct GNUNET_TIME_Timestamp start_time; - - /** - * End time of the bucket (exclusive). - */ - struct GNUNET_TIME_Timestamp end_time; - - /** - * Range of the bucket. - */ - const char *range; - - /** - * Sum of all amounts falling under the given - * SLUG within this timeframe. - */ - struct TALER_Amount *cumulative_amounts; - - /** - * Length of array @a cumulative_amounts. - */ - unsigned int cumulative_amount_len; - -}; - - -/** - * Statistic amount aggregated by interval. - */ -struct TALER_MERCHANT_GetPrivateStatisticsAmountByInterval -{ - - /** - * Start time of the interval (inclusive). - * The interval always ends at the response - * generation time. - */ - struct GNUNET_TIME_Timestamp start_time; - - /** - * Sum of all amounts falling under the given - * SLUG within this timeframe. - */ - struct TALER_Amount *cumulative_amounts; - - /** - * Length of array @a cumulative_amounts. - */ - unsigned int cumulative_amount_len; - -}; - - -/** - * Response details for a GET /private/statistics-amount/$SLUG request. - */ -struct TALER_MERCHANT_GetPrivateStatisticsAmountResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of bucket entries in @a buckets. - */ - unsigned int buckets_length; - - /** - * Array of amount statistics per bucket. - */ - const struct TALER_MERCHANT_GetPrivateStatisticsAmountByBucket *buckets; - - /** - * Description of the bucket aggregation scheme, or NULL. - */ - const char *buckets_description; - - /** - * Number of interval entries in @a intervals. - */ - unsigned int intervals_length; - - /** - * Array of amount statistics per time interval. - */ - const struct TALER_MERCHANT_GetPrivateStatisticsAmountByInterval * - intervals; - - /** - * Description of the interval aggregation scheme, or NULL. - */ - const char *intervals_description; - - } ok; - - } details; - -}; - - -#ifndef TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateStatisticsAmountCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/statistics-amount/$SLUG request. - * - * @param cls closure - * @param sagr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateStatisticsAmountCallback)( - TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateStatisticsAmountResponse *sagr); - - -/** - * Start GET /private/statistics-amount/$SLUG operation. - * - * @param[in,out] sah operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_statistics_amount_start ( - struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle *sah, - TALER_MERCHANT_GetPrivateStatisticsAmountCallback cb, - TALER_MERCHANT_GET_PRIVATE_STATISTICS_AMOUNT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/statistics-amount/$SLUG operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateStatisticsAmountCallback has been invoked - * (as in those cases it'll be called internally by the implementation - * already). - * - * @param[in] sah operation to cancel - */ -void -TALER_MERCHANT_get_private_statistics_amount_cancel ( - struct TALER_MERCHANT_GetPrivateStatisticsAmountHandle *sah); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_STATISTICS_AMOUNT_SLUG_H */ diff --git a/src/include/taler/taler-merchant/get-private-statistics-counter-SLUG.h b/src/include/taler/taler-merchant/get-private-statistics-counter-SLUG.h @@ -1,333 +0,0 @@ -/* - 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/get-private-statistics-counter-SLUG.h - * @brief C interface for the GET /private/statistics-counter/$SLUG endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_STATISTICS_COUNTER_SLUG_H -#define _TALER_MERCHANT__GET_PRIVATE_STATISTICS_COUNTER_SLUG_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /private/statistics-counter/$SLUG request. - */ -enum TALER_MERCHANT_GetPrivateStatisticsCounterOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_END = 0, - - /** - * Aggregation mode to request (BUCKET, INTERVAL, or ANY). - */ - TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_TYPE - -}; - - -/** - * Value for an option for the GET /private/statistics-counter/$SLUG request. - */ -struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateStatisticsCounterOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_TYPE. - */ - enum TALER_MERCHANT_StatisticsType type; - - } details; - -}; - - -/** - * Handle for a GET /private/statistics-counter/$SLUG request. - */ -struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle; - - -/** - * Set up GET /private/statistics-counter/$SLUG operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param slug statistics slug to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle * -TALER_MERCHANT_get_private_statistics_counter_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *slug); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue - */ -#define TALER_MERCHANT_get_private_statistics_counter_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_END \ - } - -/** - * Set aggregation mode type. - * - * @param t aggregation mode to request - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue - */ -#define TALER_MERCHANT_get_private_statistics_counter_option_type(t) \ - (const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_OPTION_TYPE, \ - .details.type = (t) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param sch the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_statistics_counter_set_options_ ( - struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle *sch, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_statistics_counter_set_options ( - * sch, - * TALER_MERCHANT_get_private_statistics_counter_option_type ( - * TALER_MERCHANT_STATISTICS_TYPE_INTERVAL)); - * - * @param sch the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_statistics_counter_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_statistics_counter_set_options(sch,...) \ - TALER_MERCHANT_get_private_statistics_counter_set_options_ ( \ - sch, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateStatisticsCounterOptionValue[] \ - ) \ - {__VA_ARGS__, \ - TALER_MERCHANT_get_private_statistics_counter_option_end_ () } \ - )) - - -/** - * Statistic counter aggregated by bucket. - */ -struct TALER_MERCHANT_GetPrivateStatisticsCounterByBucket -{ - - /** - * Start time of the bucket (inclusive). - */ - struct GNUNET_TIME_Timestamp start_time; - - /** - * End time of the bucket (exclusive). - */ - struct GNUNET_TIME_Timestamp end_time; - - /** - * Range of the bucket. - */ - const char *range; - - /** - * Sum of all counters falling under the given - * SLUG within this timeframe. - */ - uint64_t cumulative_counter; - -}; - - -/** - * Statistic counter aggregated by interval. - */ -struct TALER_MERCHANT_GetPrivateStatisticsCounterByInterval -{ - - /** - * Start time of the interval (inclusive). - * The interval always ends at the response - * generation time. - */ - struct GNUNET_TIME_Timestamp start_time; - - /** - * Sum of all counters falling under the given - * SLUG within this timeframe. - */ - uint64_t cumulative_counter; - -}; - - -/** - * Response details for a GET /private/statistics-counter/$SLUG request. - */ -struct TALER_MERCHANT_GetPrivateStatisticsCounterResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of bucket entries in @a buckets. - */ - unsigned int buckets_length; - - /** - * Array of counter statistics per bucket. - */ - const struct TALER_MERCHANT_GetPrivateStatisticsCounterByBucket *buckets; - - /** - * Description of the bucket aggregation scheme, or NULL. - */ - const char *buckets_description; - - /** - * Number of interval entries in @a intervals. - */ - unsigned int intervals_length; - - /** - * Array of counter statistics per time interval. - */ - const struct TALER_MERCHANT_GetPrivateStatisticsCounterByInterval * - intervals; - - /** - * Description of the interval aggregation scheme, or NULL. - */ - const char *intervals_description; - - } ok; - - } details; - -}; - - -#ifndef TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateStatisticsCounterCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/statistics-counter/$SLUG request. - * - * @param cls closure - * @param scgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateStatisticsCounterCallback)( - TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateStatisticsCounterResponse *scgr); - - -/** - * Start GET /private/statistics-counter/$SLUG operation. - * - * @param[in,out] sch operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_statistics_counter_start ( - struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle *sch, - TALER_MERCHANT_GetPrivateStatisticsCounterCallback cb, - TALER_MERCHANT_GET_PRIVATE_STATISTICS_COUNTER_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/statistics-counter/$SLUG operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateStatisticsCounterCallback has been invoked - * (as in those cases it'll be called internally by the implementation - * already). - * - * @param[in] sch operation to cancel - */ -void -TALER_MERCHANT_get_private_statistics_counter_cancel ( - struct TALER_MERCHANT_GetPrivateStatisticsCounterHandle *sch); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_STATISTICS_COUNTER_SLUG_H */ diff --git a/src/include/taler/taler-merchant/get-private-templates-TEMPLATE_ID.h b/src/include/taler/taler-merchant/get-private-templates-TEMPLATE_ID.h @@ -1,155 +0,0 @@ -/* - 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/get-private-templates-TEMPLATE_ID.h - * @brief C interface for GET /private/templates/$TEMPLATE_ID of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H -#define _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_GetPrivateTemplateHandle; - - -/** - * Response details for a GET /private/templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_GetPrivateTemplateResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Human-readable description of the template. - */ - const char *template_description; - - /** - * OTP device ID associated with this template, or NULL. - */ - const char *otp_id; - - /** - * Template contract (JSON). - */ - const json_t *template_contract; - - /** - * Editable defaults (JSON), or NULL if not set. - */ - const json_t *editable_defaults; - - /** - * Required currency, or NULL if not set. - */ - const char *required_currency; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/templates/$TEMPLATE_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param template_id identifier of the template to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateTemplateHandle * -TALER_MERCHANT_get_private_template_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *template_id); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateTemplateCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/templates/$TEMPLATE_ID request. - * - * @param cls closure - * @param tgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateTemplateCallback)( - TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateTemplateResponse *tgr); - - -/** - * Start GET /private/templates/$TEMPLATE_ID operation. - * - * @param[in,out] gpt operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_template_start ( - struct TALER_MERCHANT_GetPrivateTemplateHandle *gpt, - TALER_MERCHANT_GetPrivateTemplateCallback cb, - TALER_MERCHANT_GET_PRIVATE_TEMPLATE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/templates/$TEMPLATE_ID operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateTemplateCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpt operation to cancel - */ -void -TALER_MERCHANT_get_private_template_cancel ( - struct TALER_MERCHANT_GetPrivateTemplateHandle *gpt); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/taler-merchant/get-private-templates.h b/src/include/taler/taler-merchant/get-private-templates.h @@ -1,156 +0,0 @@ -/* - 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/get-private-templates.h - * @brief C interface for the GET /private/templates endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_H -#define _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/templates request. - */ -struct TALER_MERCHANT_GetPrivateTemplatesHandle; - - -/** - * Entry for one order template. - */ -struct TALER_MERCHANT_GetPrivateTemplatesTemplateEntry -{ - - /** - * Identifier of the template. - */ - const char *template_id; - - /** - * Human-readable description of the template. - */ - const char *template_description; - -}; - - -/** - * Response details for a GET /private/templates request. - */ -struct TALER_MERCHANT_GetPrivateTemplatesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of templates in @a templates. - */ - unsigned int templates_length; - - /** - * Array of template entries. - */ - const struct TALER_MERCHANT_GetPrivateTemplatesTemplateEntry *templates; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/templates operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateTemplatesHandle * -TALER_MERCHANT_get_private_templates_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateTemplatesCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/templates request. - * - * @param cls closure - * @param tgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateTemplatesCallback)( - TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateTemplatesResponse *tgr); - - -/** - * Start GET /private/templates operation. - * - * @param[in,out] gpth operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_templates_start ( - struct TALER_MERCHANT_GetPrivateTemplatesHandle *gpth, - TALER_MERCHANT_GetPrivateTemplatesCallback cb, - TALER_MERCHANT_GET_PRIVATE_TEMPLATES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/templates operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateTemplatesCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpth operation to cancel - */ -void -TALER_MERCHANT_get_private_templates_cancel ( - struct TALER_MERCHANT_GetPrivateTemplatesHandle *gpth); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_TEMPLATES_H */ diff --git a/src/include/taler/taler-merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h b/src/include/taler/taler-merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h @@ -1,196 +0,0 @@ -/* - 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/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h - * @brief C interface for GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG - * of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_TOKENFAMILIES_TOKEN_FAMILY_SLUG_H -#define _TALER_MERCHANT__GET_PRIVATE_TOKENFAMILIES_TOKEN_FAMILY_SLUG_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG request. - */ -struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle; - - -/** - * Response details for a GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG request. - */ -struct TALER_MERCHANT_GetPrivateTokenfamiliesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * URL-safe slug identifier of the token family. - */ - const char *slug; - - /** - * Human-readable name. - */ - const char *name; - - /** - * Human-readable description. - */ - const char *description; - - /** - * Internationalized descriptions (JSON), or NULL. - */ - const json_t *description_i18n; - - /** - * Extra data associated with this token family (JSON), or NULL. - */ - const json_t *extra_data; - - /** - * Start of validity period. - */ - struct GNUNET_TIME_Timestamp valid_after; - - /** - * End of validity period. - */ - struct GNUNET_TIME_Timestamp valid_before; - - /** - * Duration of individual token validity. - */ - struct GNUNET_TIME_Relative duration; - - /** - * Granularity for validity period alignment. - */ - struct GNUNET_TIME_Relative validity_granularity; - - /** - * Offset from purchase time to start of validity. - */ - struct GNUNET_TIME_Relative start_offset; - - /** - * Kind of token family ("subscription" or "discount"). - */ - const char *kind; - - /** - * Total number of tokens issued. - */ - uint64_t issued; - - /** - * Total number of tokens used. - */ - uint64_t used; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param token_family_slug slug of the token family to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle * -TALER_MERCHANT_get_private_tokenfamilies_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *token_family_slug); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateTokenfamiliesCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG request. - * - * @param cls closure - * @param tfgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateTokenfamiliesCallback)( - TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateTokenfamiliesResponse *tfgr); - - -/** - * Start GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG operation. - * - * @param[in,out] gptf operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_tokenfamilies_start ( - struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle *gptf, - TALER_MERCHANT_GetPrivateTokenfamiliesCallback cb, - TALER_MERCHANT_GET_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/tokenfamilies/$TOKEN_FAMILY_SLUG operation. - * This function must not be called by clients after the - * TALER_MERCHANT_GetPrivateTokenfamiliesCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gptf operation to cancel - */ -void -TALER_MERCHANT_get_private_tokenfamilies_cancel ( - struct TALER_MERCHANT_GetPrivateTokenfamiliesHandle *gptf); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_TOKENFAMILIES_TOKEN_FAMILY_SLUG_H */ diff --git a/src/include/taler/taler-merchant/get-private-transfers.h b/src/include/taler/taler-merchant/get-private-transfers.h @@ -1,429 +0,0 @@ -/* - 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/get-private-transfers.h - * @brief C interface for the GET /private/transfers endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_TRANSFERS_H -#define _TALER_MERCHANT__GET_PRIVATE_TRANSFERS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the GET /private/transfers request. - */ -enum TALER_MERCHANT_GetPrivateTransfersOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_END = 0, - - /** - * Filter by payto URI. - */ - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_PAYTO_URI, - - /** - * Filter for transfers before this time. - */ - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_BEFORE, - - /** - * Filter for transfers after this time. - */ - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_AFTER, - - /** - * Return at most N values. Negative values - * to return in descending order, positive for ascending. - * Default is -20. - */ - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_LIMIT, - - /** - * Starting transfer_serial_id for pagination. - */ - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_OFFSET, - - /** - * Filter by verification/expected status. - */ - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_EXPECTED - -}; - - -/** - * Value for an option for the GET /private/transfers request. - */ -struct TALER_MERCHANT_GetPrivateTransfersOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_GetPrivateTransfersOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_PAYTO_URI. - */ - struct TALER_FullPayto payto_uri; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_BEFORE. - */ - struct GNUNET_TIME_Timestamp before; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_AFTER. - */ - struct GNUNET_TIME_Timestamp after; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_LIMIT. - */ - int64_t limit; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_OFFSET. - */ - uint64_t offset; - - /** - * Value if @e option is - * #TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_EXPECTED. - */ - enum TALER_EXCHANGE_YesNoAll expected; - - } details; - -}; - - -/** - * Handle for a GET /private/transfers request. - */ -struct TALER_MERCHANT_GetPrivateTransfersHandle; - - -/** - * Set up GET /private/transfers operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateTransfersHandle * -TALER_MERCHANT_get_private_transfers_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_GetPrivateTransfersOptionValue - */ -#define TALER_MERCHANT_get_private_transfers_option_end_() \ - (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_END \ - } - -/** - * Set payto URI filter. - * - * @param p payto URI to filter by - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue - */ -#define TALER_MERCHANT_get_private_transfers_option_payto_uri(p) \ - (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_PAYTO_URI, \ - .details.payto_uri = (p) \ - } - -/** - * Set filter for transfers before the given timestamp. - * - * @param t timestamp threshold - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue - */ -#define TALER_MERCHANT_get_private_transfers_option_before(t) \ - (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_BEFORE, \ - .details.before = (t) \ - } - -/** - * Set filter for transfers after the given timestamp. - * - * @param t timestamp threshold - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue - */ -#define TALER_MERCHANT_get_private_transfers_option_after(t) \ - (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_AFTER, \ - .details.after = (t) \ - } - -/** - * Set limit on the number of results to return. - * - * @param l limit on the number of results to return - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue - */ -#define TALER_MERCHANT_get_private_transfers_option_limit(l) \ - (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_LIMIT, \ - .details.limit = (l) \ - } - -/** - * Set row offset from which to return results. - * - * @param o offset to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue - */ -#define TALER_MERCHANT_get_private_transfers_option_offset(o) \ - (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_OFFSET, \ - .details.offset = (o) \ - } - -/** - * Set filter on expected/verified status. - * - * @param e expected filter to use - * @return representation of the option as a struct TALER_MERCHANT_GetPrivateTransfersOptionValue - */ -#define TALER_MERCHANT_get_private_transfers_option_expected(e) \ - (const struct TALER_MERCHANT_GetPrivateTransfersOptionValue) \ - { \ - .option = TALER_MERCHANT_GET_PRIVATE_TRANSFERS_OPTION_EXPECTED, \ - .details.expected = (e) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param gth the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_get_private_transfers_set_options_ ( - struct TALER_MERCHANT_GetPrivateTransfersHandle *gth, - unsigned int num_options, - const struct TALER_MERCHANT_GetPrivateTransfersOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_get_private_transfers_set_options ( - * gth, - * TALER_MERCHANT_get_private_transfers_option_limit (-20), - * TALER_MERCHANT_get_private_transfers_option_expected ( - * TALER_EXCHANGE_YNA_YES)); - * - * @param gth the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_get_private_transfers_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_get_private_transfers_set_options(gth,...) \ - TALER_MERCHANT_get_private_transfers_set_options_ ( \ - gth, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_GetPrivateTransfersOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_get_private_transfers_option_end_ () } \ - )) - - -/** - * Transfer data entry. - */ -struct TALER_MERCHANT_GetPrivateTransfersTransferData -{ - - /** - * Total amount wired by the exchange (without wire fee). - */ - struct TALER_Amount credit_amount; - - /** - * Wire transfer identifier used. - */ - struct TALER_WireTransferIdentifierRawP wtid; - - /** - * URI of the target account. - */ - struct TALER_FullPayto payto_uri; - - /** - * URL of the exchange that made the transfer. - */ - const char *exchange_url; - - /** - * Serial number of the credit operation in the merchant backend. - */ - uint64_t transfer_serial_id; - - /** - * Time of the wire transfer, based on when we received - * a confirmation for the wire transfer. - */ - struct GNUNET_TIME_Timestamp execution_time; - - /** - * Serial number of the expected transfer in the merchant backend, - * or 0 if not known. - */ - uint64_t expected_transfer_serial_id; - - /** - * True if this wire transfer was expected. - */ - bool expected; - -}; - - -/** - * Response details for a GET /private/transfers request. - */ -struct TALER_MERCHANT_GetPrivateTransfersResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of transfers in @a transfers. - */ - unsigned int transfers_length; - - /** - * Array of transfer data entries. - */ - const struct TALER_MERCHANT_GetPrivateTransfersTransferData *transfers; - - } ok; - - } details; - -}; - - -#ifndef TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateTransfersCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/transfers request. - * - * @param cls closure - * @param gtr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateTransfersCallback)( - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateTransfersResponse *gtr); - - -/** - * Start GET /private/transfers operation. - * - * @param[in,out] gth operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_transfers_start ( - struct TALER_MERCHANT_GetPrivateTransfersHandle *gth, - TALER_MERCHANT_GetPrivateTransfersCallback cb, - TALER_MERCHANT_GET_PRIVATE_TRANSFERS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/transfers operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateTransfersCallback - * has been invoked (as in those cases it'll be called internally by - * the implementation already). - * - * @param[in] gth operation to cancel - */ -void -TALER_MERCHANT_get_private_transfers_cancel ( - struct TALER_MERCHANT_GetPrivateTransfersHandle *gth); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_TRANSFERS_H */ diff --git a/src/include/taler/taler-merchant/get-private-units-UNIT.h b/src/include/taler/taler-merchant/get-private-units-UNIT.h @@ -1,135 +0,0 @@ -/* - 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/get-private-units-UNIT.h - * @brief C interface for GET /private/units/$UNIT of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_UNITS_UNIT_H -#define _TALER_MERCHANT__GET_PRIVATE_UNITS_UNIT_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/units/$UNIT request. - */ -struct TALER_MERCHANT_GetPrivateUnitHandle; - - -/** - * Response details for a GET /private/units/$UNIT request. - */ -struct TALER_MERCHANT_GetPrivateUnitResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Detailed unit information. - */ - struct TALER_MERCHANT_UnitEntry unit; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/units/$UNIT operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param unit_id identifier of the unit to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateUnitHandle * -TALER_MERCHANT_get_private_unit_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *unit_id); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateUnitCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/units/$UNIT request. - * - * @param cls closure - * @param ugr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateUnitCallback)( - TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateUnitResponse *ugr); - - -/** - * Start GET /private/units/$UNIT operation. - * - * @param[in,out] gpu operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_unit_start ( - struct TALER_MERCHANT_GetPrivateUnitHandle *gpu, - TALER_MERCHANT_GetPrivateUnitCallback cb, - TALER_MERCHANT_GET_PRIVATE_UNIT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/units/$UNIT operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateUnitCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpu operation to cancel - */ -void -TALER_MERCHANT_get_private_unit_cancel ( - struct TALER_MERCHANT_GetPrivateUnitHandle *gpu); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_UNITS_UNIT_H */ diff --git a/src/include/taler/taler-merchant/get-private-units.h b/src/include/taler/taler-merchant/get-private-units.h @@ -1,137 +0,0 @@ -/* - 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/get-private-units.h - * @brief C interface for the GET /private/units endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_UNITS_H -#define _TALER_MERCHANT__GET_PRIVATE_UNITS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/units request. - */ -struct TALER_MERCHANT_GetPrivateUnitsHandle; - - -/** - * Response details for a GET /private/units request. - */ -struct TALER_MERCHANT_GetPrivateUnitsResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of units in @a units. - */ - unsigned int units_length; - - /** - * Array of unit entries. - */ - const struct TALER_MERCHANT_UnitEntry *units; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/units operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateUnitsHandle * -TALER_MERCHANT_get_private_units_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateUnitsCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/units request. - * - * @param cls closure - * @param ugr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateUnitsCallback)( - TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateUnitsResponse *ugr); - - -/** - * Start GET /private/units operation. - * - * @param[in,out] gpuh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_units_start ( - struct TALER_MERCHANT_GetPrivateUnitsHandle *gpuh, - TALER_MERCHANT_GetPrivateUnitsCallback cb, - TALER_MERCHANT_GET_PRIVATE_UNITS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/units operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateUnitsCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpuh operation to cancel - */ -void -TALER_MERCHANT_get_private_units_cancel ( - struct TALER_MERCHANT_GetPrivateUnitsHandle *gpuh); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_UNITS_H */ diff --git a/src/include/taler/taler-merchant/get-private-webhooks-WEBHOOK_ID.h b/src/include/taler/taler-merchant/get-private-webhooks-WEBHOOK_ID.h @@ -1,156 +0,0 @@ -/* - 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/get-private-webhooks-WEBHOOK_ID.h - * @brief C interface for GET /private/webhooks/$WEBHOOK_ID of the merchant backend - * @author Priscilla Huang - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_WEBHOOK_ID_H -#define _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_WEBHOOK_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/webhooks/$WEBHOOK_ID request. - */ -struct TALER_MERCHANT_GetPrivateWebhookHandle; - - -/** - * Response details for a GET /private/webhooks/$WEBHOOK_ID request. - */ -struct TALER_MERCHANT_GetPrivateWebhookResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Event type that triggers this webhook. - */ - const char *event_type; - - /** - * URL to send the webhook notification to. - */ - const char *url; - - /** - * HTTP method to use. - */ - const char *http_method; - - /** - * Template for HTTP headers, or NULL. - */ - const char *header_template; - - /** - * Template for the HTTP body, or NULL. - */ - const char *body_template; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/webhooks/$WEBHOOK_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param webhook_id identifier of the webhook to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateWebhookHandle * -TALER_MERCHANT_get_private_webhook_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *webhook_id); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateWebhookCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/webhooks/$WEBHOOK_ID request. - * - * @param cls closure - * @param wgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateWebhookCallback)( - TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateWebhookResponse *wgr); - - -/** - * Start GET /private/webhooks/$WEBHOOK_ID operation. - * - * @param[in,out] gpw operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_webhook_start ( - struct TALER_MERCHANT_GetPrivateWebhookHandle *gpw, - TALER_MERCHANT_GetPrivateWebhookCallback cb, - TALER_MERCHANT_GET_PRIVATE_WEBHOOK_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/webhooks/$WEBHOOK_ID operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetPrivateWebhookCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpw operation to cancel - */ -void -TALER_MERCHANT_get_private_webhook_cancel ( - struct TALER_MERCHANT_GetPrivateWebhookHandle *gpw); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_WEBHOOK_ID_H */ diff --git a/src/include/taler/taler-merchant/get-private-webhooks.h b/src/include/taler/taler-merchant/get-private-webhooks.h @@ -1,156 +0,0 @@ -/* - 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/get-private-webhooks.h - * @brief C interface for the GET /private/webhooks endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H -#define _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /private/webhooks request. - */ -struct TALER_MERCHANT_GetPrivateWebhooksHandle; - - -/** - * Entry for one webhook. - */ -struct TALER_MERCHANT_GetPrivateWebhooksWebhookEntry -{ - - /** - * Identifier of the webhook. - */ - const char *webhook_id; - - /** - * Event type that triggers this webhook. - */ - const char *event_type; - -}; - - -/** - * Response details for a GET /private/webhooks request. - */ -struct TALER_MERCHANT_GetPrivateWebhooksResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of webhooks in @a webhooks. - */ - unsigned int webhooks_length; - - /** - * Array of webhook entries. - */ - const struct TALER_MERCHANT_GetPrivateWebhooksWebhookEntry *webhooks; - - } ok; - - } details; - -}; - - -/** - * Set up GET /private/webhooks operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @return handle to operation - */ -struct TALER_MERCHANT_GetPrivateWebhooksHandle * -TALER_MERCHANT_get_private_webhooks_create ( - struct GNUNET_CURL_Context *ctx, - const char *url); - - -#ifndef TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetPrivateWebhooksCallback. - */ -#define TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE */ - -/** - * Callback for a GET /private/webhooks request. - * - * @param cls closure - * @param wgr response details - */ -typedef void -(*TALER_MERCHANT_GetPrivateWebhooksCallback)( - TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetPrivateWebhooksResponse *wgr); - - -/** - * Start GET /private/webhooks operation. - * - * @param[in,out] gpwh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_private_webhooks_start ( - struct TALER_MERCHANT_GetPrivateWebhooksHandle *gpwh, - TALER_MERCHANT_GetPrivateWebhooksCallback cb, - TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /private/webhooks operation. This function must not be - * called by clients after the TALER_MERCHANT_GetPrivateWebhooksCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpwh operation to cancel - */ -void -TALER_MERCHANT_get_private_webhooks_cancel ( - struct TALER_MERCHANT_GetPrivateWebhooksHandle *gpwh); - - -#endif /* _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H */ diff --git a/src/include/taler/taler-merchant/get-products-IMAGE_HASH-image.h b/src/include/taler/taler-merchant/get-products-IMAGE_HASH-image.h @@ -1,135 +0,0 @@ -/* - 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/get-products-IMAGE_HASH-image.h - * @brief C interface for GET /products/$IMAGE_HASH/image of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_PRODUCTS_IMAGE_HASH_IMAGE_H -#define _TALER_MERCHANT__GET_PRODUCTS_IMAGE_HASH_IMAGE_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /products/$IMAGE_HASH/image request. - */ -struct TALER_MERCHANT_GetProductsImageHandle; - - -/** - * Response details for a GET /products/$IMAGE_HASH/image request. - */ -struct TALER_MERCHANT_GetProductsImageResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Image data (a data URI). - */ - const char *image; - - } ok; - - } details; - -}; - - -/** - * Set up GET /products/$IMAGE_HASH/image operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param image_hash hash identifying the image to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetProductsImageHandle * -TALER_MERCHANT_get_products_image_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *image_hash); - - -#ifndef TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetProductsImageCallback. - */ -#define TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE */ - -/** - * Callback for a GET /products/$IMAGE_HASH/image request. - * - * @param cls closure - * @param pgr response details - */ -typedef void -(*TALER_MERCHANT_GetProductsImageCallback)( - TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetProductsImageResponse *pgr); - - -/** - * Start GET /products/$IMAGE_HASH/image operation. - * - * @param[in,out] gpi operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_products_image_start ( - struct TALER_MERCHANT_GetProductsImageHandle *gpi, - TALER_MERCHANT_GetProductsImageCallback cb, - TALER_MERCHANT_GET_PRODUCTS_IMAGE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /products/$IMAGE_HASH/image operation. This function - * must not be called by clients after the - * TALER_MERCHANT_GetProductsImageCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gpi operation to cancel - */ -void -TALER_MERCHANT_get_products_image_cancel ( - struct TALER_MERCHANT_GetProductsImageHandle *gpi); - - -#endif /* _TALER_MERCHANT__GET_PRODUCTS_IMAGE_HASH_IMAGE_H */ diff --git a/src/include/taler/taler-merchant/get-templates-TEMPLATE_ID.h b/src/include/taler/taler-merchant/get-templates-TEMPLATE_ID.h @@ -1,146 +0,0 @@ -/* - 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/get-templates-TEMPLATE_ID.h - * @brief C interface for GET /templates/$TEMPLATE_ID (wallet-facing) of the merchant backend - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__GET_TEMPLATES_TEMPLATE_ID_H -#define _TALER_MERCHANT__GET_TEMPLATES_TEMPLATE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a GET /templates/$TEMPLATE_ID request (wallet-facing). - */ -struct TALER_MERCHANT_GetTemplatesHandle; - - -/** - * Response details for a GET /templates/$TEMPLATE_ID request (wallet-facing). - */ -struct TALER_MERCHANT_GetTemplatesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Template contract (JSON). - */ - const json_t *template_contract; - - /** - * Editable defaults (JSON object), or NULL if not provided. - */ - const json_t *editable_defaults; - - /** - * Required currency, or NULL if not provided. - * FIXME: currently not provided by the backend. Fix backend! - */ - const char *required_currency; - - } ok; - - } details; - -}; - - -/** - * Set up GET /templates/$TEMPLATE_ID operation (wallet-facing). - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param template_id identifier of the template to retrieve - * @return handle to operation - */ -struct TALER_MERCHANT_GetTemplatesHandle * -TALER_MERCHANT_get_templates_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *template_id); - - -#ifndef TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_GetTemplatesCallback. - */ -#define TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE */ - -/** - * Callback for a GET /templates/$TEMPLATE_ID request (wallet-facing). - * - * @param cls closure - * @param wtgr response details - */ -typedef void -(*TALER_MERCHANT_GetTemplatesCallback)( - TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_GetTemplatesResponse *wtgr); - - -/** - * Start GET /templates/$TEMPLATE_ID operation (wallet-facing). - * - * @param[in,out] gth operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_get_templates_start ( - struct TALER_MERCHANT_GetTemplatesHandle *gth, - TALER_MERCHANT_GetTemplatesCallback cb, - TALER_MERCHANT_GET_TEMPLATES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel GET /templates/$TEMPLATE_ID operation (wallet-facing). - * This function must not be called by clients after the - * TALER_MERCHANT_GetTemplatesCallback has been invoked - * (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] gth operation to cancel - */ -void -TALER_MERCHANT_get_templates_cancel ( - struct TALER_MERCHANT_GetTemplatesHandle *gth); - - -#endif /* _TALER_MERCHANT__GET_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/taler-merchant/patch-management-instances-INSTANCE.h b/src/include/taler/taler-merchant/patch-management-instances-INSTANCE.h @@ -1,415 +0,0 @@ -/* - 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-management-instances-INSTANCE.h - * @brief C interface for PATCH /management/instances/$INSTANCE - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__PATCH_MANAGEMENT_INSTANCES_INSTANCE_H -#define _TALER_MERCHANT__PATCH_MANAGEMENT_INSTANCES_INSTANCE_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the PATCH /management/instances/$INSTANCE request. - */ -enum TALER_MERCHANT_PatchManagementInstancesOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_END = 0, - - /** - * Set the default pay delay. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, - - /** - * Set the default refund delay. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, - - /** - * Set the default wire transfer delay. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, - - /** - * Set the default wire transfer rounding interval. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, - - /** - * Set the email address. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_EMAIL, - - /** - * Set the phone number. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, - - /** - * Set the website URL. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_WEBSITE, - - /** - * Set the logo. - */ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_LOGO - -}; - - -/** - * Value for an option for the PATCH /management/instances/$INSTANCE request. - */ -struct TALER_MERCHANT_PatchManagementInstancesOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PatchManagementInstancesOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY. - */ - struct GNUNET_TIME_Relative default_pay_delay; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY. - */ - struct GNUNET_TIME_Relative default_refund_delay; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY. - */ - struct GNUNET_TIME_Relative default_wire_transfer_delay; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL. - */ - enum GNUNET_TIME_RounderInterval default_wire_transfer_rounding_interval; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_EMAIL. - */ - const char *email; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER. - */ - const char *phone_number; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_WEBSITE. - */ - const char *website; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_LOGO. - */ - const char *logo; - - } details; - -}; - - -/** - * Handle for a PATCH /management/instances/$INSTANCE operation. - */ -struct TALER_MERCHANT_PatchManagementInstancesHandle; - - -/** - * Set up PATCH /management/instances/$INSTANCE operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param instance_id identifier of the instance to patch - * @param name new human-readable name - * @param address new address (JSON) - * @param jurisdiction new jurisdiction (JSON) - * @param use_stefan whether to use the STEFAN curve for fee calculations - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchManagementInstancesHandle * -TALER_MERCHANT_patch_management_instances_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id, - const char *name, - const json_t *address, - const json_t *jurisdiction, - bool use_stefan); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PatchManagementInstancesOptionValue - */ -#define TALER_MERCHANT_patch_management_instances_option_end_() \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_END \ - } - -/** - * Set default pay delay. - * - * @param d delay to set - * @return representation of the option - */ -#define TALER_MERCHANT_patch_management_instances_option_default_pay_delay(d) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, \ - .details.default_pay_delay = (d) \ - } - -/** - * Set default refund delay. - * - * @param d delay to set - * @return representation of the option - */ -#define TALER_MERCHANT_patch_management_instances_option_default_refund_delay(d) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, \ - .details.default_refund_delay = (d) \ - } - -/** - * Set default wire transfer delay. - * - * @param d delay to set - * @return representation of the option - */ -#define \ - TALER_MERCHANT_patch_management_instances_option_default_wire_transfer_delay(d) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, \ - .details.default_wire_transfer_delay = (d) \ - } - -/** - * Set default wire transfer rounding interval. - * - * @param ri rounding interval to set - * @return representation of the option - */ -#define \ - TALER_MERCHANT_patch_management_instances_option_default_wire_transfer_rounding_interval(ri) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, \ - .details.default_wire_transfer_rounding_interval = (ri) \ - } - -/** - * Set email address. - * - * @param e email to set - * @return representation of the option - */ -#define TALER_MERCHANT_patch_management_instances_option_email(e) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_EMAIL, \ - .details.email = (e) \ - } - -/** - * Set phone number. - * - * @param p phone number to set - * @return representation of the option - */ -#define TALER_MERCHANT_patch_management_instances_option_phone_number(p) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, \ - .details.phone_number = (p) \ - } - -/** - * Set website URL. - * - * @param w website to set - * @return representation of the option - */ -#define TALER_MERCHANT_patch_management_instances_option_website(w) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_WEBSITE, \ - .details.website = (w) \ - } - -/** - * Set logo. - * - * @param l logo to set - * @return representation of the option - */ -#define TALER_MERCHANT_patch_management_instances_option_logo(l) \ - (const struct TALER_MERCHANT_PatchManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_OPTION_LOGO, \ - .details.logo = (l) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param pmih the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_patch_management_instances_set_options_ ( - struct TALER_MERCHANT_PatchManagementInstancesHandle *pmih, - unsigned int num_options, - const struct TALER_MERCHANT_PatchManagementInstancesOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_patch_management_instances_set_options ( - * pmih, - * TALER_MERCHANT_patch_management_instances_option_email ( - * "foo@example.com")); - * - * @param pmih the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_patch_management_instances_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_patch_management_instances_set_options(pmih,...) \ - TALER_MERCHANT_patch_management_instances_set_options_ ( \ - pmih, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PatchManagementInstancesOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_patch_management_instances_option_end_ \ - () } \ - )) - - -/** - * Response details for a PATCH /management/instances/$INSTANCE request. - */ -struct TALER_MERCHANT_PatchManagementInstancesResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchManagementInstancesCallback. - */ -#define TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /management/instances/$INSTANCE request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchManagementInstancesCallback)( - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchManagementInstancesResponse *result); - - -/** - * Start PATCH /management/instances/$INSTANCE operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_management_instances_start ( - struct TALER_MERCHANT_PatchManagementInstancesHandle *handle, - TALER_MERCHANT_PatchManagementInstancesCallback cb, - TALER_MERCHANT_PATCH_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /management/instances/$INSTANCE operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_patch_management_instances_cancel ( - struct TALER_MERCHANT_PatchManagementInstancesHandle *handle); - - -#endif /* _TALER_MERCHANT__PATCH_MANAGEMENT_INSTANCES_INSTANCE_H */ diff --git a/src/include/taler/taler-merchant/patch-private-accounts-H_WIRE.h b/src/include/taler/taler-merchant/patch-private-accounts-H_WIRE.h @@ -1,279 +0,0 @@ -/* - 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 - * @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> - - -/** - * Possible options we can set for the PATCH /private/accounts/$H_WIRE request. - */ -enum TALER_MERCHANT_PatchPrivateAccountOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_END = 0, - - /** - * Set the credit facade URL. - */ - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_URL, - - /** - * Set the credit facade credentials (JSON). - */ - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_CREDENTIALS, - - /** - * Set the extra wire subject metadata (restricted text). - */ - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_EXTRA_WIRE_SUBJECT_METADATA - -}; - - -/** - * Value for an option for the PATCH /private/accounts/$H_WIRE request. - */ -struct TALER_MERCHANT_PatchPrivateAccountOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PatchPrivateAccountOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_URL. - */ - const char *credit_facade_url; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_CREDENTIALS. - */ - const json_t *credit_facade_credentials; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_EXTRA_WIRE_SUBJECT_METADATA. - */ - const char *extra_wire_subject_metadata; - - } details; - -}; - - -/** - * Handle for a PATCH /private/accounts/$H_WIRE operation. - */ -struct TALER_MERCHANT_PatchPrivateAccountHandle; - - -/** - * Set up PATCH /private/accounts/$H_WIRE operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param h_wire hash of the wire details identifying the account - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchPrivateAccountHandle * -TALER_MERCHANT_patch_private_account_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_MerchantWireHashP *h_wire); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PatchPrivateAccountOptionValue - */ -#define TALER_MERCHANT_patch_private_account_option_end_() \ - (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_END \ - } - -/** - * Set credit facade URL. - * - * @param u credit facade URL to set - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateAccountOptionValue - */ -#define TALER_MERCHANT_patch_private_account_option_credit_facade_url(u) \ - (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_URL, \ - .details.credit_facade_url = (u) \ - } - -/** - * Set credit facade credentials. - * - * @param c credit facade credentials (JSON) to set - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateAccountOptionValue - */ -#define TALER_MERCHANT_patch_private_account_option_credit_facade_credentials(c) \ - (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_CREDIT_FACADE_CREDENTIALS, \ - .details.credit_facade_credentials = (c) \ - } - -/** - * Set extra wire subject metadata. - * - * @param m extra wire subject metadata (JSON) to set - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateAccountOptionValue - */ -#define TALER_MERCHANT_patch_private_account_option_extra_wire_subject_metadata(m) \ - (const struct TALER_MERCHANT_PatchPrivateAccountOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_OPTION_EXTRA_WIRE_SUBJECT_METADATA, \ - .details.extra_wire_subject_metadata = (m) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param pah the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_patch_private_account_set_options_ ( - struct TALER_MERCHANT_PatchPrivateAccountHandle *pah, - unsigned int num_options, - const struct TALER_MERCHANT_PatchPrivateAccountOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_patch_private_account_set_options ( - * pah, - * TALER_MERCHANT_patch_private_account_option_credit_facade_url ( - * "https://example.com/facade")); - * - * @param pah the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_patch_private_account_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_patch_private_account_set_options(pah,...) \ - TALER_MERCHANT_patch_private_account_set_options_ ( \ - pah, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PatchPrivateAccountOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_patch_private_account_option_end_ () } \ - )) - - -/** - * Response details for a PATCH /private/accounts/$H_WIRE request. - */ -struct TALER_MERCHANT_PatchPrivateAccountResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchPrivateAccountCallback. - */ -#define TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /private/accounts/$H_WIRE request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchPrivateAccountCallback)( - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchPrivateAccountResponse *result); - - -/** - * Start PATCH /private/accounts/$H_WIRE operation. - * - * @param[in,out] pah operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_private_account_start ( - struct TALER_MERCHANT_PatchPrivateAccountHandle *pah, - TALER_MERCHANT_PatchPrivateAccountCallback cb, - TALER_MERCHANT_PATCH_PRIVATE_ACCOUNT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /private/accounts/$H_WIRE operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] pah operation to cancel - */ -void -TALER_MERCHANT_patch_private_account_cancel ( - struct TALER_MERCHANT_PatchPrivateAccountHandle *pah); - - -#endif /* _TALER_MERCHANT__PATCH_PRIVATE_ACCOUNTS_H_WIRE_H */ diff --git a/src/include/taler/taler-merchant/patch-private-orders-ORDER_ID-forget.h b/src/include/taler/taler-merchant/patch-private-orders-ORDER_ID-forget.h @@ -1,113 +0,0 @@ -/* - 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-orders-ORDER_ID-forget.h - * @brief C interface for PATCH /private/orders/$ORDER_ID/forget - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H -#define _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a PATCH /private/orders/$ORDER_ID/forget operation. - */ -struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle; - - -/** - * Set up PATCH /private/orders/$ORDER_ID/forget operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order - * @param fields_length number of field paths in @a fields - * @param fields array of JSON pointer paths to redact - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle * -TALER_MERCHANT_patch_private_orders_forget_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - unsigned int fields_length, - const char *fields[static fields_length]); - - -/** - * Response details for a PATCH /private/orders/$ORDER_ID/forget request. - */ -struct TALER_MERCHANT_PatchPrivateOrdersForgetResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchPrivateOrdersForgetCallback. - */ -#define TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /private/orders/$ORDER_ID/forget request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchPrivateOrdersForgetCallback)( - TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchPrivateOrdersForgetResponse *result); - - -/** - * Start PATCH /private/orders/$ORDER_ID/forget operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_private_orders_forget_start ( - struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle *handle, - TALER_MERCHANT_PatchPrivateOrdersForgetCallback cb, - TALER_MERCHANT_PATCH_PRIVATE_ORDERS_FORGET_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /private/orders/$ORDER_ID/forget operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_patch_private_orders_forget_cancel ( - struct TALER_MERCHANT_PatchPrivateOrdersForgetHandle *handle); - - -#endif /* _TALER_MERCHANT__PATCH_PRIVATE_ORDERS_ORDER_ID_FORGET_H */ diff --git a/src/include/taler/taler-merchant/patch-private-otp-devices-DEVICE_ID.h b/src/include/taler/taler-merchant/patch-private-otp-devices-DEVICE_ID.h @@ -1,233 +0,0 @@ -/* - 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-otp-devices-DEVICE_ID.h - * @brief C interface for PATCH /private/otp-devices/$DEVICE_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__PATCH_PRIVATE_OTP_DEVICES_DEVICE_ID_H -#define _TALER_MERCHANT__PATCH_PRIVATE_OTP_DEVICES_DEVICE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the PATCH /private/otp-devices/$DEVICE_ID request. - */ -enum TALER_MERCHANT_PatchPrivateOtpDeviceOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_END = 0, - - /** - * Set the OTP counter value (for HOTP). - */ - TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_OTP_CTR - -}; - - -/** - * Value for an option for the PATCH /private/otp-devices/$DEVICE_ID request. - */ -struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PatchPrivateOtpDeviceOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_OTP_CTR. - */ - uint64_t otp_ctr; - - } details; - -}; - - -/** - * Handle for a PATCH /private/otp-devices/$DEVICE_ID operation. - */ -struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle; - - -/** - * Set up PATCH /private/otp-devices/$DEVICE_ID operation. - * Note that you must explicitly start the operation after setup. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param otp_device_id identifier of the OTP device to update - * @param otp_device_description new human-readable description - * @param otp_key new base32-encoded OTP secret key, or NULL to keep unchanged - * @param mca new OTP algorithm - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle * -TALER_MERCHANT_patch_private_otp_device_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *otp_device_id, - const char *otp_device_description, - const char *otp_key, - enum TALER_MerchantConfirmationAlgorithm mca); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue - */ -#define TALER_MERCHANT_patch_private_otp_device_option_end_() \ - (const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_END \ - } - -/** - * Set the counter value (for HOTP). - * - * @param c the counter value - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue - */ -#define TALER_MERCHANT_patch_private_otp_device_option_otp_ctr(c) \ - (const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_OPTION_OTP_CTR, \ - .details.otp_ctr = (c) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param odh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_patch_private_otp_device_set_options_ ( - struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle *odh, - unsigned int num_options, - const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_patch_private_otp_device_set_options ( - * odh, - * TALER_MERCHANT_patch_private_otp_device_option_otp_ctr (42)); - * - * @param odh the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_patch_private_otp_device_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_patch_private_otp_device_set_options(odh,...) \ - TALER_MERCHANT_patch_private_otp_device_set_options_ ( \ - odh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PatchPrivateOtpDeviceOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_patch_private_otp_device_option_end_ () } \ - )) - - -/** - * Response details for a PATCH /private/otp-devices/$DEVICE_ID request. - */ -struct TALER_MERCHANT_PatchPrivateOtpDeviceResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchPrivateOtpDeviceCallback. - */ -#define TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /private/otp-devices/$DEVICE_ID request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchPrivateOtpDeviceCallback)( - TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchPrivateOtpDeviceResponse *result); - - -/** - * Start PATCH /private/otp-devices/$DEVICE_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_private_otp_device_start ( - struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle *handle, - TALER_MERCHANT_PatchPrivateOtpDeviceCallback cb, - TALER_MERCHANT_PATCH_PRIVATE_OTP_DEVICE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /private/otp-devices/$DEVICE_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_patch_private_otp_device_cancel ( - struct TALER_MERCHANT_PatchPrivateOtpDeviceHandle *handle); - - -#endif /* _TALER_MERCHANT__PATCH_PRIVATE_OTP_DEVICES_DEVICE_ID_H */ diff --git a/src/include/taler/taler-merchant/patch-private-products-PRODUCT_ID.h b/src/include/taler/taler-merchant/patch-private-products-PRODUCT_ID.h @@ -1,638 +0,0 @@ -/* - 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-products-PRODUCT_ID.h - * @brief C interface for PATCH /private/products/$PRODUCT_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__PATCH_PRIVATE_PRODUCTS_PRODUCT_ID_H -#define _TALER_MERCHANT__PATCH_PRIVATE_PRODUCTS_PRODUCT_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the PATCH /private/products/$PRODUCT_ID request. - */ -enum TALER_MERCHANT_PatchPrivateProductOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_END = 0, - - /** - * Set value and fractional part of total stock. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK, - - /** - * Set value part of total stock (-1 for unlimited). - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_VAL, - - /** - * Set fractional part of total stock. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC, - - /** - * Set whether fractional quantities are allowed. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_ALLOW_FRACTION, - - /** - * Set precision level for fractions. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_PRECISION_LEVEL, - - /** - * Internationalized descriptions (JSON). - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_DESCRIPTION_I18N, - - /** - * Product image (base64-encoded data URL). - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_IMAGE, - - /** - * Tax information (JSON array). - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TAXES, - - /** - * Total units lost/expired. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_LOST, - - /** - * Storage location (JSON). - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_ADDRESS, - - /** - * Expected restock time. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_NEXT_RESTOCK, - - /** - * Explicit product name (distinct from description). - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_NAME, - - /** - * Category IDs. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_CATEGORIES, - - /** - * Minimum age requirement. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MINIMUM_AGE, - - /** - * Product group ID. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_GROUP_ID, - - /** - * Money pot ID. - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MONEY_POT_ID, - - /** - * Whether the price is net (before tax). - */ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRICE_IS_NET - -}; - - -/** - * Value for an option for the PATCH /private/products/$PRODUCT_ID request. - */ -struct TALER_MERCHANT_PatchPrivateProductOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PatchPrivateProductOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC. - */ - uint32_t total_stock_frac; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_ALLOW_FRACTION. - */ - bool unit_allow_fraction; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_PRECISION_LEVEL. - */ - uint32_t unit_precision_level; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_DESCRIPTION_I18N. - */ - const json_t *description_i18n; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_IMAGE. - */ - const char *image; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TAXES. - */ - const json_t *taxes; - - struct - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK. - * -1 for infinite stock. - */ - int64_t val; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC. - */ - uint32_t frac; - } total_stock; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_LOST. - */ - uint64_t total_lost; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_ADDRESS. - */ - const json_t *address; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_NEXT_RESTOCK. - */ - struct GNUNET_TIME_Timestamp next_restock; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_NAME. - */ - const char *product_name; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_CATEGORIES. - */ - struct - { - unsigned int num; - const uint64_t *cats; - } categories; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MINIMUM_AGE. - */ - uint32_t minimum_age; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_GROUP_ID. - */ - uint64_t product_group_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MONEY_POT_ID. - */ - uint64_t money_pot_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRICE_IS_NET. - */ - bool price_is_net; - - } details; - -}; - - -/** - * Handle for a PATCH /private/products/$PRODUCT_ID operation. - */ -struct TALER_MERCHANT_PatchPrivateProductHandle; - - -/** - * Set up PATCH /private/products/$PRODUCT_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param product_id identifier of the product to update - * @param description new human-readable description - * @param unit unit of measurement - * @param num_prices length of the @e prices array - * @param prices new unit prices - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchPrivateProductHandle * -TALER_MERCHANT_patch_private_product_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *product_id, - const char *description, - const char *unit, - unsigned int num_prices, - const struct TALER_Amount prices[static num_prices]); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PatchPrivateProductOptionValue - */ -#define TALER_MERCHANT_patch_private_product_option_end_() \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_END \ - } - -/** - * Set value and fractional part of total stock. - * - * @param v value part of stock - * @param f fractional stock value - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue - */ -#define TALER_MERCHANT_patch_private_product_option_total_stock(v,f) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC, \ - .details.total_stock.val = (v), \ - .details.total_stock.frac = (f) \ - } - -/** - * Set fractional part of total stock. - * - * @param f fractional stock value - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue - */ -#define TALER_MERCHANT_patch_private_product_option_total_stock_frac(f) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_FRAC, \ - .details.total_stock.frac = (f) \ - } - -/** - * Set value part of total stock (-1 for unlimited). - * - * @param v stock value - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue - */ -#define TALER_MERCHANT_patch_private_product_option_total_stock_val(v) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_STOCK_VAL, \ - .details.total_stock.val = (v) \ - } - -/** - * Set whether fractional quantities are allowed. - * - * @param a true if fractional quantities are allowed - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue - */ -#define TALER_MERCHANT_patch_private_product_option_unit_allow_fraction(a) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_ALLOW_FRACTION, \ - .details.unit_allow_fraction = (a) \ - } - -/** - * Set precision level for fractions. - * - * @param p precision level value - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateProductOptionValue - */ -#define TALER_MERCHANT_patch_private_product_option_unit_precision_level(p) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_UNIT_PRECISION_LEVEL, \ - .details.unit_precision_level = (p) \ - } - -/** - * Set internationalized descriptions. - * - * @param d descriptions JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_description_i18n(d) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_DESCRIPTION_I18N, \ - .details.description_i18n = (d) \ - } - -/** - * Set product image (base64-encoded data URL). - * - * @param i image string - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_image(i) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_IMAGE, \ - .details.image = (i) \ - } - -/** - * Set tax information. - * - * @param t taxes JSON array - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_taxes(t) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TAXES, \ - .details.taxes = (t) \ - } - -/** - * Set total units lost/expired. - * - * @param l total lost value - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_total_lost(l) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_TOTAL_LOST, \ - .details.total_lost = (l) \ - } - -/** - * Set storage address. - * - * @param a address JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_address(a) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_ADDRESS, \ - .details.address = (a) \ - } - -/** - * Set expected restock time. - * - * @param r restock timestamp - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_next_restock(r) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_NEXT_RESTOCK, \ - .details.next_restock = (r) \ - } - -/** - * Set explicit product name (distinct from description). - * - * @param n product name string - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_product_name(n) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_NAME, \ - .details.product_name = (n) \ - } - -/** - * Set category IDs. - * - * @param n number of categories - * @param c array of category IDs - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_categories(n,c) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_CATEGORIES, \ - .details.categories = { .num = (n), .cats = (c) } \ - } - -/** - * Set minimum age requirement. - * - * @param a minimum age (0 for none) - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_minimum_age(a) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MINIMUM_AGE, \ - .details.minimum_age = (a) \ - } - -/** - * Set product group ID. - * - * @param g product group ID - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_product_group_id(g) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRODUCT_GROUP_ID, \ - .details.product_group_id = (g) \ - } - -/** - * Set money pot ID. - * - * @param m money pot ID - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_money_pot_id(m) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_MONEY_POT_ID, \ - .details.money_pot_id = (m) \ - } - -/** - * Set whether the price is net (before tax). - * - * @param b true if price is net - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_product_option_price_is_net(b) \ - (const struct TALER_MERCHANT_PatchPrivateProductOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_OPTION_PRICE_IS_NET, \ - .details.price_is_net = (b) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param pph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_patch_private_product_set_options_ ( - struct TALER_MERCHANT_PatchPrivateProductHandle *pph, - unsigned int num_options, - const struct TALER_MERCHANT_PatchPrivateProductOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_patch_private_product_set_options ( - * pph, - * TALER_MERCHANT_patch_private_product_option_total_stock_frac (500), - * TALER_MERCHANT_patch_private_product_option_unit_allow_fraction (true)); - * - * @param pph the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_patch_private_product_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_patch_private_product_set_options(pph,...) \ - TALER_MERCHANT_patch_private_product_set_options_ ( \ - pph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PatchPrivateProductOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_patch_private_product_option_end_ () } \ - )) - - -/** - * Response details for a PATCH /private/products/$PRODUCT_ID request. - */ -struct TALER_MERCHANT_PatchPrivateProductResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchPrivateProductCallback. - */ -#define TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /private/products/$PRODUCT_ID request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchPrivateProductCallback)( - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchPrivateProductResponse *result); - - -/** - * Start PATCH /private/products/$PRODUCT_ID operation. - * - * @param[in,out] pph operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_private_product_start ( - struct TALER_MERCHANT_PatchPrivateProductHandle *pph, - TALER_MERCHANT_PatchPrivateProductCallback cb, - TALER_MERCHANT_PATCH_PRIVATE_PRODUCT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /private/products/$PRODUCT_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] pph operation to cancel - */ -void -TALER_MERCHANT_patch_private_product_cancel ( - struct TALER_MERCHANT_PatchPrivateProductHandle *pph); - - -#endif /* _TALER_MERCHANT__PATCH_PRIVATE_PRODUCTS_PRODUCT_ID_H */ diff --git a/src/include/taler/taler-merchant/patch-private-templates-TEMPLATE_ID.h b/src/include/taler/taler-merchant/patch-private-templates-TEMPLATE_ID.h @@ -1,223 +0,0 @@ -/* - 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-templates-TEMPLATE_ID.h - * @brief C interface for PATCH /private/templates/$TEMPLATE_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__PATCH_PRIVATE_TEMPLATES_TEMPLATE_ID_H -#define _TALER_MERCHANT__PATCH_PRIVATE_TEMPLATES_TEMPLATE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the PATCH /private/templates/$TEMPLATE_ID request. - */ -enum TALER_MERCHANT_PatchPrivateTemplateOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_END = 0, - - /** - * Editable defaults (JSON object) for the template. - */ - TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_EDITABLE_DEFAULTS - -}; - - -/** - * Value for an option for the PATCH /private/templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_PatchPrivateTemplateOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PatchPrivateTemplateOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_EDITABLE_DEFAULTS. - */ - const json_t *editable_defaults; - - } details; - -}; - - -/** - * Handle for a PATCH /private/templates/$TEMPLATE_ID operation. - */ -struct TALER_MERCHANT_PatchPrivateTemplateHandle; - - -/** - * Set up PATCH /private/templates/$TEMPLATE_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param template_id identifier of the template to update - * @param template_description new human-readable description - * @param otp_id new OTP device ID, or NULL to remove association - * @param template_contract new template contract (JSON) - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchPrivateTemplateHandle * -TALER_MERCHANT_patch_private_template_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *template_id, - const char *template_description, - const char *otp_id, - json_t *template_contract); - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_patch_private_template_option_end_() \ - (const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_END \ - } - -/** - * Set editable defaults. - * - * @param ed editable defaults (JSON object) - * @return representation of the option - */ -#define TALER_MERCHANT_patch_private_template_option_editable_defaults(ed) \ - (const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_OPTION_EDITABLE_DEFAULTS, \ - .details.editable_defaults = (ed) \ - } - - -/** - * Set the requested options for the operation. - * - * @param tph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_patch_private_template_set_options_ ( - struct TALER_MERCHANT_PatchPrivateTemplateHandle *tph, - unsigned int num_options, - const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param tph the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_patch_private_template_set_options(tph,...) \ - TALER_MERCHANT_patch_private_template_set_options_ ( \ - tph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PatchPrivateTemplateOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_patch_private_template_option_end_ () } \ - )) - - -/** - * Response details for a PATCH /private/templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_PatchPrivateTemplateResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchPrivateTemplateCallback. - */ -#define TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /private/templates/$TEMPLATE_ID request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchPrivateTemplateCallback)( - TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchPrivateTemplateResponse *result); - - -/** - * Start PATCH /private/templates/$TEMPLATE_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_private_template_start ( - struct TALER_MERCHANT_PatchPrivateTemplateHandle *handle, - TALER_MERCHANT_PatchPrivateTemplateCallback cb, - TALER_MERCHANT_PATCH_PRIVATE_TEMPLATE_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /private/templates/$TEMPLATE_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_patch_private_template_cancel ( - struct TALER_MERCHANT_PatchPrivateTemplateHandle *handle); - - -#endif /* _TALER_MERCHANT__PATCH_PRIVATE_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/taler-merchant/patch-private-units-UNIT.h b/src/include/taler/taler-merchant/patch-private-units-UNIT.h @@ -1,376 +0,0 @@ -/* - 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-units-UNIT.h - * @brief C interface for PATCH /private/units/$UNIT - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__PATCH_PRIVATE_UNITS_UNIT_H -#define _TALER_MERCHANT__PATCH_PRIVATE_UNITS_UNIT_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the PATCH /private/units/$UNIT request. - */ -enum TALER_MERCHANT_PatchPrivateUnitOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_END = 0, - - /** - * Set the long name of the unit. - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG, - - /** - * Set the short name (symbol) of the unit. - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT, - - /** - * Set internationalized long names (JSON). - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG_I18N, - - /** - * Set internationalized short names (JSON). - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT_I18N, - - /** - * Set whether fractional quantities are allowed. - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ALLOW_FRACTION, - - /** - * Set precision level for fractions. - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_PRECISION_LEVEL, - - /** - * Set active status of the unit. - */ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ACTIVE - -}; - - -/** - * Value for an option for the PATCH /private/units/$UNIT request. - */ -struct TALER_MERCHANT_PatchPrivateUnitOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PatchPrivateUnitOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG. - */ - const char *unit_name_long; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT. - */ - const char *unit_name_short; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG_I18N. - */ - const json_t *unit_name_long_i18n; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT_I18N. - */ - const json_t *unit_name_short_i18n; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ALLOW_FRACTION. - */ - bool unit_allow_fraction; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_PRECISION_LEVEL. - */ - uint32_t unit_precision_level; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ACTIVE. - */ - bool unit_active; - - } details; - -}; - - -/** - * Handle for a PATCH /private/units/$UNIT operation. - */ -struct TALER_MERCHANT_PatchPrivateUnitHandle; - - -/** - * Set up PATCH /private/units/$UNIT operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param unit_id identifier of the unit to update - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchPrivateUnitHandle * -TALER_MERCHANT_patch_private_unit_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *unit_id); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_end_() \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_END \ - } - -/** - * Set the long name of the unit. - * - * @param n long name to set - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_unit_name_long(n) \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG, \ - .details.unit_name_long = (n) \ - } - -/** - * Set the short name (symbol) of the unit. - * - * @param n short name to set - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_unit_name_short(n) \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT, \ - .details.unit_name_short = (n) \ - } - -/** - * Set internationalized long names. - * - * @param j JSON object with internationalized long names - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_unit_name_long_i18n(j) \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_LONG_I18N \ - , \ - .details.unit_name_long_i18n = (j) \ - } - -/** - * Set internationalized short names. - * - * @param j JSON object with internationalized short names - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_unit_name_short_i18n(j) \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_NAME_SHORT_I18N, \ - .details.unit_name_short_i18n = (j) \ - } - -/** - * Set whether fractional quantities are allowed. - * - * @param a true if fractional quantities are allowed - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_unit_allow_fraction(a) \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ALLOW_FRACTION \ - , \ - .details.unit_allow_fraction = (a) \ - } - -/** - * Set precision level for fractions. - * - * @param p precision level value - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_unit_precision_level(p) \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_PRECISION_LEVEL, \ - .details.unit_precision_level = (p) \ - } - -/** - * Set active status of the unit. - * - * @param a true if the unit should be active - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateUnitOptionValue - */ -#define TALER_MERCHANT_patch_private_unit_option_unit_active(a) \ - (const struct TALER_MERCHANT_PatchPrivateUnitOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_UNIT_OPTION_UNIT_ACTIVE, \ - .details.unit_active = (a) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param uph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_patch_private_unit_set_options_ ( - struct TALER_MERCHANT_PatchPrivateUnitHandle *uph, - unsigned int num_options, - const struct TALER_MERCHANT_PatchPrivateUnitOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_patch_private_unit_set_options ( - * uph, - * TALER_MERCHANT_patch_private_unit_option_unit_name_long ("Kilogram"), - * TALER_MERCHANT_patch_private_unit_option_unit_active (true)); - * - * @param uph the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_patch_private_unit_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_patch_private_unit_set_options(uph,...) \ - TALER_MERCHANT_patch_private_unit_set_options_ ( \ - uph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PatchPrivateUnitOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_patch_private_unit_option_end_ () } \ - )) - - -/** - * Response details for a PATCH /private/units/$UNIT request. - */ -struct TALER_MERCHANT_PatchPrivateUnitResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchPrivateUnitCallback. - */ -#define TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /private/units/$UNIT request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchPrivateUnitCallback)( - TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchPrivateUnitResponse *result); - - -/** - * Start PATCH /private/units/$UNIT operation. - * - * @param[in,out] uph operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_private_unit_start ( - struct TALER_MERCHANT_PatchPrivateUnitHandle *uph, - TALER_MERCHANT_PatchPrivateUnitCallback cb, - TALER_MERCHANT_PATCH_PRIVATE_UNIT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /private/units/$UNIT operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] uph operation to cancel - */ -void -TALER_MERCHANT_patch_private_unit_cancel ( - struct TALER_MERCHANT_PatchPrivateUnitHandle *uph); - - -#endif /* _TALER_MERCHANT__PATCH_PRIVATE_UNITS_UNIT_H */ diff --git a/src/include/taler/taler-merchant/patch-private-webhooks-WEBHOOK_ID.h b/src/include/taler/taler-merchant/patch-private-webhooks-WEBHOOK_ID.h @@ -1,260 +0,0 @@ -/* - 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-webhooks-WEBHOOK_ID.h - * @brief C interface for PATCH /private/webhooks/$WEBHOOK_ID - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__PATCH_PRIVATE_WEBHOOKS_WEBHOOK_ID_H -#define _TALER_MERCHANT__PATCH_PRIVATE_WEBHOOKS_WEBHOOK_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the PATCH /private/webhooks/$WEBHOOK_ID request. - */ -enum TALER_MERCHANT_PatchPrivateWebhookOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_END = 0, - - /** - * Set the header template. - */ - TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_HEADER_TEMPLATE, - - /** - * Set the body template. - */ - TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_BODY_TEMPLATE - -}; - - -/** - * Value for an option for the PATCH /private/webhooks/$WEBHOOK_ID request. - */ -struct TALER_MERCHANT_PatchPrivateWebhookOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PatchPrivateWebhookOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_HEADER_TEMPLATE. - */ - const char *header_template; - - /** - * Value if @e option is - * #TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_BODY_TEMPLATE. - */ - const char *body_template; - - } details; - -}; - - -/** - * Handle for a PATCH /private/webhooks/$WEBHOOK_ID operation. - */ -struct TALER_MERCHANT_PatchPrivateWebhookHandle; - - -/** - * Set up PATCH /private/webhooks/$WEBHOOK_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param webhook_id identifier of the webhook to update - * @param event_type new event type - * @param url_template new notification URL template - * @param http_method new HTTP method - * @return handle to operation, NULL on error - */ -struct TALER_MERCHANT_PatchPrivateWebhookHandle * -TALER_MERCHANT_patch_private_webhook_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *webhook_id, - const char *event_type, - const char *url_template, - const char *http_method); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PatchPrivateWebhookOptionValue - */ -#define TALER_MERCHANT_patch_private_webhook_option_end_() \ - (const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue) \ - { \ - .option = TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_END \ - } - -/** - * Set header template. - * - * @param ht header template string to set - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateWebhookOptionValue - */ -#define TALER_MERCHANT_patch_private_webhook_option_header_template(ht) \ - (const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_HEADER_TEMPLATE, \ - .details.header_template = (ht) \ - } - -/** - * Set body template. - * - * @param bt body template string to set - * @return representation of the option as a struct TALER_MERCHANT_PatchPrivateWebhookOptionValue - */ -#define TALER_MERCHANT_patch_private_webhook_option_body_template(bt) \ - (const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_OPTION_BODY_TEMPLATE, \ - .details.body_template = (bt) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param wph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_patch_private_webhook_set_options_ ( - struct TALER_MERCHANT_PatchPrivateWebhookHandle *wph, - unsigned int num_options, - const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_patch_private_webhook_set_options ( - * wph, - * TALER_MERCHANT_patch_private_webhook_option_header_template ( - * "Content-Type: application/json")); - * - * @param wph the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_patch_private_webhook_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_patch_private_webhook_set_options(wph,...) \ - TALER_MERCHANT_patch_private_webhook_set_options_ ( \ - wph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PatchPrivateWebhookOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_patch_private_webhook_option_end_ () } \ - )) - - -/** - * Response details for a PATCH /private/webhooks/$WEBHOOK_ID request. - */ -struct TALER_MERCHANT_PatchPrivateWebhookResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; -}; - - -#ifndef TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PatchPrivateWebhookCallback. - */ -#define TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE */ - -/** - * Callback for a PATCH /private/webhooks/$WEBHOOK_ID request. - * - * @param cls closure - * @param result response details - */ -typedef void -(*TALER_MERCHANT_PatchPrivateWebhookCallback)( - TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PatchPrivateWebhookResponse *result); - - -/** - * Start PATCH /private/webhooks/$WEBHOOK_ID operation. - * - * @param[in,out] handle operation to start - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_patch_private_webhook_start ( - struct TALER_MERCHANT_PatchPrivateWebhookHandle *handle, - TALER_MERCHANT_PatchPrivateWebhookCallback cb, - TALER_MERCHANT_PATCH_PRIVATE_WEBHOOK_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel PATCH /private/webhooks/$WEBHOOK_ID operation. - * This function must not be called by clients after the - * callback has been invoked. - * - * @param[in] handle operation to cancel - */ -void -TALER_MERCHANT_patch_private_webhook_cancel ( - struct TALER_MERCHANT_PatchPrivateWebhookHandle *handle); - - -#endif /* _TALER_MERCHANT__PATCH_PRIVATE_WEBHOOKS_WEBHOOK_ID_H */ diff --git a/src/include/taler/taler-merchant/post-management-instances-INSTANCE-auth.h b/src/include/taler/taler-merchant/post-management-instances-INSTANCE-auth.h @@ -1,223 +0,0 @@ -/* - 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/post-management-instances-INSTANCE-auth.h - * @brief C interface for the POST /management/instances/$INSTANCE/auth endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_INSTANCE_AUTH_H -#define _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_INSTANCE_AUTH_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a POST /management/instances/$INSTANCE/auth request. - */ -struct TALER_MERCHANT_PostManagementInstancesAuthHandle; - - -/** - * Response details for a POST /management/instances/$INSTANCE/auth request. - */ -struct TALER_MERCHANT_PostManagementInstancesAuthResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - /** - * Details on #MHD_HTTP_ACCEPTED. - */ - struct TALER_MERCHANT_MfaChallengeResponse accepted; - } details; - -}; - - -/** - * Options for POST /management/instances/$INSTANCE/auth. - */ -enum TALER_MERCHANT_PostManagementInstancesAuthOption -{ - /** - * Sentinel value, end of options. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_END = 0, - - /** - * Set the authentication password. If not set (or set to NULL), - * the "external" authentication method is used. - * Value type: const char *. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_PASSWORD -}; - - -/** - * Value for a POST /management/instances/$INSTANCE/auth option. - */ -struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue -{ - /** - * Which option is being set. - */ - enum TALER_MERCHANT_PostManagementInstancesAuthOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_PASSWORD. - */ - const char *password; - - } details; -}; - - -/** - * Set password. - * - * @param pw password to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_auth_option_password(pw) \ - (const struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_PASSWORD, \ - .details.password = (pw) \ - } - - -/** - * Set up POST /management/instances/$INSTANCE/auth operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param instance_id identifier of the instance - * @return handle to operation - */ -struct TALER_MERCHANT_PostManagementInstancesAuthHandle * -TALER_MERCHANT_post_management_instances_auth_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id); - - -/** - * Set options for POST /management/instances/$INSTANCE/auth operation. - * - * @param[in,out] piah the handle to set options for - * @param num_options length of the @a options array - * @param options array of option values (terminated with _END) - */ -void -TALER_MERCHANT_post_management_instances_auth_set_options_ ( - struct TALER_MERCHANT_PostManagementInstancesAuthHandle *piah, - unsigned int num_options, - const struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue options[]); - - -/** - * Maximum number of options for set_options macro. - */ -#define TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTIONS_ARRAY_MAX_SIZE 4 - -/** - * Set options for POST /management/instances/$INSTANCE/auth operation. - * Variadic macro wrapper around - * #TALER_MERCHANT_post_management_instances_auth_set_options_(). - * - * @param piah the handle to set options for - * @param ... option values (automatically terminated with _END) - */ -#define TALER_MERCHANT_post_management_instances_auth_set_options(piah, ...) \ - do { \ - struct TALER_MERCHANT_PostManagementInstancesAuthOptionValue __opts[] = { \ - __VA_ARGS__, \ - { .option = TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_OPTION_END } \ - }; \ - TALER_MERCHANT_post_management_instances_auth_set_options_ ( \ - piah, \ - sizeof (__opts) / sizeof (__opts[0]) - 1, \ - __opts); \ - } while (0) - - -#ifndef TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostManagementInstancesAuthCallback. - */ -#define TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE */ - -/** - * Callback for a POST /management/instances/$INSTANCE/auth request. - * - * @param cls closure - * @param iar response details - */ -typedef void -(*TALER_MERCHANT_PostManagementInstancesAuthCallback)( - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostManagementInstancesAuthResponse *iar); - - -/** - * Start POST /management/instances/$INSTANCE/auth operation. - * - * @param[in,out] piah operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_management_instances_auth_start ( - struct TALER_MERCHANT_PostManagementInstancesAuthHandle *piah, - TALER_MERCHANT_PostManagementInstancesAuthCallback cb, - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_AUTH_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /management/instances/$INSTANCE/auth operation. This function - * must not be called by clients after the - * TALER_MERCHANT_PostManagementInstancesAuthCallback has been invoked (as in - * those cases it'll be called internally by the implementation already). - * - * @param[in] piah operation to cancel - */ -void -TALER_MERCHANT_post_management_instances_auth_cancel ( - struct TALER_MERCHANT_PostManagementInstancesAuthHandle *piah); - - -#endif /* _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_INSTANCE_AUTH_H */ diff --git a/src/include/taler/taler-merchant/post-management-instances.h b/src/include/taler/taler-merchant/post-management-instances.h @@ -1,452 +0,0 @@ -/* - 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/post-management-instances.h - * @brief C interface for the POST /management/instances endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_H -#define _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the POST /management/instances request. - */ -enum TALER_MERCHANT_PostManagementInstancesOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_END = 0, - - /** - * Set the default pay delay. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, - - /** - * Set the default refund delay. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, - - /** - * Set the default wire transfer delay. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, - - /** - * Set the default wire transfer rounding interval. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, - - /** - * Set the email address. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_EMAIL, - - /** - * Set the phone number. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, - - /** - * Set the website URL. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_WEBSITE, - - /** - * Set the logo. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_LOGO, - - /** - * Set the authentication password. - */ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_AUTH_PASSWORD - -}; - - -/** - * Value for an option for the POST /management/instances request. - */ -struct TALER_MERCHANT_PostManagementInstancesOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostManagementInstancesOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY. - */ - struct GNUNET_TIME_Relative default_pay_delay; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY. - */ - struct GNUNET_TIME_Relative default_refund_delay; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY. - */ - struct GNUNET_TIME_Relative default_wire_transfer_delay; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL. - */ - enum GNUNET_TIME_RounderInterval default_wire_transfer_rounding_interval; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_EMAIL. - */ - const char *email; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER. - */ - const char *phone_number; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_WEBSITE. - */ - const char *website; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_LOGO. - */ - const char *logo; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_AUTH_PASSWORD. - */ - const char *auth_password; - - } details; - -}; - - -/** - * Handle for a POST /management/instances request. - */ -struct TALER_MERCHANT_PostManagementInstancesHandle; - - -/** - * Response details for a POST /management/instances request. - */ -struct TALER_MERCHANT_PostManagementInstancesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - /** - * Details on #MHD_HTTP_ACCEPTED. - */ - struct TALER_MERCHANT_MfaChallengeResponse accepted; - } details; - -}; - - -/** - * Set up POST /management/instances operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param instance_id identifier for the new instance - * @param name human-readable name - * @param address address (JSON) - * @param jurisdiction jurisdiction (JSON) - * @param use_stefan whether to use the STEFAN curve for fee calculations - * @return handle to operation - */ -struct TALER_MERCHANT_PostManagementInstancesHandle * -TALER_MERCHANT_post_management_instances_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id, - const char *name, - const json_t *address, - const json_t *jurisdiction, - bool use_stefan); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PostManagementInstancesOptionValue - */ -#define TALER_MERCHANT_post_management_instances_option_end_() \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_END \ - } - -/** - * Set default pay delay. - * - * @param d delay to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_default_pay_delay(d) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_PAY_DELAY, \ - .details.default_pay_delay = (d) \ - } - -/** - * Set default refund delay. - * - * @param d delay to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_default_refund_delay(d) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_REFUND_DELAY, \ - .details.default_refund_delay = (d) \ - } - -/** - * Set default wire transfer delay. - * - * @param d delay to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_default_wire_transfer_delay(d) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_DELAY, \ - .details.default_wire_transfer_delay = (d) \ - } - -/** - * Set default wire transfer rounding interval. - * - * @param ri rounding interval to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_default_wire_transfer_rounding_interval(ri) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_DEFAULT_WIRE_TRANSFER_ROUNDING_INTERVAL, \ - .details.default_wire_transfer_rounding_interval = (ri) \ - } - -/** - * Set email address. - * - * @param e email to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_email(e) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_EMAIL, \ - .details.email = (e) \ - } - -/** - * Set phone number. - * - * @param p phone number to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_phone_number(p) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_PHONE_NUMBER, \ - .details.phone_number = (p) \ - } - -/** - * Set website URL. - * - * @param w website to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_website(w) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_WEBSITE, \ - .details.website = (w) \ - } - -/** - * Set logo. - * - * @param l logo to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_logo(l) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_LOGO, \ - .details.logo = (l) \ - } - -/** - * Set authentication password. - * - * @param pw password to set - * @return representation of the option - */ -#define TALER_MERCHANT_post_management_instances_option_auth_password(pw) \ - (const struct TALER_MERCHANT_PostManagementInstancesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_OPTION_AUTH_PASSWORD, \ - .details.auth_password = (pw) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param pmih the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_management_instances_set_options_ ( - struct TALER_MERCHANT_PostManagementInstancesHandle *pmih, - unsigned int num_options, - const struct TALER_MERCHANT_PostManagementInstancesOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_post_management_instances_set_options ( - * pmih, - * TALER_MERCHANT_post_management_instances_option_email ( - * "foo@example.com")); - * - * @param pmih the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_post_management_instances_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_management_instances_set_options(pmih,...) \ - TALER_MERCHANT_post_management_instances_set_options_ ( \ - pmih, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostManagementInstancesOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_management_instances_option_end_ () \ - } \ - )) - - -#ifndef TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostManagementInstancesCallback. - */ -#define TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE */ - -/** - * Callback for a POST /management/instances request. - * - * @param cls closure - * @param mir response details - */ -typedef void -(*TALER_MERCHANT_PostManagementInstancesCallback)( - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostManagementInstancesResponse *mir); - - -/** - * Start POST /management/instances operation. - * - * @param[in,out] pmih operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_management_instances_start ( - struct TALER_MERCHANT_PostManagementInstancesHandle *pmih, - TALER_MERCHANT_PostManagementInstancesCallback cb, - TALER_MERCHANT_POST_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /management/instances operation. This function must not be - * called by clients after the TALER_MERCHANT_PostManagementInstancesCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] pmih operation to cancel - */ -void -TALER_MERCHANT_post_management_instances_cancel ( - struct TALER_MERCHANT_PostManagementInstancesHandle *pmih); - - -#endif /* _TALER_MERCHANT__POST_MANAGEMENT_INSTANCES_H */ diff --git a/src/include/taler/taler-merchant/post-orders-ORDER_ID-abort.h b/src/include/taler/taler-merchant/post-orders-ORDER_ID-abort.h @@ -1,250 +0,0 @@ -/* - 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/post-orders-ORDER_ID-abort.h - * @brief C interface for the POST /orders/$ORDER_ID/abort endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_ABORT_H -#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_ABORT_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a POST /orders/$ORDER_ID/abort request. - */ -struct TALER_MERCHANT_PostOrdersAbortHandle; - - -/** - * One coin used in an abort request. - */ -struct TALER_MERCHANT_PostOrdersAbortCoin -{ - - /** - * Base URL of the exchange this coin was issued by. - */ - const char *exchange_url; - - /** - * Public key of the coin. - */ - struct TALER_CoinSpendPublicKeyP coin_pub; - - /** - * Total amount contributed including deposit fee. - */ - struct TALER_Amount amount_with_fee; - - /** - * Hash of the denomination public key. - */ - struct TALER_DenominationHashP denom_pub_hash; - - /** - * Denomination signature over the coin. - */ - struct TALER_DenominationSignature denom_sig; - - /** - * Amount contributed without the deposit fee. - */ - struct TALER_Amount contribution; - -}; - - -/** - * Result for one coin from an abort operation. - */ -struct TALER_MERCHANT_PostOrdersAbortedCoin -{ - - /** - * Exchange signature confirming the refund. - */ - struct TALER_ExchangeSignatureP exchange_sig; - - /** - * Exchange public key used for @e exchange_sig. - */ - struct TALER_ExchangePublicKeyP exchange_pub; - - /** - * Public key of the coin. - */ - struct TALER_CoinSpendPublicKeyP coin_pub; - -}; - - -/** - * Response details for a POST /orders/$ORDER_ID/abort request. - */ -struct TALER_MERCHANT_PostOrdersAbortResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of aborted coins in @a aborts. - */ - unsigned int num_aborts; - - /** - * Array of aborted coin results. - */ - const struct TALER_MERCHANT_PostOrdersAbortedCoin *aborts; - - } ok; - - /** - * Details on #MHD_HTTP_BAD_GATEWAY. - * The response body has the same refunds array as on - * #MHD_HTTP_OK, but at least one coin had an exchange error. - */ - struct - { - - /** - * Number of aborted coins in @a aborts. - */ - unsigned int num_aborts; - - /** - * Array of aborted coin results. - */ - const struct TALER_MERCHANT_PostOrdersAbortedCoin *aborts; - - } bad_gateway; - - /** - * Details on #MHD_HTTP_GATEWAY_TIMEOUT. - */ - struct - { - - /** - * Taler error code from the exchange, if available. - */ - enum TALER_ErrorCode exchange_ec; - - /** - * HTTP status code returned by the exchange, if available. - * 0 if no exchange was involved or the request timed out - * before a response was received. - */ - unsigned int exchange_http_status; - - } gateway_timeout; - - } details; - -}; - - -/** - * Set up POST /orders/$ORDER_ID/abort operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order to abort - * @param merchant_pub merchant public key - * @param h_contract hash of the contract terms - * @param num_coins number of coins in @a coins - * @param coins array of coins used in the aborted payment - * @return handle to operation - */ -struct TALER_MERCHANT_PostOrdersAbortHandle * -TALER_MERCHANT_post_orders_abort_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct TALER_PrivateContractHashP *h_contract, - unsigned int num_coins, - const struct TALER_MERCHANT_PostOrdersAbortCoin coins[static num_coins]); - - -#ifndef TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostOrdersAbortCallback. - */ -#define TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE */ - -/** - * Callback for a POST /orders/$ORDER_ID/abort request. - * - * @param cls closure - * @param oar response details - */ -typedef void -(*TALER_MERCHANT_PostOrdersAbortCallback)( - TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostOrdersAbortResponse *oar); - - -/** - * Start POST /orders/$ORDER_ID/abort operation. - * - * @param[in,out] poah operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_orders_abort_start ( - struct TALER_MERCHANT_PostOrdersAbortHandle *poah, - TALER_MERCHANT_PostOrdersAbortCallback cb, - TALER_MERCHANT_POST_ORDERS_ABORT_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /orders/$ORDER_ID/abort operation. This function must not be - * called by clients after the TALER_MERCHANT_PostOrdersAbortCallback has - * been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] poah operation to cancel - */ -void -TALER_MERCHANT_post_orders_abort_cancel ( - struct TALER_MERCHANT_PostOrdersAbortHandle *poah); - - -#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_ABORT_H */ diff --git a/src/include/taler/taler-merchant/post-orders-ORDER_ID-claim.h b/src/include/taler/taler-merchant/post-orders-ORDER_ID-claim.h @@ -1,252 +0,0 @@ -/* - 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/post-orders-ORDER_ID-claim.h - * @brief C interface for the POST /orders/$ORDER_ID/claim endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_CLAIM_H -#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_CLAIM_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /orders/$ORDER_ID/claim request. - */ -enum TALER_MERCHANT_PostOrdersClaimOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_END = 0, - - /** - * Claim token for the order. - */ - TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_TOKEN - -}; - - -/** - * Value for an option for the POST /orders/$ORDER_ID/claim request. - */ -struct TALER_MERCHANT_PostOrdersClaimOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostOrdersClaimOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_TOKEN. - */ - const struct TALER_ClaimTokenP *token; - - } details; - -}; - - -/** - * Handle for a POST /orders/$ORDER_ID/claim request. - */ -struct TALER_MERCHANT_PostOrdersClaimHandle; - - -/** - * Response details for a POST /orders/$ORDER_ID/claim request. - */ -struct TALER_MERCHANT_PostOrdersClaimResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * The claimed contract terms. - */ - const json_t *contract_terms; - - /** - * Hash of the contract terms. - */ - struct TALER_PrivateContractHashP h_contract_terms; - - /** - * Merchant signature over the contract terms. - */ - struct TALER_MerchantSignatureP merchant_sig; - - } ok; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PostOrdersClaimOptionValue - */ -#define TALER_MERCHANT_post_orders_claim_option_end_() \ - (const struct TALER_MERCHANT_PostOrdersClaimOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_END \ - } - -/** - * Set claim token. - * - * @param t claim token to use - * @return representation of the option as a struct TALER_MERCHANT_PostOrdersClaimOptionValue - */ -#define TALER_MERCHANT_post_orders_claim_option_token(t) \ - (const struct TALER_MERCHANT_PostOrdersClaimOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_CLAIM_OPTION_TOKEN, \ - .details.token = (t) \ - } - - -/** - * Set the requested options for the operation. - * - * @param poch the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_orders_claim_set_options_ ( - struct TALER_MERCHANT_PostOrdersClaimHandle *poch, - unsigned int num_options, - const struct TALER_MERCHANT_PostOrdersClaimOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param poch the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_orders_claim_set_options(poch,...) \ - TALER_MERCHANT_post_orders_claim_set_options_ ( \ - poch, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostOrdersClaimOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_orders_claim_option_end_ () } \ - )) - - -/** - * Set up POST /orders/$ORDER_ID/claim operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order to claim - * @param nonce wallet nonce for claiming - * @return handle to operation - */ -struct TALER_MERCHANT_PostOrdersClaimHandle * -TALER_MERCHANT_post_orders_claim_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - const struct GNUNET_CRYPTO_EddsaPublicKey *nonce); - - -#ifndef TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostOrdersClaimCallback. - */ -#define TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE */ - -/** - * Callback for a POST /orders/$ORDER_ID/claim request. - * - * @param cls closure - * @param ocr response details - */ -typedef void -(*TALER_MERCHANT_PostOrdersClaimCallback)( - TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostOrdersClaimResponse *ocr); - - -/** - * Start POST /orders/$ORDER_ID/claim operation. - * - * @param[in,out] poch operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_orders_claim_start ( - struct TALER_MERCHANT_PostOrdersClaimHandle *poch, - TALER_MERCHANT_PostOrdersClaimCallback cb, - TALER_MERCHANT_POST_ORDERS_CLAIM_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /orders/$ORDER_ID/claim operation. This function must not be - * called by clients after the TALER_MERCHANT_PostOrdersClaimCallback has - * been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] poch operation to cancel - */ -void -TALER_MERCHANT_post_orders_claim_cancel ( - struct TALER_MERCHANT_PostOrdersClaimHandle *poch); - - -#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_CLAIM_H */ diff --git a/src/include/taler/taler-merchant/post-orders-ORDER_ID-paid.h b/src/include/taler/taler-merchant/post-orders-ORDER_ID-paid.h @@ -1,227 +0,0 @@ -/* - 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/post-orders-ORDER_ID-paid.h - * @brief C interface for the POST /orders/$ORDER_ID/paid endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAID_H -#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /orders/$ORDER_ID/paid request. - */ -enum TALER_MERCHANT_PostOrdersPaidOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_ORDERS_PAID_OPTION_END = 0, - -}; - - -/** - * Value for an option for the POST /orders/$ORDER_ID/paid request. - */ -struct TALER_MERCHANT_PostOrdersPaidOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostOrdersPaidOption option; - - /** - * Specific option value. - */ - union - { - - } details; - -}; - - -/** - * Handle for a POST /orders/$ORDER_ID/paid request. - */ -struct TALER_MERCHANT_PostOrdersPaidHandle; - - -/** - * Response details for a POST /orders/$ORDER_ID/paid request. - */ -struct TALER_MERCHANT_PostOrdersPaidResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Response details depending on HTTP status. - */ - union - { - - /** - * Details if HTTP status is #MHD_HTTP_OK. - */ - struct - { - - /** - * POS confirmation string, or NULL if not available. - */ - const char *pos_confirmation; - - /** - * True if the order has been refunded. - */ - bool refunded; - - } ok; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PostOrdersPaidOptionValue - */ -#define TALER_MERCHANT_post_orders_paid_option_end_() \ - (const struct TALER_MERCHANT_PostOrdersPaidOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAID_OPTION_END \ - } - - -/** - * Set the requested options for the operation. - * - * @param poph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_orders_paid_set_options_ ( - struct TALER_MERCHANT_PostOrdersPaidHandle *poph, - unsigned int num_options, - const struct TALER_MERCHANT_PostOrdersPaidOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param poph the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_orders_paid_set_options(poph,...) \ - TALER_MERCHANT_post_orders_paid_set_options_ ( \ - poph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostOrdersPaidOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_orders_paid_option_end_ () } \ - )) - - -/** - * Set up POST /orders/$ORDER_ID/paid operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order - * @param session_id session identifier - * @param h_contract_terms hash of the contract terms - * @param merchant_sig merchant signature over the session data - * @return handle to operation - */ -struct TALER_MERCHANT_PostOrdersPaidHandle * -TALER_MERCHANT_post_orders_paid_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - const char *session_id, - const struct TALER_PrivateContractHashP *h_contract_terms, - const struct TALER_MerchantSignatureP *merchant_sig); - - -#ifndef TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostOrdersPaidCallback. - */ -#define TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE */ - -/** - * Callback for a POST /orders/$ORDER_ID/paid request. - * - * @param cls closure - * @param opr response details - */ -typedef void -(*TALER_MERCHANT_PostOrdersPaidCallback)( - TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostOrdersPaidResponse *opr); - - -/** - * Start POST /orders/$ORDER_ID/paid operation. - * - * @param[in,out] poph operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_orders_paid_start ( - struct TALER_MERCHANT_PostOrdersPaidHandle *poph, - TALER_MERCHANT_PostOrdersPaidCallback cb, - TALER_MERCHANT_POST_ORDERS_PAID_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /orders/$ORDER_ID/paid operation. This function must not be - * called by clients after the TALER_MERCHANT_PostOrdersPaidCallback has - * been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] poph operation to cancel - */ -void -TALER_MERCHANT_post_orders_paid_cancel ( - struct TALER_MERCHANT_PostOrdersPaidHandle *poph); - - -#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAID_H */ diff --git a/src/include/taler/taler-merchant/post-orders-ORDER_ID-pay.h b/src/include/taler/taler-merchant/post-orders-ORDER_ID-pay.h @@ -1,788 +0,0 @@ -/* - 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/post-orders-ORDER_ID-pay.h - * @brief C interface for the POST /orders/$ORDER_ID/pay endpoint - * @author Christian Grothoff - * @author Marcello Stanisci - */ -#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAY_H -#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAY_H - -#include <taler/taler-merchant/common.h> - -/** - * Forward-declaration here to keep the API stable even if - * the Donau header is not available. - */ -struct DONAU_BlindedUniqueDonorIdentifierKeyPair; - -/** - * One coin used to pay (frontend / external wallet mode). - */ -struct TALER_MERCHANT_PostOrdersPayPaidCoin -{ - - /** - * Denomination public key. - */ - struct TALER_DenominationPublicKey denom_pub; - - /** - * Hash of the denomination public key. - */ - struct TALER_DenominationHashP denom_pub_hash; - - /** - * Denomination signature over the coin. - */ - struct TALER_DenominationSignature denom_sig; - - /** - * Face value of the denomination. - */ - struct TALER_Amount denom_value; - - /** - * Public key of the coin. - */ - struct TALER_CoinSpendPublicKeyP coin_pub; - - /** - * Signature by the coin authorizing the deposit. - */ - struct TALER_CoinSpendSignatureP coin_sig; - - /** - * Hash of the age commitment for this coin. - */ - struct TALER_AgeCommitmentHashP h_age_commitment; - - /** - * Set to true if this coin has an age commitment. - */ - bool has_age_commitment; - - /** - * Total amount contributed including deposit fee. - */ - struct TALER_Amount amount_with_fee; - - /** - * Amount contributed without the deposit fee. - */ - struct TALER_Amount amount_without_fee; - - /** - * Deposit fee for this coin. - */ - struct TALER_Amount deposit_fee; - - /** - * Base URL of the exchange this coin was issued by. - */ - char *exchange_url; - -}; - - -/** - * One coin used to pay (wallet-internal mode, private key available). - */ -struct TALER_MERCHANT_PostOrdersPayCoin -{ - - /** - * Denomination public key. - */ - struct TALER_DenominationPublicKey denom_pub; - - /** - * Denomination signature over the coin. - */ - struct TALER_DenominationSignature denom_sig; - - /** - * Face value of the denomination. - */ - struct TALER_Amount denom_value; - - /** - * Private key of the coin (to sign the deposit). - */ - struct TALER_CoinSpendPrivateKeyP coin_priv; - - /** - * Hash of the age commitment for this coin, or - * all zeros if none. - */ - struct TALER_AgeCommitmentHashP h_age_commitment; - - /** - * Total amount contributed including deposit fee. - */ - struct TALER_Amount amount_with_fee; - - /** - * Amount contributed without the deposit fee. - */ - struct TALER_Amount amount_without_fee; - - /** - * URL of the exchange that issued @e coin_priv. - */ - char *exchange_url; - -}; - - -/** - * Token to use for payment (public form, already obtained). - */ -struct TALER_MERCHANT_PostOrdersPayUsedToken -{ - - /** - * Signature on TALER_TokenUseRequestPS made with the token use private key. - */ - struct TALER_TokenUseSignatureP token_sig; - - /** - * Public key of the token. - */ - struct TALER_TokenUsePublicKeyP token_pub; - - /** - * Unblinded signature made by the token issue public key of the merchant. - */ - struct TALER_TokenIssueSignature ub_sig; - - /** - * Token issue public key associated with this token. - */ - struct TALER_TokenIssuePublicKey issue_pub; - -}; - - -/** - * Information we need from the wallet to use a token for an order. - */ -struct TALER_MERCHANT_PostOrdersPayUseToken -{ - - /** - * Private key of the token (to sign the use authorization). - */ - struct TALER_TokenUsePrivateKeyP token_priv; - - /** - * Unblinded signature made by the token issue public key of the merchant. - */ - struct TALER_TokenIssueSignature ub_sig; - - /** - * Token issue public key associated with this token. - */ - struct TALER_TokenIssuePublicKey issue_pub; - -}; - - -/** - * Output token: used both as input to pay (envelope to be signed) - * and as output in the pay response (blind signature received). - */ -struct TALER_MERCHANT_PostOrdersPayOutputToken -{ - - /** - * Blinded token envelope to be signed by the issuer (input to pay). - */ - struct TALER_TokenEnvelope envelope; - - /** - * Blinded token issue signature received from the issuer (output of pay). - */ - struct TALER_BlindedTokenIssueSignature blinded_sig; - -}; - - -/** - * Possible options for the POST /orders/$ORDER_ID/pay request. - */ -enum TALER_MERCHANT_PostOrdersPayOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_END = 0, - - /** - * Session identifier for session-bound payments. - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_SESSION_ID, - - /** - * Wallet-specific data (JSON). - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_WALLET_DATA, - - /** - * Used tokens (public form, for frontend mode). - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USED_TOKENS, - - /** - * Use tokens (private form, for wallet mode). - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USE_TOKENS, - - /** - * Output tokens (for wallet mode). - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS, - - /** - * Output tokens as JSON array (for frontend mode). - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS_JSON, - - /** - * Output donation receipts. - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_DONAU, - - /** - * Payment choice index (wallet mode). - */ - TALER_MERCHANT_POST_ORDERS_PAY_OPTION_CHOICE_INDEX - -}; - - -/** - * Value for an option for the POST /orders/$ORDER_ID/pay request. - */ -struct TALER_MERCHANT_PostOrdersPayOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostOrdersPayOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_SESSION_ID. - */ - const char *session_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_WALLET_DATA. - */ - const json_t *wallet_data; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USED_TOKENS. - */ - struct - { - /** - * Length of @e tokens array - */ - unsigned int num; - const struct TALER_MERCHANT_PostOrdersPayUsedToken *tokens; - } used_tokens; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USE_TOKENS. - */ - struct - { - /** - * Length of @e tokens array - */ - unsigned int num; - const struct TALER_MERCHANT_PostOrdersPayUseToken *tokens; - } use_tokens; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS. - */ - struct - { - /** - * Length of @e tokens array - */ - unsigned int num; - const struct TALER_MERCHANT_PostOrdersPayOutputToken *tokens; - } output_tokens; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS_JSON. - */ - json_t *output_tokens_json; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_DONAU. - */ - struct - { - /** - * Base URL of the donau. - */ - const char *donau_base_url; - - /** - * Array of blinded dontation receipts. - */ - const struct DONAU_BlindedUniqueDonorIdentifierKeyPair *bkps; - - /** - * Length of @e bkps array - */ - size_t num_bkps; - - /** - * Year for which the donation receipts are issued. - */ - uint64_t year; - } output_donau; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_ORDERS_PAY_OPTION_CHOICE_INDEX. - */ - int choice_index; - - } details; - -}; - - -/** - * Handle for a POST /orders/$ORDER_ID/pay request. - */ -struct TALER_MERCHANT_PostOrdersPayHandle; - - -/** - * Response details for a POST /orders/$ORDER_ID/pay request. - */ -struct TALER_MERCHANT_PostOrdersPayResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Merchant signature confirming the payment. - */ - struct TALER_MerchantSignatureP merchant_sig; - - /** - * POS confirmation string, or NULL if not applicable. - */ - const char *pos_confirmation; - - /** - * Number of output tokens in @a tokens. - */ - unsigned int num_tokens; - - /** - * Array of output tokens issued upon payment. - */ - struct TALER_MERCHANT_PostOrdersPayOutputToken *tokens; - - } ok; - - /** - * Details on #MHD_HTTP_CONFLICT. - * Set when a coin was already spent (insufficient funds) or - * the order was already fully paid. - */ - struct - { - - /** - * Base URL of the exchange that reported the conflict, - * or NULL if not applicable. - */ - const char *exchange_url; - - /** - * Taler error code from the exchange, if available. - */ - enum TALER_ErrorCode exchange_ec; - - /** - * HTTP status code returned by the exchange, if available. - */ - unsigned int exchange_http_status; - - } conflict; - - /** - * Details on #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. - */ - struct - { - - /** - * Number of exchange URLs in @a exchanges. - */ - unsigned int num_exchanges; - - /** - * Array of exchange URLs that refused the payment for legal reasons. - */ - const char **exchanges; - - } unavailable_for_legal_reasons; - - /** - * Details on #MHD_HTTP_BAD_GATEWAY. - * The merchant's interaction with the exchange failed. - */ - struct - { - - /** - * Base URL of the exchange that returned an error, - * or NULL if not available. - */ - const char *exchange_url; - - /** - * Taler error code from the exchange, if available. - */ - enum TALER_ErrorCode exchange_ec; - - /** - * HTTP status code returned by the exchange, if available. - */ - unsigned int exchange_http_status; - - } bad_gateway; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_orders_pay_option_end_() \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_END \ - } - -/** - * Set session identifier. - * - * @param s session ID - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_session_id(s) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_SESSION_ID, \ - .details.session_id = (s) \ - } - -/** - * Set wallet-specific data. - * - * @param w wallet data JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_wallet_data(w) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_WALLET_DATA, \ - .details.wallet_data = (w) \ - } - -/** - * Set used tokens (public form, for frontend mode). - * - * @param n number of tokens - * @param t array of used tokens - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_used_tokens(n,t) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USED_TOKENS, \ - .details.used_tokens = { .num = (n), .tokens = (t) } \ - } - -/** - * Set use tokens (private form, for wallet mode). - * - * @param n number of tokens - * @param t array of use tokens - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_use_tokens(n,t) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_USE_TOKENS, \ - .details.use_tokens = { .num = (n), .tokens = (t) } \ - } - -/** - * Set output tokens (for wallet mode). - * - * @param n number of output tokens - * @param t array of output tokens - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_output_tokens(n,t) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS, \ - .details.output_tokens = { .num = (n), .tokens = (t) } \ - } - -/** - * Set output tokens as JSON array (for frontend mode). - * - * @param j JSON array describing desired output tokens - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_output_tokens_json(j) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_TOKENS_JSON, \ - .details.output_tokens_json = (j) \ - } - - -/** - * Set blinded donation receipts as output. - * - * @param u base URL of the selected Donau - * @param y year for which receipts are requested - * @param l length of the @a bkps array - * @param a array of blinded donation receipts - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_output_donau(u,y,l,a) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_OUTPUT_DONAU, \ - .details.output_donau.donau_base_url = (u), \ - .details.output_donau.bkps = (a), \ - .details.output_donau.num_bkps = (l), \ - .details.output_donau.year = (y) \ - } - -/** - * Set payment choice index (wallet mode). - * Use -1 to indicate no choice (the default). - * - * @param i choice index - * @return representation of the option - */ -#define TALER_MERCHANT_post_orders_pay_option_choice_index(i) \ - (const struct TALER_MERCHANT_PostOrdersPayOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_ORDERS_PAY_OPTION_CHOICE_INDEX, \ - .details.choice_index = (i) \ - } - - -/** - * Set the requested options for the operation. - * - * @param poph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_orders_pay_set_options_ ( - struct TALER_MERCHANT_PostOrdersPayHandle *poph, - unsigned int num_options, - const struct TALER_MERCHANT_PostOrdersPayOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param poph the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_orders_pay_set_options(poph,...) \ - TALER_MERCHANT_post_orders_pay_set_options_ ( \ - poph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostOrdersPayOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_orders_pay_option_end_ () } \ - )) - - -/** - * Set up POST /orders/$ORDER_ID/pay operation in frontend mode - * (coins already signed by the wallet). - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order to pay - * @param num_coins number of coins in @a coins - * @param coins array of coins to pay with (already signed) - * @return handle to operation - */ -struct TALER_MERCHANT_PostOrdersPayHandle * -TALER_MERCHANT_post_orders_pay_frontend_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - unsigned int num_coins, - const struct TALER_MERCHANT_PostOrdersPayPaidCoin coins[static num_coins]); - - -/** - * Set up POST /orders/$ORDER_ID/pay operation in wallet-internal mode - * (signing done internally). - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order to pay - * @param h_contract_terms hash of the contract terms - * @param amount total payment amount - * @param max_fee maximum acceptable fee - * @param merchant_pub merchant public key - * @param merchant_sig merchant signature - * @param timestamp contract timestamp - * @param refund_deadline refund deadline - * @param pay_deadline payment deadline - * @param h_wire hash of the merchant wire details - * @param num_coins number of coins in @a coins - * @param coins array of coins with private keys - * @return handle to operation - */ -struct TALER_MERCHANT_PostOrdersPayHandle * -TALER_MERCHANT_post_orders_pay_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - const struct TALER_PrivateContractHashP *h_contract_terms, - const struct TALER_Amount *amount, - const struct TALER_Amount *max_fee, - const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct TALER_MerchantSignatureP *merchant_sig, - struct GNUNET_TIME_Timestamp timestamp, - struct GNUNET_TIME_Timestamp refund_deadline, - struct GNUNET_TIME_Timestamp pay_deadline, - const struct TALER_MerchantWireHashP *h_wire, - unsigned int num_coins, - const struct TALER_MERCHANT_PostOrdersPayCoin coins[static num_coins]); - - -#ifndef TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostOrdersPayCallback. - */ -#define TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE */ - -/** - * Callback for a POST /orders/$ORDER_ID/pay request. - * - * @param cls closure - * @param opr response details - */ -typedef void -(*TALER_MERCHANT_PostOrdersPayCallback)( - TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostOrdersPayResponse *opr); - - -/** - * Start POST /orders/$ORDER_ID/pay operation. - * - * @param[in,out] poph operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_orders_pay_start ( - struct TALER_MERCHANT_PostOrdersPayHandle *poph, - TALER_MERCHANT_PostOrdersPayCallback cb, - TALER_MERCHANT_POST_ORDERS_PAY_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /orders/$ORDER_ID/pay operation. This function must not be - * called by clients after the TALER_MERCHANT_PostOrdersPayCallback has - * been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] poph operation to cancel - */ -void -TALER_MERCHANT_post_orders_pay_cancel ( - struct TALER_MERCHANT_PostOrdersPayHandle *poph); - - -#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_PAY_H */ diff --git a/src/include/taler/taler-merchant/post-orders-ORDER_ID-refund.h b/src/include/taler/taler-merchant/post-orders-ORDER_ID-refund.h @@ -1,221 +0,0 @@ -/* - 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/post-orders-ORDER_ID-refund.h - * @brief C interface for the POST /orders/$ORDER_ID/refund endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_ORDERS_ORDER_ID_REFUND_H -#define _TALER_MERCHANT__POST_ORDERS_ORDER_ID_REFUND_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a POST /orders/$ORDER_ID/refund request. - */ -struct TALER_MERCHANT_PostOrdersRefundHandle; - - -/** - * Details about one refund from the exchange. - */ -struct TALER_MERCHANT_PostOrdersRefundDetail -{ - - /** - * Exchange signature confirming the refund. - */ - struct TALER_ExchangeSignatureP exchange_sig; - - /** - * Exchange public key used for @e exchange_sig. - */ - struct TALER_ExchangePublicKeyP exchange_pub; - - /** - * Hash of the contract terms. - */ - struct TALER_PrivateContractHashP h_contract_terms; - - /** - * Merchant public key. - */ - struct TALER_MerchantPublicKeyP merchant_pub; - - /** - * Refund transaction ID. - */ - uint64_t rtransaction_id; - - /** - * Public key of the refunded coin. - */ - struct TALER_CoinSpendPublicKeyP coin_pub; - - /** - * Refund amount. - */ - struct TALER_Amount refund_amount; - - /** - * Refund fee charged by the exchange. - */ - struct TALER_Amount refund_fee; - - /** - * HTTP status returned by the exchange for this refund, 0 if not yet - * obtained. - */ - unsigned int exchange_http_status; - - /** - * Taler error code returned by the exchange. - */ - enum TALER_ErrorCode ec; - - /** - * Full exchange reply (JSON), or NULL. - */ - const json_t *exchange_reply; - - /** - * HTTP response details from the exchange. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Response details for a POST /orders/$ORDER_ID/refund request. - */ -struct TALER_MERCHANT_PostOrdersRefundResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Number of refund details in @a refunds. - */ - unsigned int num_refunds; - - /** - * Array of refund details. - */ - const struct TALER_MERCHANT_PostOrdersRefundDetail *refunds; - - /** - * Total effective refund amount. - */ - struct TALER_Amount refund_amount; - - /** - * Merchant public key. - */ - struct TALER_MerchantPublicKeyP merchant_pub; - - } ok; - - } details; - -}; - - -/** - * Set up POST /orders/$ORDER_ID/refund operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order - * @param h_contract_terms hash of the contract terms - * @return handle to operation - */ -struct TALER_MERCHANT_PostOrdersRefundHandle * -TALER_MERCHANT_post_orders_refund_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - const struct TALER_PrivateContractHashP *h_contract_terms); - - -#ifndef TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostOrdersRefundCallback. - */ -#define TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE */ - -/** - * Callback for a POST /orders/$ORDER_ID/refund request. - * - * @param cls closure - * @param orr response details - */ -typedef void -(*TALER_MERCHANT_PostOrdersRefundCallback)( - TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostOrdersRefundResponse *orr); - - -/** - * Start POST /orders/$ORDER_ID/refund operation. - * - * @param[in,out] porh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_orders_refund_start ( - struct TALER_MERCHANT_PostOrdersRefundHandle *porh, - TALER_MERCHANT_PostOrdersRefundCallback cb, - TALER_MERCHANT_POST_ORDERS_REFUND_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /orders/$ORDER_ID/refund operation. This function must not be - * called by clients after the TALER_MERCHANT_PostOrdersRefundCallback has - * been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] porh operation to cancel - */ -void -TALER_MERCHANT_post_orders_refund_cancel ( - struct TALER_MERCHANT_PostOrdersRefundHandle *porh); - - -#endif /* _TALER_MERCHANT__POST_ORDERS_ORDER_ID_REFUND_H */ diff --git a/src/include/taler/taler-merchant/post-private-accounts.h b/src/include/taler/taler-merchant/post-private-accounts.h @@ -1,301 +0,0 @@ -/* - 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/post-private-accounts.h - * @brief C interface for the POST /private/accounts endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_ACCOUNTS_H -#define _TALER_MERCHANT__POST_PRIVATE_ACCOUNTS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /private/accounts request. - */ -enum TALER_MERCHANT_PostPrivateAccountsOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_END = 0, - - /** - * URL of the credit facade. - */ - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_URL, - - /** - * Credentials for the credit facade (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_CREDENTIALS, - - /** - * Extra wire subject metadata (restricted text). - */ - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_EXTRA_WIRE_SUBJECT_METADATA - -}; - - -/** - * Value for an option for the POST /private/accounts request. - */ -struct TALER_MERCHANT_PostPrivateAccountsOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateAccountsOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_URL. - */ - const char *credit_facade_url; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_CREDENTIALS. - */ - const json_t *credit_facade_credentials; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_EXTRA_WIRE_SUBJECT_METADATA. - */ - const char *extra_wire_subject_metadata; - - } details; - -}; - - -/** - * Handle for a POST /private/accounts request. - */ -struct TALER_MERCHANT_PostPrivateAccountsHandle; - - -/** - * Response details for a POST /private/accounts request. - */ -struct TALER_MERCHANT_PostPrivateAccountsResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Hash of the wire details for the newly created account. - */ - struct TALER_MerchantWireHashP h_wire; - - /** - * Salt used in the wire hash computation. - */ - struct TALER_WireSaltP salt; - - } ok; - - /** - * Details on #MHD_HTTP_ACCEPTED. - */ - struct TALER_MERCHANT_MfaChallengeResponse accepted; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PostPrivateAccountsOptionValue - */ -#define TALER_MERCHANT_post_private_accounts_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_END \ - } - -/** - * Set credit facade URL. - * - * @param u credit facade URL - * @return representation of the option as a struct TALER_MERCHANT_PostPrivateAccountsOptionValue - */ -#define TALER_MERCHANT_post_private_accounts_option_credit_facade_url(u) \ - (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_URL, \ - .details.credit_facade_url = (u) \ - } - -/** - * Set credit facade credentials. - * - * @param c credentials JSON object - * @return representation of the option as a struct TALER_MERCHANT_PostPrivateAccountsOptionValue - */ -#define TALER_MERCHANT_post_private_accounts_option_credit_facade_credentials(c) \ - (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_CREDIT_FACADE_CREDENTIALS, \ - .details.credit_facade_credentials = (c) \ - } - -/** - * Set extra wire subject metadata. - * - * @param m extra wire subject metadata (JSON) - * @return representation of the option as a struct TALER_MERCHANT_PostPrivateAccountsOptionValue - */ -#define TALER_MERCHANT_post_private_accounts_option_extra_wire_subject_metadata(m) \ - (const struct TALER_MERCHANT_PostPrivateAccountsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_OPTION_EXTRA_WIRE_SUBJECT_METADATA, \ - .details.extra_wire_subject_metadata = (m) \ - } - - -/** - * Set the requested options for the operation. - * - * @param ppah the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_accounts_set_options_ ( - struct TALER_MERCHANT_PostPrivateAccountsHandle *ppah, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateAccountsOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppah the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_accounts_set_options(ppah,...) \ - TALER_MERCHANT_post_private_accounts_set_options_ ( \ - ppah, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateAccountsOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_accounts_option_end_ () } \ - )) - - -/** - * Set up POST /private/accounts operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param payto_uri payto URI of the account to add - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateAccountsHandle * -TALER_MERCHANT_post_private_accounts_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - struct TALER_FullPayto payto_uri); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateAccountsCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/accounts request. - * - * @param cls closure - * @param apr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateAccountsCallback)( - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateAccountsResponse *apr); - - -/** - * Start POST /private/accounts operation. - * - * @param[in,out] ppah operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_accounts_start ( - struct TALER_MERCHANT_PostPrivateAccountsHandle *ppah, - TALER_MERCHANT_PostPrivateAccountsCallback cb, - TALER_MERCHANT_POST_PRIVATE_ACCOUNTS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/accounts operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateAccountsCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppah operation to cancel - */ -void -TALER_MERCHANT_post_private_accounts_cancel ( - struct TALER_MERCHANT_PostPrivateAccountsHandle *ppah); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_ACCOUNTS_H */ diff --git a/src/include/taler/taler-merchant/post-private-categories.h b/src/include/taler/taler-merchant/post-private-categories.h @@ -1,240 +0,0 @@ -/* - 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/post-private-categories.h - * @brief C interface for the POST /private/categories endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_CATEGORIES_H -#define _TALER_MERCHANT__POST_PRIVATE_CATEGORIES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /private/categories request. - */ -enum TALER_MERCHANT_PostPrivateCategoriesOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_END = 0, - - /** - * Internationalized names (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_NAME_I18N - -}; - - -/** - * Value for an option for the POST /private/categories request. - */ -struct TALER_MERCHANT_PostPrivateCategoriesOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateCategoriesOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_NAME_I18N. - */ - const json_t *name_i18n; - - } details; - -}; - - -/** - * Handle for a POST /private/categories request. - */ -struct TALER_MERCHANT_PostPrivateCategoriesHandle; - - -/** - * Response details for a POST /private/categories request. - */ -struct TALER_MERCHANT_PostPrivateCategoriesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Numeric identifier of the newly created category. - */ - uint64_t category_id; - - } ok; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_categories_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_END \ - } - -/** - * Set internationalized names. - * - * @param n names JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_categories_option_name_i18n(n) \ - (const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_CATEGORIES_OPTION_NAME_I18N, \ - .details.name_i18n = (n) \ - } - - -/** - * Set the requested options for the operation. - * - * @param ppch the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_categories_set_options_ ( - struct TALER_MERCHANT_PostPrivateCategoriesHandle *ppch, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppch the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_categories_set_options(ppch,...) \ - TALER_MERCHANT_post_private_categories_set_options_ ( \ - ppch, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateCategoriesOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_categories_option_end_ () } \ - )) - - -/** - * Set up POST /private/categories operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param name human-readable name of the category - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateCategoriesHandle * -TALER_MERCHANT_post_private_categories_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *name); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateCategoriesCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/categories request. - * - * @param cls closure - * @param cpr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateCategoriesCallback)( - TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateCategoriesResponse *cpr); - - -/** - * Start POST /private/categories operation. - * - * @param[in,out] ppch operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_categories_start ( - struct TALER_MERCHANT_PostPrivateCategoriesHandle *ppch, - TALER_MERCHANT_PostPrivateCategoriesCallback cb, - TALER_MERCHANT_POST_PRIVATE_CATEGORIES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/categories operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateCategoriesCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppch operation to cancel - */ -void -TALER_MERCHANT_post_private_categories_cancel ( - struct TALER_MERCHANT_PostPrivateCategoriesHandle *ppch); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_CATEGORIES_H */ diff --git a/src/include/taler/taler-merchant/post-private-donau.h b/src/include/taler/taler-merchant/post-private-donau.h @@ -1,224 +0,0 @@ -/* - 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/post-private-donau.h - * @brief C interface for the POST /private/donau endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_DONAU_H -#define _TALER_MERCHANT__POST_PRIVATE_DONAU_H - -#include <taler/taler-merchant/common.h> - - -/** - * Donau charity structure for POST /private/donau. - */ -struct TALER_MERCHANT_Charity -{ - - /** - * Base URL of the Donau/charity service. - */ - const char *charity_url; - - /** - * Charity identifier at the Donau service. - */ - uint64_t charity_id; - -}; - - -/** - * Possible options for the POST /private/donau request. - */ -enum TALER_MERCHANT_PostPrivateDonauOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_END = 0, - -}; - - -/** - * Value for an option for the POST /private/donau request. - */ -struct TALER_MERCHANT_PostPrivateDonauOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateDonauOption option; - - /** - * Specific option value. - */ - union - { - - } details; - -}; - - -/** - * Handle for a POST /private/donau request. - */ -struct TALER_MERCHANT_PostPrivateDonauHandle; - - -/** - * Response details for a POST /private/donau request. - */ -struct TALER_MERCHANT_PostPrivateDonauResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - /** - * Details on #MHD_HTTP_ACCEPTED. - */ - struct TALER_MERCHANT_MfaChallengeResponse accepted; - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_donau_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateDonauOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_END \ - } - -/** - * Set the requested options for the operation. - * - * @param ppdh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_donau_set_options_ ( - struct TALER_MERCHANT_PostPrivateDonauHandle *ppdh, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateDonauOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppdh the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_donau_set_options(ppdh,...) \ - TALER_MERCHANT_post_private_donau_set_options_ ( \ - ppdh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateDonauOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_donau_option_end_ () } \ - )) - - -/** - * Set up POST /private/donau operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param charity charity information to register - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateDonauHandle * -TALER_MERCHANT_post_private_donau_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_MERCHANT_Charity *charity); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateDonauCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/donau request. - * - * @param cls closure - * @param pdr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateDonauCallback)( - TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateDonauResponse *pdr); - - -/** - * Start POST /private/donau operation. - * - * @param[in,out] ppdh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_donau_start ( - struct TALER_MERCHANT_PostPrivateDonauHandle *ppdh, - TALER_MERCHANT_PostPrivateDonauCallback cb, - TALER_MERCHANT_POST_PRIVATE_DONAU_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/donau operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateDonauCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppdh operation to cancel - */ -void -TALER_MERCHANT_post_private_donau_cancel ( - struct TALER_MERCHANT_PostPrivateDonauHandle *ppdh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_DONAU_H */ diff --git a/src/include/taler/taler-merchant/post-private-orders-ORDER_ID-refund.h b/src/include/taler/taler-merchant/post-private-orders-ORDER_ID-refund.h @@ -1,143 +0,0 @@ -/* - 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/post-private-orders-ORDER_ID-refund.h - * @brief C interface for the POST /private/orders/$ORDER_ID/refund endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_ORDERS_ORDER_ID_REFUND_H -#define _TALER_MERCHANT__POST_PRIVATE_ORDERS_ORDER_ID_REFUND_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a POST /private/orders/$ORDER_ID/refund request. - */ -struct TALER_MERCHANT_PostPrivateOrdersRefundHandle; - - -/** - * Response details for a POST /private/orders/$ORDER_ID/refund request. - */ -struct TALER_MERCHANT_PostPrivateOrdersRefundResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Taler refund URI for the wallet. - */ - const char *taler_refund_uri; - - /** - * Hash of the contract terms for this order. - */ - struct TALER_PrivateContractHashP h_contract; - - } ok; - - } details; - -}; - - -/** - * Set up POST /private/orders/$ORDER_ID/refund operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order_id identifier of the order to refund - * @param refund amount to refund - * @param reason human-readable reason for the refund - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateOrdersRefundHandle * -TALER_MERCHANT_post_private_orders_refund_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *order_id, - const struct TALER_Amount *refund, - const char *reason); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateOrdersRefundCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/orders/$ORDER_ID/refund request. - * - * @param cls closure - * @param rr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateOrdersRefundCallback)( - TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateOrdersRefundResponse *rr); - - -/** - * Start POST /private/orders/$ORDER_ID/refund operation. - * - * @param[in,out] porh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_orders_refund_start ( - struct TALER_MERCHANT_PostPrivateOrdersRefundHandle *porh, - TALER_MERCHANT_PostPrivateOrdersRefundCallback cb, - TALER_MERCHANT_POST_PRIVATE_ORDERS_REFUND_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/orders/$ORDER_ID/refund operation. This function - * must not be called by clients after the - * TALER_MERCHANT_PostPrivateOrdersRefundCallback has been invoked (as in - * those cases it'll be called internally by the implementation already). - * - * @param[in] porh operation to cancel - */ -void -TALER_MERCHANT_post_private_orders_refund_cancel ( - struct TALER_MERCHANT_PostPrivateOrdersRefundHandle *porh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_ORDERS_ORDER_ID_REFUND_H */ diff --git a/src/include/taler/taler-merchant/post-private-orders.h b/src/include/taler/taler-merchant/post-private-orders.h @@ -1,536 +0,0 @@ -/* - 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/post-private-orders.h - * @brief C interface for the POST /private/orders endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_ORDERS_H -#define _TALER_MERCHANT__POST_PRIVATE_ORDERS_H - -#include <taler/taler-merchant/common.h> - - -/** - * A product from inventory to include in an order. - */ -struct TALER_MERCHANT_PostPrivateOrdersInventoryProduct -{ - - /** - * Identifier of the product. - */ - const char *product_id; - - /** - * Quantity of the product to include. - */ - uint32_t quantity; - - /** - * Fractional part of the quantity. - */ - uint32_t quantity_frac; - - /** - * Money pot to use for this product, overrides value from - * the inventory if given. -1 if not set. - * @since protocol v25. - */ - int32_t product_money_pot; - - /** - * Whether to use fractional quantity. - */ - bool use_fractional_quantity; - -}; - - -/** - * Possible options for the POST /private/orders request. - */ -enum TALER_MERCHANT_PostPrivateOrdersOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_END = 0, - - /** - * Refund delay. - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_REFUND_DELAY, - - /** - * Payment target (type of payment method). - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_PAYMENT_TARGET, - - /** - * Session identifier for session-bound payments. - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_SESSION_ID, - - /** - * Whether to create a claim token. - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_CREATE_TOKEN, - - /** - * OTP device ID. - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_OTP_ID, - - /** - * Inventory products to include in the order. - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_INVENTORY_PRODUCTS, - - /** - * Lock UUIDs for inventory locks. - */ - TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_LOCK_UUIDS - -}; - - -/** - * Value for an option for the POST /private/orders request. - */ -struct TALER_MERCHANT_PostPrivateOrdersOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateOrdersOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_REFUND_DELAY. - */ - struct GNUNET_TIME_Relative refund_delay; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_PAYMENT_TARGET. - */ - const char *payment_target; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_SESSION_ID. - */ - const char *session_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_CREATE_TOKEN. - */ - bool create_token; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_OTP_ID. - */ - const char *otp_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_INVENTORY_PRODUCTS. - */ - struct - { - unsigned int num; - const struct TALER_MERCHANT_PostPrivateOrdersInventoryProduct *products; - } inventory_products; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_LOCK_UUIDS. - */ - struct - { - unsigned int num; - const char **uuids; - } lock_uuids; - - } details; - -}; - - -/** - * Handle for a POST /private/orders request. - */ -struct TALER_MERCHANT_PostPrivateOrdersHandle; - - -/** - * Detail about why a specific exchange was rejected when - * creating an order. - */ -struct TALER_MERCHANT_ExchangeRejectionDetail -{ - - /** - * Base URL of the rejected exchange. - */ - const char *exchange_url; - - /** - * Error code indicating why this exchange was not acceptable. - */ - enum TALER_ErrorCode code; - - /** - * Human-readable hint about the error, or NULL. - */ - const char *hint; - -}; - - -/** - * Response details for a POST /private/orders request. - */ -struct TALER_MERCHANT_PostPrivateOrdersResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Identifier of the created order. - */ - const char *order_id; - - /** - * Claim token, or NULL. - */ - const struct TALER_ClaimTokenP *token; - - /** - * Payment deadline. - */ - struct GNUNET_TIME_Timestamp pay_deadline; - - } ok; - - /** - * Details on #MHD_HTTP_GONE (product out of stock). - */ - struct - { - - /** - * Product that is out of stock. - */ - const char *product_id; - - /** - * Requested quantity (integer part). - */ - uint64_t requested_quantity; - - /** - * Requested quantity (fractional part). - */ - uint32_t requested_quantity_frac; - - /** - * Available quantity (integer part). - */ - uint64_t available_quantity; - - /** - * Available quantity (fractional part). - */ - uint32_t available_quantity_frac; - - /** - * Requested quantity as string in "<integer>[.<fraction>]" format, - * or NULL if not provided. - */ - const char *unit_requested_quantity; - - /** - * Available quantity as string in "<integer>[.<fraction>]" format, - * or NULL if not provided. - */ - const char *unit_available_quantity; - - /** - * Expected restock time. - */ - struct GNUNET_TIME_Timestamp restock_expected; - - } gone; - - /** - * Details on #MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS. - * @since protocol v25. - */ - struct - { - - /** - * Number of entries in @a exchange_rejections. - */ - unsigned int num_exchange_rejections; - - /** - * Array of exchange rejection details. - */ - const struct TALER_MERCHANT_ExchangeRejectionDetail - *exchange_rejections; - - } unavailable_for_legal_reasons; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_orders_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_END \ - } - -/** - * Set refund delay. - * - * @param d refund delay - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_orders_option_refund_delay(d) \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_REFUND_DELAY, \ - .details.refund_delay = (d) \ - } - -/** - * Set payment target. - * - * @param t payment target string - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_orders_option_payment_target(t) \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_PAYMENT_TARGET, \ - .details.payment_target = (t) \ - } - -/** - * Set session identifier. - * - * @param s session ID - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_orders_option_session_id(s) \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_SESSION_ID, \ - .details.session_id = (s) \ - } - -/** - * Set whether to create a claim token. - * - * @param c true to create token, false to disable - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_orders_option_create_token(c) \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_CREATE_TOKEN, \ - .details.create_token = (c) \ - } - -/** - * Set OTP device ID. - * - * @param o OTP device ID - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_orders_option_otp_id(o) \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_OTP_ID, \ - .details.otp_id = (o) \ - } - -/** - * Set inventory products. - * - * @param n number of products - * @param p array of inventory products - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_orders_option_inventory_products(n,p) \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_INVENTORY_PRODUCTS \ - , \ - .details.inventory_products = { .num = (n), .products = (p) } \ - } - -/** - * Set lock UUIDs. - * - * @param n number of UUIDs - * @param u array of UUID strings - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_orders_option_lock_uuids(n,u) \ - (const struct TALER_MERCHANT_PostPrivateOrdersOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_ORDERS_OPTION_LOCK_UUIDS, \ - .details.lock_uuids = { .num = (n), .uuids = (u) } \ - } - - -/** - * Set the requested options for the operation. - * - * @param ppoh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_orders_set_options_ ( - struct TALER_MERCHANT_PostPrivateOrdersHandle *ppoh, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateOrdersOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppoh the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_orders_set_options(ppoh,...) \ - TALER_MERCHANT_post_private_orders_set_options_ ( \ - ppoh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateOrdersOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_orders_option_end_ () } \ - )) - - -/** - * Set up POST /private/orders operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param order order contract (JSON) - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateOrdersHandle * -TALER_MERCHANT_post_private_orders_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const json_t *order); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateOrdersCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/orders request. - * - * @param cls closure - * @param por response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateOrdersCallback)( - TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateOrdersResponse *por); - - -/** - * Start POST /private/orders operation. - * - * @param[in,out] ppoh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_orders_start ( - struct TALER_MERCHANT_PostPrivateOrdersHandle *ppoh, - TALER_MERCHANT_PostPrivateOrdersCallback cb, - TALER_MERCHANT_POST_PRIVATE_ORDERS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/orders operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateOrdersCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppoh operation to cancel - */ -void -TALER_MERCHANT_post_private_orders_cancel ( - struct TALER_MERCHANT_PostPrivateOrdersHandle *ppoh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_ORDERS_H */ diff --git a/src/include/taler/taler-merchant/post-private-otp-devices.h b/src/include/taler/taler-merchant/post-private-otp-devices.h @@ -1,238 +0,0 @@ -/* - 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/post-private-otp-devices.h - * @brief C interface for the POST /private/otp-devices endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_OTP_DEVICES_H -#define _TALER_MERCHANT__POST_PRIVATE_OTP_DEVICES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a POST /private/otp-devices request. - */ -struct TALER_MERCHANT_PostPrivateOtpDevicesHandle; - - -/** - * Response details for a POST /private/otp-devices request. - */ -struct TALER_MERCHANT_PostPrivateOtpDevicesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Possible options we can set for the POST /private/otp-devices request. - */ -enum TALER_MERCHANT_PostPrivateOtpDevicesOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_END = 0, - - /** - * Set the initial OTP counter value (for HOTP). - */ - TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_OTP_CTR - -}; - - -/** - * Value for an option for the POST /private/otp-devices request. - */ -struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateOtpDevicesOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_OTP_CTR. - */ - uint64_t otp_ctr; - - } details; - -}; - - -/** - * Set up POST /private/otp-devices operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param otp_device_id identifier for the new OTP device - * @param otp_device_description human-readable description - * @param otp_key base32-encoded OTP secret key - * @param otp_algorithm OTP algorithm to use - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateOtpDevicesHandle * -TALER_MERCHANT_post_private_otp_devices_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *otp_device_id, - const char *otp_device_description, - const char *otp_key, - enum TALER_MerchantConfirmationAlgorithm otp_algorithm); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue - */ -#define TALER_MERCHANT_post_private_otp_devices_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_END \ - } - -/** - * Set the initial counter value (for HOTP). - * - * @param c the counter value - * @return representation of the option as a struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue - */ -#define TALER_MERCHANT_post_private_otp_devices_option_otp_ctr(c) \ - (const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_OPTION_OTP_CTR, \ - .details.otp_ctr = (c) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param ppoh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_otp_devices_set_options_ ( - struct TALER_MERCHANT_PostPrivateOtpDevicesHandle *ppoh, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_post_private_otp_devices_set_options ( - * ppoh, - * TALER_MERCHANT_post_private_otp_devices_option_otp_ctr (42)); - * - * @param ppoh the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_post_private_otp_devices_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_otp_devices_set_options(ppoh,...) \ - TALER_MERCHANT_post_private_otp_devices_set_options_ ( \ - ppoh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateOtpDevicesOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_otp_devices_option_end_ () \ - } \ - )) - - -#ifndef TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateOtpDevicesCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/otp-devices request. - * - * @param cls closure - * @param odr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateOtpDevicesCallback)( - TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateOtpDevicesResponse *odr); - - -/** - * Start POST /private/otp-devices operation. - * - * @param[in,out] ppoh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_otp_devices_start ( - struct TALER_MERCHANT_PostPrivateOtpDevicesHandle *ppoh, - TALER_MERCHANT_PostPrivateOtpDevicesCallback cb, - TALER_MERCHANT_POST_PRIVATE_OTP_DEVICES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/otp-devices operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateOtpDevicesCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppoh operation to cancel - */ -void -TALER_MERCHANT_post_private_otp_devices_cancel ( - struct TALER_MERCHANT_PostPrivateOtpDevicesHandle *ppoh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_OTP_DEVICES_H */ diff --git a/src/include/taler/taler-merchant/post-private-products-PRODUCT_ID-lock.h b/src/include/taler/taler-merchant/post-private-products-PRODUCT_ID-lock.h @@ -1,251 +0,0 @@ -/* - 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/post-private-products-PRODUCT_ID-lock.h - * @brief C interface for the POST /private/products/$PRODUCT_ID/lock endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_PRODUCT_ID_LOCK_H -#define _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_PRODUCT_ID_LOCK_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /private/products/$PRODUCT_ID/lock request. - */ -enum TALER_MERCHANT_PostPrivateProductsLockOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_END = 0, - - /** - * Fractional part of the quantity to lock. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_QUANTITY_FRAC, - - /** - * Whether to use fractional quantity. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_USE_FRACTIONAL_QUANTITY - -}; - - -/** - * Value for an option for the POST /private/products/$PRODUCT_ID/lock request. - */ -struct TALER_MERCHANT_PostPrivateProductsLockOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateProductsLockOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_QUANTITY_FRAC. - */ - uint32_t quantity_frac; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_USE_FRACTIONAL_QUANTITY. - */ - bool use_fractional_quantity; - - } details; - -}; - - -/** - * Handle for a POST /private/products/$PRODUCT_ID/lock request. - */ -struct TALER_MERCHANT_PostPrivateProductsLockHandle; - - -/** - * Response details for a POST /private/products/$PRODUCT_ID/lock request. - */ -struct TALER_MERCHANT_PostPrivateProductsLockResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_products_lock_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_END \ - } - -/** - * Set fractional part of quantity. - * - * @param f fractional part - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_lock_option_quantity_frac(f) \ - (const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_QUANTITY_FRAC, \ - .details.quantity_frac = (f) \ - } - -/** - * Set to use fractional quantity. - * - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_lock_option_use_frac_quantity() \ - (const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_OPTION_USE_FRACTIONAL_QUANTITY, \ - .details.use_fractional_quantity = true \ - } - - -/** - * Set the requested options for the operation. - * - * @param pplh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_products_lock_set_options_ ( - struct TALER_MERCHANT_PostPrivateProductsLockHandle *pplh, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param pplh the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_products_lock_set_options(pplh,...) \ - TALER_MERCHANT_post_private_products_lock_set_options_ ( \ - pplh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateProductsLockOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_products_lock_option_end_ \ - () } \ - )) - - -/** - * Set up POST /private/products/$PRODUCT_ID/lock operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param product_id identifier of the product to lock - * @param uuid idempotency UUID for this lock operation - * @param duration how long to lock the inventory - * @param quantity number of units to lock - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateProductsLockHandle * -TALER_MERCHANT_post_private_products_lock_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *product_id, - const char *uuid, - struct GNUNET_TIME_Relative duration, - uint64_t quantity); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateProductsLockCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/products/$PRODUCT_ID/lock request. - * - * @param cls closure - * @param plr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateProductsLockCallback)( - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateProductsLockResponse *plr); - - -/** - * Start POST /private/products/$PRODUCT_ID/lock operation. - * - * @param[in,out] pplh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_products_lock_start ( - struct TALER_MERCHANT_PostPrivateProductsLockHandle *pplh, - TALER_MERCHANT_PostPrivateProductsLockCallback cb, - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_LOCK_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/products/$PRODUCT_ID/lock operation. This function - * must not be called by clients after the - * TALER_MERCHANT_PostPrivateProductsLockCallback has been invoked (as in - * those cases it'll be called internally by the implementation already). - * - * @param[in] pplh operation to cancel - */ -void -TALER_MERCHANT_post_private_products_lock_cancel ( - struct TALER_MERCHANT_PostPrivateProductsLockHandle *pplh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_PRODUCT_ID_LOCK_H */ diff --git a/src/include/taler/taler-merchant/post-private-products.h b/src/include/taler/taler-merchant/post-private-products.h @@ -1,604 +0,0 @@ -/* - 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/post-private-products.h - * @brief C interface for the POST /private/products endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_H -#define _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /private/products request. - */ -enum TALER_MERCHANT_PostPrivateProductsOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_END = 0, - - /** - * Internationalized descriptions (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_I18N, - - /** - * Tax information (JSON array). - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TAXES, - - /** - * Storage location (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_ADDRESS, - - /** - * Expected restock time. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_NEXT_RESTOCK, - - /** - * Minimum age requirement. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MINIMUM_AGE, - - /** - * Category IDs. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_CATEGORIES, - - /** - * Value and fractional part of total stock. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK, - - /** - * Value part of total stock (-1 for unlimited). - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_VAL, - - /** - * Fractional part of total stock. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC, - - /** - * Whether fractional quantities are allowed. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_ALLOW_FRACTION, - - /** - * Precision level for fractions. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_PRECISION_LEVEL, - - /** - * Explicit product name (distinct from description). - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_NAME, - - /** - * Product image (base64-encoded data URL). - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_IMAGE, - - /** - * Product group ID. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_ID, - - /** - * Money pot ID. - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MONEY_POT_ID, - - /** - * Whether the price is net (before tax). - */ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRICE_IS_NET - -}; - - -/** - * Value for an option for the POST /private/products request. - */ -struct TALER_MERCHANT_PostPrivateProductsOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateProductsOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_I18N. - */ - const json_t *description_i18n; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TAXES. - */ - const json_t *taxes; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_ADDRESS. - */ - const json_t *address; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_NEXT_RESTOCK. - */ - struct GNUNET_TIME_Timestamp next_restock; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MINIMUM_AGE. - */ - uint32_t minimum_age; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_CATEGORIES. - */ - struct - { - unsigned int num; - const uint64_t *cats; - } categories; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK. - */ - struct - { - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_VAL. - * -1 for infinite stock. - */ - int64_t val; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC. - */ - uint32_t frac; - } total_stock; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_ALLOW_FRACTION. - */ - bool unit_allow_fraction; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_PRECISION_LEVEL. - */ - uint32_t unit_precision_level; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_NAME. - */ - const char *product_name; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_IMAGE. - */ - const char *image; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_ID. - */ - uint64_t product_group_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MONEY_POT_ID. - */ - uint64_t money_pot_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRICE_IS_NET. - */ - bool price_is_net; - - } details; - -}; - - -/** - * Handle for a POST /private/products request. - */ -struct TALER_MERCHANT_PostPrivateProductsHandle; - - -/** - * Response details for a POST /private/products request. - */ -struct TALER_MERCHANT_PostPrivateProductsResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PostPrivateProductsOptionValue - */ -#define TALER_MERCHANT_post_private_products_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_END \ - } - -/** - * Set internationalized descriptions. - * - * @param d descriptions JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_description_i18n(d) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_DESCRIPTION_I18N \ - , \ - .details.description_i18n = (d) \ - } - -/** - * Set tax information. - * - * @param t taxes JSON array - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_taxes(t) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TAXES, \ - .details.taxes = (t) \ - } - -/** - * Set storage address. - * - * @param a address JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_address(a) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_ADDRESS, \ - .details.address = (a) \ - } - -/** - * Set expected restock time. - * - * @param r restock timestamp - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_next_restock(r) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_NEXT_RESTOCK, \ - .details.next_restock = (r) \ - } - -/** - * Set minimum age requirement. - * - * @param a minimum age (0 for none) - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_minimum_age(a) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MINIMUM_AGE, \ - .details.minimum_age = (a) \ - } - -/** - * Set category IDs. - * - * @param n number of categories - * @param c array of category IDs - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_categories(n,c) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_CATEGORIES, \ - .details.categories = { .num = (n), .cats = (c) } \ - } - -/** - * Set fractional part of total stock. - * - * @param f fractional part - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_total_stock_frac(f) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_FRAC, \ - .details.total_stock.frac = (f) \ - } - -/** - * Set fractional part of total stock. - * - * @param s total stock amount - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_total_stock_val(s) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK_VAL, \ - .details.total_stock.val = (s) \ - } - -/** - * Set stock. - * - * @param s stock value - * @param f fractional stock - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_total_stock(s,f) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_TOTAL_STOCK, \ - .details.total_stock.val = (s), \ - .details.total_stock.frac = (f) \ - } - -/** - * Set whether fractional quantities are allowed. - * - * @param b true to allow fractions - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_unit_allow_fraction(b) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_ALLOW_FRACTION, \ - .details.unit_allow_fraction = (b) \ - } - -/** - * Set precision level for fractional quantities. - * - * @param p precision level - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_unit_precision_level(p) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_UNIT_PRECISION_LEVEL, \ - .details.unit_precision_level = (p) \ - } - - -/** - * Set explicit product name (distinct from description). - * - * @param n product name string - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_product_name(n) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_NAME, \ - .details.product_name = (n) \ - } - -/** - * Set product image (base64-encoded data URL). - * - * @param i image string - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_image(i) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_IMAGE, \ - .details.image = (i) \ - } - -/** - * Set product group ID. - * - * @param g product group ID - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_product_group_id(g) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRODUCT_GROUP_ID, \ - .details.product_group_id = (g) \ - } - -/** - * Set money pot ID. - * - * @param m money pot ID - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_money_pot_id(m) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_MONEY_POT_ID, \ - .details.money_pot_id = (m) \ - } - -/** - * Set whether the price is net (before tax). - * - * @param b true if price is net - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_products_option_price_is_net(b) \ - (const struct TALER_MERCHANT_PostPrivateProductsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_OPTION_PRICE_IS_NET, \ - .details.price_is_net = (b) \ - } - - -/** - * Set the requested options for the operation. - * - * @param ppph the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_products_set_options_ ( - struct TALER_MERCHANT_PostPrivateProductsHandle *ppph, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateProductsOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppph the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_products_set_options(ppph,...) \ - TALER_MERCHANT_post_private_products_set_options_ ( \ - ppph, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateProductsOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_products_option_end_ () } \ - )) - - -/** - * Set up POST /private/products operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param product_id identifier for the new product - * @param description human-readable product description - * @param unit unit of measurement - * @param price unit price - * @param num_prices length of the @e prices array - * @param prices new unit prices - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateProductsHandle * -TALER_MERCHANT_post_private_products_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *product_id, - const char *description, - const char *unit, - unsigned int num_prices, - const struct TALER_Amount prices[static num_prices]); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateProductsCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/products request. - * - * @param cls closure - * @param ppr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateProductsCallback)( - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateProductsResponse *ppr); - - -/** - * Start POST /private/products operation. - * - * @param[in,out] ppph operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_products_start ( - struct TALER_MERCHANT_PostPrivateProductsHandle *ppph, - TALER_MERCHANT_PostPrivateProductsCallback cb, - TALER_MERCHANT_POST_PRIVATE_PRODUCTS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/products operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateProductsCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppph operation to cancel - */ -void -TALER_MERCHANT_post_private_products_cancel ( - struct TALER_MERCHANT_PostPrivateProductsHandle *ppph); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_PRODUCTS_H */ diff --git a/src/include/taler/taler-merchant/post-private-templates.h b/src/include/taler/taler-merchant/post-private-templates.h @@ -1,249 +0,0 @@ -/* - 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/post-private-templates.h - * @brief C interface for the POST /private/templates endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_TEMPLATES_H -#define _TALER_MERCHANT__POST_PRIVATE_TEMPLATES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /private/templates request. - */ -enum TALER_MERCHANT_PostPrivateTemplatesOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_END = 0, - - /** - * OTP device ID to associate with the template. - */ - TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_OTP_ID, - - /** - * Editable defaults (JSON object) for the template. - */ - TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_EDITABLE_DEFAULTS - -}; - - -/** - * Value for an option for the POST /private/templates request. - */ -struct TALER_MERCHANT_PostPrivateTemplatesOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateTemplatesOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_OTP_ID. - */ - const char *otp_id; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_EDITABLE_DEFAULTS. - */ - const json_t *editable_defaults; - - } details; - -}; - - -/** - * Handle for a POST /private/templates request. - */ -struct TALER_MERCHANT_PostPrivateTemplatesHandle; - - -/** - * Response details for a POST /private/templates request. - */ -struct TALER_MERCHANT_PostPrivateTemplatesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_templates_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_END \ - } - -/** - * Set OTP device ID. - * - * @param o OTP device ID - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_templates_option_otp_id(o) \ - (const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_OTP_ID, \ - .details.otp_id = (o) \ - } - - -/** - * Set editable defaults. - * - * @param ed editable defaults (JSON object) - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_templates_option_editable_defaults(ed) \ - (const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_TEMPLATES_OPTION_EDITABLE_DEFAULTS, \ - .details.editable_defaults = (ed) \ - } - - -/** - * Set the requested options for the operation. - * - * @param ppth the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_templates_set_options_ ( - struct TALER_MERCHANT_PostPrivateTemplatesHandle *ppth, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppth the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_templates_set_options(ppth,...) \ - TALER_MERCHANT_post_private_templates_set_options_ ( \ - ppth, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateTemplatesOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_templates_option_end_ () } \ - )) - - -/** - * Set up POST /private/templates operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param template_id identifier for the new template - * @param template_description human-readable description - * @param template_contract template contract (JSON) - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateTemplatesHandle * -TALER_MERCHANT_post_private_templates_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *template_id, - const char *template_description, - const json_t *template_contract); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateTemplatesCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/templates request. - * - * @param cls closure - * @param ptr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateTemplatesCallback)( - TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateTemplatesResponse *ptr); - - -/** - * Start POST /private/templates operation. - * - * @param[in,out] ppth operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_templates_start ( - struct TALER_MERCHANT_PostPrivateTemplatesHandle *ppth, - TALER_MERCHANT_PostPrivateTemplatesCallback cb, - TALER_MERCHANT_POST_PRIVATE_TEMPLATES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/templates operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateTemplatesCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppth operation to cancel - */ -void -TALER_MERCHANT_post_private_templates_cancel ( - struct TALER_MERCHANT_PostPrivateTemplatesHandle *ppth); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_TEMPLATES_H */ diff --git a/src/include/taler/taler-merchant/post-private-token.h b/src/include/taler/taler-merchant/post-private-token.h @@ -1,310 +0,0 @@ -/* - 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/post-private-token.h - * @brief C interface for the POST /private/token endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_TOKEN_H -#define _TALER_MERCHANT__POST_PRIVATE_TOKEN_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a POST /private/token request. - */ -struct TALER_MERCHANT_PostPrivateTokenHandle; - - -/** - * Possible options for the POST /private/token request. - */ -enum TALER_MERCHANT_PostPrivateTokenOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_END = 0, - - /** - * Duration for the token validity. - */ - TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DURATION, - - /** - * Whether the token may be refreshed. - */ - TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_REFRESHABLE, - - /** - * Description for the token. - */ - TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DESCRIPTION - -}; - - -/** - * Value for an option for the POST /private/token request. - */ -struct TALER_MERCHANT_PostPrivateTokenOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateTokenOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DURATION. - */ - struct GNUNET_TIME_Relative duration; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_REFRESHABLE. - */ - bool refreshable; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DESCRIPTION. - */ - const char *description; - - } details; - -}; - - -/** - * Response details for a POST /private/token request. - */ -struct TALER_MERCHANT_PostPrivateTokenResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * The access token (RFC 8959 secret-token: URI). - */ - const char *access_token; - - /** - * The scope of the token. - */ - const char *scope; - - /** - * Whether the token may be refreshed. - */ - bool refreshable; - - /** - * When the token expires. - */ - struct GNUNET_TIME_Timestamp expiration; - - } ok; - - /** - * Details on #MHD_HTTP_ACCEPTED. - */ - struct TALER_MERCHANT_MfaChallengeResponse accepted; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_token_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_END \ - } - -/** - * Set duration for token validity. - * - * @param d the duration - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_token_option_duration(d) \ - (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DURATION, \ - .details.duration = (d) \ - } - -/** - * Set whether token is refreshable. - * - * @param r true if token may be refreshed - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_token_option_refreshable(r) \ - (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_REFRESHABLE, \ - .details.refreshable = (r) \ - } - -/** - * Set description for the token. - * - * @param d description string - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_token_option_description(d) \ - (const struct TALER_MERCHANT_PostPrivateTokenOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TOKEN_OPTION_DESCRIPTION, \ - .details.description = (d) \ - } - - -/** - * Set the requested options for the operation. - * - * @param ppth the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_token_set_options_ ( - struct TALER_MERCHANT_PostPrivateTokenHandle *ppth, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateTokenOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppth the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_token_set_options(ppth,...) \ - TALER_MERCHANT_post_private_token_set_options_ ( \ - ppth, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateTokenOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_token_option_end_ () } \ - )) - - -/** - * Set up POST /private/token operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param instance_id identifier of the instance - * @param scope scope for the token - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateTokenHandle * -TALER_MERCHANT_post_private_token_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *instance_id, - const char *scope); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateTokenCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/token request. - * - * @param cls closure - * @param ptr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateTokenCallback)( - TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateTokenResponse *ptr); - - -/** - * Start POST /private/token operation. - * - * @param[in,out] ppth operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_token_start ( - struct TALER_MERCHANT_PostPrivateTokenHandle *ppth, - TALER_MERCHANT_PostPrivateTokenCallback cb, - TALER_MERCHANT_POST_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/token operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateTokenCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppth operation to cancel - */ -void -TALER_MERCHANT_post_private_token_cancel ( - struct TALER_MERCHANT_PostPrivateTokenHandle *ppth); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_TOKEN_H */ diff --git a/src/include/taler/taler-merchant/post-private-tokenfamilies.h b/src/include/taler/taler-merchant/post-private-tokenfamilies.h @@ -1,261 +0,0 @@ -/* - 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/post-private-tokenfamilies.h - * @brief C interface for the POST /private/tokenfamilies endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_TOKENFAMILIES_H -#define _TALER_MERCHANT__POST_PRIVATE_TOKENFAMILIES_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /private/tokenfamilies request. - */ -enum TALER_MERCHANT_PostPrivateTokenfamiliesOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_END = 0, - - /** - * Internationalized descriptions (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_DESCRIPTION_I18N, - - /** - * Extra data (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_EXTRA_DATA - -}; - - -/** - * Value for an option for the POST /private/tokenfamilies request. - */ -struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateTokenfamiliesOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_DESCRIPTION_I18N. - */ - const json_t *description_i18n; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_EXTRA_DATA. - */ - const json_t *extra_data; - - } details; - -}; - - -/** - * Handle for a POST /private/tokenfamilies request. - */ -struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle; - - -/** - * Response details for a POST /private/tokenfamilies request. - */ -struct TALER_MERCHANT_PostPrivateTokenfamiliesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_tokenfamilies_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_END \ - } - -/** - * Set internationalized descriptions. - * - * @param d descriptions JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_tokenfamilies_option_description_i18n(d) \ - (const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_DESCRIPTION_I18N, \ - .details.description_i18n = (d) \ - } - -/** - * Set extra data. - * - * @param e extra data JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_tokenfamilies_option_extra_data(e) \ - (const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_OPTION_EXTRA_DATA, \ - .details.extra_data = (e) \ - } - - -/** - * Set the requested options for the operation. - * - * @param ptfh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_tokenfamilies_set_options_ ( - struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle *ptfh, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ptfh the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_tokenfamilies_set_options(ptfh,...) \ - TALER_MERCHANT_post_private_tokenfamilies_set_options_ ( \ - ptfh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateTokenfamiliesOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_tokenfamilies_option_end_ \ - () } \ - )) - - -/** - * Set up POST /private/tokenfamilies operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param slug URL-safe slug identifier for the new token family - * @param name human-readable name - * @param description human-readable description - * @param valid_after start of validity period - * @param valid_before end of validity period - * @param duration duration of individual token validity - * @param validity_granularity granularity for validity alignment - * @param start_offset offset from purchase to start of validity - * @param kind kind of token family ("subscription" or "discount") - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle * -TALER_MERCHANT_post_private_tokenfamilies_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *slug, - const char *name, - const char *description, - struct GNUNET_TIME_Timestamp valid_after, - struct GNUNET_TIME_Timestamp valid_before, - struct GNUNET_TIME_Relative duration, - struct GNUNET_TIME_Relative validity_granularity, - struct GNUNET_TIME_Relative start_offset, - const char *kind); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateTokenfamiliesCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/tokenfamilies request. - * - * @param cls closure - * @param tfr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateTokenfamiliesCallback)( - TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateTokenfamiliesResponse *tfr); - - -/** - * Start POST /private/tokenfamilies operation. - * - * @param[in,out] ptfh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_tokenfamilies_start ( - struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle *ptfh, - TALER_MERCHANT_PostPrivateTokenfamiliesCallback cb, - TALER_MERCHANT_POST_PRIVATE_TOKENFAMILIES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/tokenfamilies operation. This function must not be - * called by clients after the - * TALER_MERCHANT_PostPrivateTokenfamiliesCallback has been invoked (as in - * those cases it'll be called internally by the implementation already). - * - * @param[in] ptfh operation to cancel - */ -void -TALER_MERCHANT_post_private_tokenfamilies_cancel ( - struct TALER_MERCHANT_PostPrivateTokenfamiliesHandle *ptfh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_TOKENFAMILIES_H */ diff --git a/src/include/taler/taler-merchant/post-private-transfers.h b/src/include/taler/taler-merchant/post-private-transfers.h @@ -1,145 +0,0 @@ -/* - 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/post-private-transfers.h - * @brief C interface for the POST /private/transfers endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_TRANSFERS_H -#define _TALER_MERCHANT__POST_PRIVATE_TRANSFERS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Handle for a POST /private/transfers request. - */ -struct TALER_MERCHANT_PostPrivateTransfersHandle; - - -/** - * Response details for a POST /private/transfers request. - */ -struct TALER_MERCHANT_PostPrivateTransfersResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_BAD_GATEWAY (exchange returned an error). - */ - struct - { - - /** - * Error code returned by the exchange. - */ - enum TALER_ErrorCode exchange_ec; - - /** - * HTTP status code returned by the exchange. - */ - unsigned int exchange_http_status; - - } bad_gateway; - - } details; - -}; - - -/** - * Set up POST /private/transfers operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param credit_amount amount credited in this transfer - * @param wtid wire transfer identifier - * @param payto_uri payto URI of the merchant account that received the funds - * @param exchange_url base URL of the exchange that made the transfer - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateTransfersHandle * -TALER_MERCHANT_post_private_transfers_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const struct TALER_Amount *credit_amount, - const struct TALER_WireTransferIdentifierRawP *wtid, - struct TALER_FullPayto payto_uri, - const char *exchange_url); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateTransfersCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/transfers request. - * - * @param cls closure - * @param ptr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateTransfersCallback)( - TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateTransfersResponse *ptr); - - -/** - * Start POST /private/transfers operation. - * - * @param[in,out] ppth operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_transfers_start ( - struct TALER_MERCHANT_PostPrivateTransfersHandle *ppth, - TALER_MERCHANT_PostPrivateTransfersCallback cb, - TALER_MERCHANT_POST_PRIVATE_TRANSFERS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/transfers operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateTransfersCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppth operation to cancel - */ -void -TALER_MERCHANT_post_private_transfers_cancel ( - struct TALER_MERCHANT_PostPrivateTransfersHandle *ppth); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_TRANSFERS_H */ diff --git a/src/include/taler/taler-merchant/post-private-units.h b/src/include/taler/taler-merchant/post-private-units.h @@ -1,328 +0,0 @@ -/* - 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/post-private-units.h - * @brief C interface for the POST /private/units endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_UNITS_H -#define _TALER_MERCHANT__POST_PRIVATE_UNITS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /private/units request. - */ -enum TALER_MERCHANT_PostPrivateUnitsOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_END = 0, - - /** - * Internationalized long names (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_LONG_I18N, - - /** - * Internationalized short names (JSON). - */ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_SHORT_I18N, - - /** - * Whether fractional quantities are allowed (bool). - * Default: false. - */ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ALLOW_FRACTION, - - /** - * Precision level for fractional quantities (uint32_t). - * Default: 0. - */ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_PRECISION_LEVEL, - - /** - * Whether the unit is active (bool). - * Default: true. - */ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ACTIVE - -}; - - -/** - * Value for an option for the POST /private/units request. - */ -struct TALER_MERCHANT_PostPrivateUnitsOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateUnitsOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_LONG_I18N. - */ - const json_t *unit_name_long_i18n; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_SHORT_I18N. - */ - const json_t *unit_name_short_i18n; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ALLOW_FRACTION. - */ - bool unit_allow_fraction; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_PRECISION_LEVEL. - */ - uint32_t unit_precision_level; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ACTIVE. - */ - bool unit_active; - - } details; - -}; - - -/** - * Handle for a POST /private/units request. - */ -struct TALER_MERCHANT_PostPrivateUnitsHandle; - - -/** - * Response details for a POST /private/units request. - */ -struct TALER_MERCHANT_PostPrivateUnitsResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_private_units_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_END \ - } - -/** - * Set internationalized long names. - * - * @param j long names JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_units_option_unit_name_long_i18n(j) \ - (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_LONG_I18N \ - , \ - .details.unit_name_long_i18n = (j) \ - } - -/** - * Set internationalized short names. - * - * @param j short names JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_units_option_unit_name_short_i18n(j) \ - (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_NAME_SHORT_I18N, \ - .details.unit_name_short_i18n = (j) \ - } - - -/** - * Set whether fractional quantities are allowed. - * - * @param v true to allow fractions - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_units_option_unit_allow_fraction(v) \ - (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ALLOW_FRACTION, \ - .details.unit_allow_fraction = (v) \ - } - -/** - * Set the precision level for fractional quantities. - * - * @param v precision level - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_units_option_unit_precision_level(v) \ - (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_PRECISION_LEVEL, \ - .details.unit_precision_level = (v) \ - } - -/** - * Set whether the unit is active. - * - * @param v true if active - * @return representation of the option - */ -#define TALER_MERCHANT_post_private_units_option_unit_active(v) \ - (const struct TALER_MERCHANT_PostPrivateUnitsOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_UNITS_OPTION_UNIT_ACTIVE, \ - .details.unit_active = (v) \ - } - - -/** - * Set the requested options for the operation. - * - * @param ppuh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_units_set_options_ ( - struct TALER_MERCHANT_PostPrivateUnitsHandle *ppuh, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateUnitsOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param ppuh the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_units_set_options(ppuh,...) \ - TALER_MERCHANT_post_private_units_set_options_ ( \ - ppuh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateUnitsOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_units_option_end_ () } \ - )) - - -/** - * Set up POST /private/units operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param unit_id identifier for the new unit - * @param unit_name_long long human-readable name - * @param unit_name_short short symbol for the unit - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateUnitsHandle * -TALER_MERCHANT_post_private_units_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *unit_id, - const char *unit_name_long, - const char *unit_name_short); - - -#ifndef TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateUnitsCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/units request. - * - * @param cls closure - * @param pur response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateUnitsCallback)( - TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateUnitsResponse *pur); - - -/** - * Start POST /private/units operation. - * - * @param[in,out] ppuh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_units_start ( - struct TALER_MERCHANT_PostPrivateUnitsHandle *ppuh, - TALER_MERCHANT_PostPrivateUnitsCallback cb, - TALER_MERCHANT_POST_PRIVATE_UNITS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/units operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateUnitsCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppuh operation to cancel - */ -void -TALER_MERCHANT_post_private_units_cancel ( - struct TALER_MERCHANT_PostPrivateUnitsHandle *ppuh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_UNITS_H */ diff --git a/src/include/taler/taler-merchant/post-private-webhooks.h b/src/include/taler/taler-merchant/post-private-webhooks.h @@ -1,263 +0,0 @@ -/* - 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/post-private-webhooks.h - * @brief C interface for the POST /private/webhooks endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_PRIVATE_WEBHOOKS_H -#define _TALER_MERCHANT__POST_PRIVATE_WEBHOOKS_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options we can set for the POST /private/webhooks request. - */ -enum TALER_MERCHANT_PostPrivateWebhooksOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_END = 0, - - /** - * Set the header template. - */ - TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_HEADER_TEMPLATE, - - /** - * Set the body template. - */ - TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_BODY_TEMPLATE - -}; - - -/** - * Value for an option for the POST /private/webhooks request. - */ -struct TALER_MERCHANT_PostPrivateWebhooksOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostPrivateWebhooksOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_HEADER_TEMPLATE. - */ - const char *header_template; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_BODY_TEMPLATE. - */ - const char *body_template; - - } details; - -}; - - -/** - * Handle for a POST /private/webhooks request. - */ -struct TALER_MERCHANT_PostPrivateWebhooksHandle; - - -/** - * Response details for a POST /private/webhooks request. - */ -struct TALER_MERCHANT_PostPrivateWebhooksResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - -}; - - -/** - * Set up POST /private/webhooks operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param webhook_id identifier for the new webhook - * @param event_type event type that triggers this webhook - * @param notification_url URL to send notifications to - * @param http_method HTTP method to use for notifications - * @return handle to operation - */ -struct TALER_MERCHANT_PostPrivateWebhooksHandle * -TALER_MERCHANT_post_private_webhooks_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *webhook_id, - const char *event_type, - const char *notification_url, - const char *http_method); - - -/** - * Terminate the list of the options. - * - * @return the terminating object of struct TALER_MERCHANT_PostPrivateWebhooksOptionValue - */ -#define TALER_MERCHANT_post_private_webhooks_option_end_() \ - (const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_END \ - } - -/** - * Set header template. - * - * @param ht header template string to set - * @return representation of the option as a struct TALER_MERCHANT_PostPrivateWebhooksOptionValue - */ -#define TALER_MERCHANT_post_private_webhooks_option_header_template(ht) \ - (const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_HEADER_TEMPLATE, \ - .details.header_template = (ht) \ - } - -/** - * Set body template. - * - * @param bt body template string to set - * @return representation of the option as a struct TALER_MERCHANT_PostPrivateWebhooksOptionValue - */ -#define TALER_MERCHANT_post_private_webhooks_option_body_template(bt) \ - (const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue) \ - { \ - .option = \ - TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_OPTION_BODY_TEMPLATE, \ - .details.body_template = (bt) \ - } - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * @param ppwh the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_private_webhooks_set_options_ ( - struct TALER_MERCHANT_PostPrivateWebhooksHandle *ppwh, - unsigned int num_options, - const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * If any option fail other options may be or may be not applied. - * - * It should be used with helpers that create required options, for example: - * - * TALER_MERCHANT_post_private_webhooks_set_options ( - * ppwh, - * TALER_MERCHANT_post_private_webhooks_option_header_template ( - * "Content-Type: application/json")); - * - * @param ppwh the request to set the options for - * @param ... the list of the options, each option must be created - * by helpers TALER_MERCHANT_post_private_webhooks_option_NAME(VALUE) - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_private_webhooks_set_options(ppwh,...) \ - TALER_MERCHANT_post_private_webhooks_set_options_ ( \ - ppwh, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostPrivateWebhooksOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_private_webhooks_option_end_ () } \ - )) - - -#ifndef TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostPrivateWebhooksCallback. - */ -#define TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE */ - -/** - * Callback for a POST /private/webhooks request. - * - * @param cls closure - * @param wpr response details - */ -typedef void -(*TALER_MERCHANT_PostPrivateWebhooksCallback)( - TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostPrivateWebhooksResponse *wpr); - - -/** - * Start POST /private/webhooks operation. - * - * @param[in,out] ppwh operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_private_webhooks_start ( - struct TALER_MERCHANT_PostPrivateWebhooksHandle *ppwh, - TALER_MERCHANT_PostPrivateWebhooksCallback cb, - TALER_MERCHANT_POST_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /private/webhooks operation. This function must not be - * called by clients after the TALER_MERCHANT_PostPrivateWebhooksCallback - * has been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] ppwh operation to cancel - */ -void -TALER_MERCHANT_post_private_webhooks_cancel ( - struct TALER_MERCHANT_PostPrivateWebhooksHandle *ppwh); - - -#endif /* _TALER_MERCHANT__POST_PRIVATE_WEBHOOKS_H */ diff --git a/src/include/taler/taler-merchant/post-templates-TEMPLATE_ID.h b/src/include/taler/taler-merchant/post-templates-TEMPLATE_ID.h @@ -1,298 +0,0 @@ -/* - 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/post-templates-TEMPLATE_ID.h - * @brief C interface for the POST /templates/$TEMPLATE_ID endpoint - * @author Christian Grothoff - */ -#ifndef _TALER_MERCHANT__POST_TEMPLATES_TEMPLATE_ID_H -#define _TALER_MERCHANT__POST_TEMPLATES_TEMPLATE_ID_H - -#include <taler/taler-merchant/common.h> - - -/** - * Possible options for the POST /templates/$TEMPLATE_ID request. - */ -enum TALER_MERCHANT_PostTemplatesOption -{ - /** - * End of list of options. - */ - TALER_MERCHANT_POST_TEMPLATES_OPTION_END = 0, - - /** - * Order summary. - */ - TALER_MERCHANT_POST_TEMPLATES_OPTION_SUMMARY, - - /** - * Total amount for the order. - */ - TALER_MERCHANT_POST_TEMPLATES_OPTION_AMOUNT, - - /** - * Detailed contract customization (JSON). - */ - TALER_MERCHANT_POST_TEMPLATES_OPTION_DETAILS - -}; - - -/** - * Value for an option for the POST /templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_PostTemplatesOptionValue -{ - - /** - * Type of the option being set. - */ - enum TALER_MERCHANT_PostTemplatesOption option; - - /** - * Specific option value. - */ - union - { - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_TEMPLATES_OPTION_SUMMARY. - */ - const char *summary; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_TEMPLATES_OPTION_AMOUNT. - */ - const struct TALER_Amount *amount; - - /** - * Value if @e option is - * #TALER_MERCHANT_POST_TEMPLATES_OPTION_DETAILS. - */ - const json_t *details; - - } details; - -}; - - -/** - * Handle for a POST /templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_PostTemplatesHandle; - - -/** - * Response details for a POST /templates/$TEMPLATE_ID request. - */ -struct TALER_MERCHANT_PostTemplatesResponse -{ - - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Identifier of the created order. - */ - const char *order_id; - - /** - * Claim token, or NULL. - */ - const struct TALER_ClaimTokenP *token; - - /** - * Payment deadline. - */ - struct GNUNET_TIME_Timestamp pay_deadline; - - } ok; - - } details; - -}; - - -/** - * Terminate the list of the options. - * - * @return the terminating object - */ -#define TALER_MERCHANT_post_templates_option_end_() \ - (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_END \ - } - -/** - * Set order summary. - * - * @param s summary string - * @return representation of the option - */ -#define TALER_MERCHANT_post_templates_option_summary(s) \ - (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_SUMMARY, \ - .details.summary = (s) \ - } - -/** - * Set total amount. - * - * @param a amount - * @return representation of the option - */ -#define TALER_MERCHANT_post_templates_option_amount(a) \ - (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_AMOUNT, \ - .details.amount = (a) \ - } - -/** - * Set detailed contract customization. - * - * @param d details JSON object - * @return representation of the option - */ -#define TALER_MERCHANT_post_templates_option_details(d) \ - (const struct TALER_MERCHANT_PostTemplatesOptionValue) \ - { \ - .option = TALER_MERCHANT_POST_TEMPLATES_OPTION_DETAILS, \ - .details.details = (d) \ - } - - -/** - * Set the requested options for the operation. - * - * @param pth the request to set the options for - * @param num_options length of the @a options array - * @param options an array of options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -enum GNUNET_GenericReturnValue -TALER_MERCHANT_post_templates_set_options_ ( - struct TALER_MERCHANT_PostTemplatesHandle *pth, - unsigned int num_options, - const struct TALER_MERCHANT_PostTemplatesOptionValue *options); - - -/** - * Set the requested options for the operation. - * - * @param pth the request to set the options for - * @param ... the list of the options - * @return #GNUNET_OK on success, - * #GNUNET_NO on failure, - * #GNUNET_SYSERR on internal error - */ -#define TALER_MERCHANT_post_templates_set_options(pth,...) \ - TALER_MERCHANT_post_templates_set_options_ ( \ - pth, \ - TALER_MERCHANT_COMMON_OPTIONS_ARRAY_MAX_SIZE, \ - ((const struct TALER_MERCHANT_PostTemplatesOptionValue[]) \ - {__VA_ARGS__, TALER_MERCHANT_post_templates_option_end_ () } \ - )) - - -/** - * Set up POST /templates/$TEMPLATE_ID operation. - * Note that you must explicitly start the operation after - * possibly setting options. - * - * @param ctx the context - * @param url base URL of the merchant backend - * @param template_id identifier of the template to use - * @return handle to operation - */ -struct TALER_MERCHANT_PostTemplatesHandle * -TALER_MERCHANT_post_templates_create ( - struct GNUNET_CURL_Context *ctx, - const char *url, - const char *template_id); - - -#ifndef TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE -/** - * Type of the closure used by - * the #TALER_MERCHANT_PostTemplatesCallback. - */ -#define TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE void -#endif /* TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE */ - -/** - * Callback for a POST /templates/$TEMPLATE_ID request. - * - * @param cls closure - * @param ptr response details - */ -typedef void -(*TALER_MERCHANT_PostTemplatesCallback)( - TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE *cls, - const struct TALER_MERCHANT_PostTemplatesResponse *ptr); - - -/** - * Start POST /templates/$TEMPLATE_ID operation. - * - * @param[in,out] pth operation to start - * @param cb function to call with the merchant's result - * @param cb_cls closure for @a cb - * @return status code, #TALER_EC_NONE on success - */ -enum TALER_ErrorCode -TALER_MERCHANT_post_templates_start ( - struct TALER_MERCHANT_PostTemplatesHandle *pth, - TALER_MERCHANT_PostTemplatesCallback cb, - TALER_MERCHANT_POST_TEMPLATES_RESULT_CLOSURE *cb_cls); - - -/** - * Cancel POST /templates/$TEMPLATE_ID operation. This function must not be - * called by clients after the TALER_MERCHANT_PostTemplatesCallback has - * been invoked (as in those cases it'll be called internally by the - * implementation already). - * - * @param[in] pth operation to cancel - */ -void -TALER_MERCHANT_post_templates_cancel ( - struct TALER_MERCHANT_PostTemplatesHandle *pth); - - -#endif /* _TALER_MERCHANT__POST_TEMPLATES_TEMPLATE_ID_H */ diff --git a/src/include/taler/taler_merchant_service.h b/src/include/taler/taler_merchant_service.h @@ -32,75 +32,75 @@ */ #define TALER_MERCHANT_API_VERSION 0x000C0000 -#include <taler/taler-merchant/common.h> -#include <taler/taler-merchant/get-config.h> -#include <taler/taler-merchant/get-management-instances.h> -#include <taler/taler-merchant/get-management-instances-INSTANCE.h> -#include <taler/taler-merchant/get-private-kyc.h> -#include <taler/taler-merchant/get-private-statistics-amount-SLUG.h> -#include <taler/taler-merchant/get-private-statistics-counter-SLUG.h> -#include <taler/taler-merchant/delete-management-instances-INSTANCE.h> -#include <taler/taler-merchant/patch-management-instances-INSTANCE.h> -#include <taler/taler-merchant/post-management-instances.h> -#include <taler/taler-merchant/post-management-instances-INSTANCE-auth.h> -#include <taler/taler-merchant/post-private-token.h> -#include <taler/taler-merchant/delete-private-token.h> -#include <taler/taler-merchant/delete-private-tokens-SERIAL.h> -#include <taler/taler-merchant/get-private-orders.h> -#include <taler/taler-merchant/post-private-orders.h> -#include <taler/taler-merchant/get-private-orders-ORDER_ID.h> -#include <taler/taler-merchant/get-orders-ORDER_ID.h> -#include <taler/taler-merchant/delete-private-orders-ORDER_ID.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-abort.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-claim.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-paid.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-pay.h> -#include <taler/taler-merchant/post-private-orders-ORDER_ID-refund.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-refund.h> -#include <taler/taler-merchant/patch-private-orders-ORDER_ID-forget.h> -#include <taler/taler-merchant/get-private-products.h> -#include <taler/taler-merchant/get-private-products-PRODUCT_ID.h> -#include <taler/taler-merchant/post-private-products.h> -#include <taler/taler-merchant/patch-private-products-PRODUCT_ID.h> -#include <taler/taler-merchant/delete-private-products-PRODUCT_ID.h> -#include <taler/taler-merchant/post-private-products-PRODUCT_ID-lock.h> -#include <taler/taler-merchant/get-products-IMAGE_HASH-image.h> -#include <taler/taler-merchant/get-private-transfers.h> -#include <taler/taler-merchant/post-private-transfers.h> -#include <taler/taler-merchant/delete-private-transfers-TID.h> -#include <taler/taler-merchant/get-private-accounts.h> -#include <taler/taler-merchant/get-private-accounts-H_WIRE.h> -#include <taler/taler-merchant/post-private-accounts.h> -#include <taler/taler-merchant/patch-private-accounts-H_WIRE.h> -#include <taler/taler-merchant/delete-private-accounts-H_WIRE.h> -#include <taler/taler-merchant/get-private-otp-devices.h> -#include <taler/taler-merchant/get-private-otp-devices-DEVICE_ID.h> -#include <taler/taler-merchant/post-private-otp-devices.h> -#include <taler/taler-merchant/patch-private-otp-devices-DEVICE_ID.h> -#include <taler/taler-merchant/delete-private-otp-devices-DEVICE_ID.h> -#include <taler/taler-merchant/get-private-templates.h> -#include <taler/taler-merchant/get-private-templates-TEMPLATE_ID.h> -#include <taler/taler-merchant/post-private-templates.h> -#include <taler/taler-merchant/patch-private-templates-TEMPLATE_ID.h> -#include <taler/taler-merchant/delete-private-templates-TEMPLATE_ID.h> -#include <taler/taler-merchant/post-templates-TEMPLATE_ID.h> -#include <taler/taler-merchant/get-templates-TEMPLATE_ID.h> +#include <taler/merchant/common.h> +#include <taler/merchant/get-config.h> +#include <taler/merchant/get-management-instances.h> +#include <taler/merchant/get-management-instances-INSTANCE.h> +#include <taler/merchant/get-private-kyc.h> +#include <taler/merchant/get-private-statistics-amount-SLUG.h> +#include <taler/merchant/get-private-statistics-counter-SLUG.h> +#include <taler/merchant/delete-management-instances-INSTANCE.h> +#include <taler/merchant/patch-management-instances-INSTANCE.h> +#include <taler/merchant/post-management-instances.h> +#include <taler/merchant/post-management-instances-INSTANCE-auth.h> +#include <taler/merchant/post-private-token.h> +#include <taler/merchant/delete-private-token.h> +#include <taler/merchant/delete-private-tokens-SERIAL.h> +#include <taler/merchant/get-private-orders.h> +#include <taler/merchant/post-private-orders.h> +#include <taler/merchant/get-private-orders-ORDER_ID.h> +#include <taler/merchant/get-orders-ORDER_ID.h> +#include <taler/merchant/delete-private-orders-ORDER_ID.h> +#include <taler/merchant/post-orders-ORDER_ID-abort.h> +#include <taler/merchant/post-orders-ORDER_ID-claim.h> +#include <taler/merchant/post-orders-ORDER_ID-paid.h> +#include <taler/merchant/post-orders-ORDER_ID-pay.h> +#include <taler/merchant/post-private-orders-ORDER_ID-refund.h> +#include <taler/merchant/post-orders-ORDER_ID-refund.h> +#include <taler/merchant/patch-private-orders-ORDER_ID-forget.h> +#include <taler/merchant/get-private-products.h> +#include <taler/merchant/get-private-products-PRODUCT_ID.h> +#include <taler/merchant/post-private-products.h> +#include <taler/merchant/patch-private-products-PRODUCT_ID.h> +#include <taler/merchant/delete-private-products-PRODUCT_ID.h> +#include <taler/merchant/post-private-products-PRODUCT_ID-lock.h> +#include <taler/merchant/get-products-IMAGE_HASH-image.h> +#include <taler/merchant/get-private-transfers.h> +#include <taler/merchant/post-private-transfers.h> +#include <taler/merchant/delete-private-transfers-TID.h> +#include <taler/merchant/get-private-accounts.h> +#include <taler/merchant/get-private-accounts-H_WIRE.h> +#include <taler/merchant/post-private-accounts.h> +#include <taler/merchant/patch-private-accounts-H_WIRE.h> +#include <taler/merchant/delete-private-accounts-H_WIRE.h> +#include <taler/merchant/get-private-otp-devices.h> +#include <taler/merchant/get-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/post-private-otp-devices.h> +#include <taler/merchant/patch-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/delete-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/get-private-templates.h> +#include <taler/merchant/get-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/post-private-templates.h> +#include <taler/merchant/patch-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/delete-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/post-templates-TEMPLATE_ID.h> +#include <taler/merchant/get-templates-TEMPLATE_ID.h> #include \ - <taler/taler-merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h> -#include <taler/taler-merchant/post-private-tokenfamilies.h> -#include <taler/taler-merchant/get-private-webhooks.h> -#include <taler/taler-merchant/get-private-webhooks-WEBHOOK_ID.h> -#include <taler/taler-merchant/post-private-webhooks.h> -#include <taler/taler-merchant/patch-private-webhooks-WEBHOOK_ID.h> -#include <taler/taler-merchant/delete-private-webhooks-WEBHOOK_ID.h> -#include <taler/taler-merchant/get-private-units.h> -#include <taler/taler-merchant/get-private-units-UNIT.h> -#include <taler/taler-merchant/post-private-units.h> -#include <taler/taler-merchant/patch-private-units-UNIT.h> -#include <taler/taler-merchant/delete-private-units-UNIT.h> -#include <taler/taler-merchant/post-private-categories.h> -#include <taler/taler-merchant/get-private-donau.h> -#include <taler/taler-merchant/post-private-donau.h> -#include <taler/taler-merchant/delete-private-donau-DONAU_SERIAL.h> + <taler/merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h> +#include <taler/merchant/post-private-tokenfamilies.h> +#include <taler/merchant/get-private-webhooks.h> +#include <taler/merchant/get-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/post-private-webhooks.h> +#include <taler/merchant/patch-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/delete-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/get-private-units.h> +#include <taler/merchant/get-private-units-UNIT.h> +#include <taler/merchant/post-private-units.h> +#include <taler/merchant/patch-private-units-UNIT.h> +#include <taler/merchant/delete-private-units-UNIT.h> +#include <taler/merchant/post-private-categories.h> +#include <taler/merchant/get-private-donau.h> +#include <taler/merchant/post-private-donau.h> +#include <taler/merchant/delete-private-donau-DONAU_SERIAL.h> #endif diff --git a/src/lib/merchant_api_delete-management-instances-INSTANCE.c b/src/lib/merchant_api_delete-management-instances-INSTANCE.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-management-instances-INSTANCE.h> +#include <taler/merchant/delete-management-instances-INSTANCE.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include "merchant_api_common.h" diff --git a/src/lib/merchant_api_delete-private-accounts-H_WIRE.c b/src/lib/merchant_api_delete-private-accounts-H_WIRE.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-accounts-H_WIRE.h> +#include <taler/merchant/delete-private-accounts-H_WIRE.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-donau-DONAU_SERIAL.c b/src/lib/merchant_api_delete-private-donau-DONAU_SERIAL.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-donau-DONAU_SERIAL.h> +#include <taler/merchant/delete-private-donau-DONAU_SERIAL.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-orders-ORDER_ID.c b/src/lib/merchant_api_delete-private-orders-ORDER_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-orders-ORDER_ID.h> +#include <taler/merchant/delete-private-orders-ORDER_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-otp-devices-DEVICE_ID.c b/src/lib/merchant_api_delete-private-otp-devices-DEVICE_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/delete-private-otp-devices-DEVICE_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-products-PRODUCT_ID.c b/src/lib/merchant_api_delete-private-products-PRODUCT_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-products-PRODUCT_ID.h> +#include <taler/merchant/delete-private-products-PRODUCT_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-templates-TEMPLATE_ID.c b/src/lib/merchant_api_delete-private-templates-TEMPLATE_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/delete-private-templates-TEMPLATE_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-token.c b/src/lib/merchant_api_delete-private-token.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-token.h> +#include <taler/merchant/delete-private-token.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-tokens-SERIAL.c b/src/lib/merchant_api_delete-private-tokens-SERIAL.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-tokens-SERIAL.h> +#include <taler/merchant/delete-private-tokens-SERIAL.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-transfers-TID.c b/src/lib/merchant_api_delete-private-transfers-TID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-transfers-TID.h> +#include <taler/merchant/delete-private-transfers-TID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-units-UNIT.c b/src/lib/merchant_api_delete-private-units-UNIT.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-units-UNIT.h> +#include <taler/merchant/delete-private-units-UNIT.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_delete-private-webhooks-WEBHOOK_ID.c b/src/lib/merchant_api_delete-private-webhooks-WEBHOOK_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/delete-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/delete-private-webhooks-WEBHOOK_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-config.c b/src/lib/merchant_api_get-config.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-config.h> +#include <taler/merchant/get-config.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/lib/merchant_api_get-management-instances-INSTANCE.c b/src/lib/merchant_api_get-management-instances-INSTANCE.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-management-instances-INSTANCE.h> +#include <taler/merchant/get-management-instances-INSTANCE.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-management-instances.c b/src/lib/merchant_api_get-management-instances.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-management-instances.h> +#include <taler/merchant/get-management-instances.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-orders-ORDER_ID.c b/src/lib/merchant_api_get-orders-ORDER_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-orders-ORDER_ID.h> +#include <taler/merchant/get-orders-ORDER_ID.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-accounts-H_WIRE.c b/src/lib/merchant_api_get-private-accounts-H_WIRE.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-accounts-H_WIRE.h> +#include <taler/merchant/get-private-accounts-H_WIRE.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-accounts.c b/src/lib/merchant_api_get-private-accounts.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-accounts.h> +#include <taler/merchant/get-private-accounts.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-donau.c b/src/lib/merchant_api_get-private-donau.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-donau.h> +#include <taler/merchant/get-private-donau.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-kyc.c b/src/lib/merchant_api_get-private-kyc.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-kyc.h> +#include <taler/merchant/get-private-kyc.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-orders-ORDER_ID.c b/src/lib/merchant_api_get-private-orders-ORDER_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-orders-ORDER_ID.h> +#include <taler/merchant/get-private-orders-ORDER_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-orders.c b/src/lib/merchant_api_get-private-orders.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-orders.h> +#include <taler/merchant/get-private-orders.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-otp-devices-DEVICE_ID.c b/src/lib/merchant_api_get-private-otp-devices-DEVICE_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/get-private-otp-devices-DEVICE_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-otp-devices.c b/src/lib/merchant_api_get-private-otp-devices.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-otp-devices.h> +#include <taler/merchant/get-private-otp-devices.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-products-PRODUCT_ID.c b/src/lib/merchant_api_get-private-products-PRODUCT_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-products-PRODUCT_ID.h> +#include <taler/merchant/get-private-products-PRODUCT_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-products.c b/src/lib/merchant_api_get-private-products.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-products.h> +#include <taler/merchant/get-private-products.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-statistics-amount-SLUG.c b/src/lib/merchant_api_get-private-statistics-amount-SLUG.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-statistics-amount-SLUG.h> +#include <taler/merchant/get-private-statistics-amount-SLUG.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-statistics-counter-SLUG.c b/src/lib/merchant_api_get-private-statistics-counter-SLUG.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-statistics-counter-SLUG.h> +#include <taler/merchant/get-private-statistics-counter-SLUG.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-templates-TEMPLATE_ID.c b/src/lib/merchant_api_get-private-templates-TEMPLATE_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/get-private-templates-TEMPLATE_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-templates.c b/src/lib/merchant_api_get-private-templates.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-templates.h> +#include <taler/merchant/get-private-templates.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-tokenfamilies-TOKEN_FAMILY_SLUG.c b/src/lib/merchant_api_get-private-tokenfamilies-TOKEN_FAMILY_SLUG.c @@ -26,7 +26,7 @@ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> #include \ - <taler/taler-merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h> + <taler/merchant/get-private-tokenfamilies-TOKEN_FAMILY_SLUG.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-transfers.c b/src/lib/merchant_api_get-private-transfers.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-transfers.h> +#include <taler/merchant/get-private-transfers.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-units-UNIT.c b/src/lib/merchant_api_get-private-units-UNIT.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-units-UNIT.h> +#include <taler/merchant/get-private-units-UNIT.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-units.c b/src/lib/merchant_api_get-private-units.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-units.h> +#include <taler/merchant/get-private-units.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-webhooks-WEBHOOK_ID.c b/src/lib/merchant_api_get-private-webhooks-WEBHOOK_ID.c @@ -26,7 +26,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/get-private-webhooks-WEBHOOK_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-private-webhooks.c b/src/lib/merchant_api_get-private-webhooks.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-private-webhooks.h> +#include <taler/merchant/get-private-webhooks.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-products-IMAGE_HASH-image.c b/src/lib/merchant_api_get-products-IMAGE_HASH-image.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-products-IMAGE_HASH-image.h> +#include <taler/merchant/get-products-IMAGE_HASH-image.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_get-templates-TEMPLATE_ID.c b/src/lib/merchant_api_get-templates-TEMPLATE_ID.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/get-templates-TEMPLATE_ID.h> +#include <taler/merchant/get-templates-TEMPLATE_ID.h> #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-management-instances-INSTANCE.c b/src/lib/merchant_api_patch-management-instances-INSTANCE.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-management-instances-INSTANCE.h> +#include <taler/merchant/patch-management-instances-INSTANCE.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-private-accounts-H_WIRE.c b/src/lib/merchant_api_patch-private-accounts-H_WIRE.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-private-accounts-H_WIRE.h> +#include <taler/merchant/patch-private-accounts-H_WIRE.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-private-orders-ORDER_ID-forget.c b/src/lib/merchant_api_patch-private-orders-ORDER_ID-forget.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-private-orders-ORDER_ID-forget.h> +#include <taler/merchant/patch-private-orders-ORDER_ID-forget.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-private-otp-devices-DEVICE_ID.c b/src/lib/merchant_api_patch-private-otp-devices-DEVICE_ID.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/patch-private-otp-devices-DEVICE_ID.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-private-products-PRODUCT_ID.c b/src/lib/merchant_api_patch-private-products-PRODUCT_ID.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-private-products-PRODUCT_ID.h> +#include <taler/merchant/patch-private-products-PRODUCT_ID.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-private-templates-TEMPLATE_ID.c b/src/lib/merchant_api_patch-private-templates-TEMPLATE_ID.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/patch-private-templates-TEMPLATE_ID.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-private-units-UNIT.c b/src/lib/merchant_api_patch-private-units-UNIT.c @@ -24,7 +24,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-private-units-UNIT.h> +#include <taler/merchant/patch-private-units-UNIT.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_patch-private-webhooks-WEBHOOK_ID.c b/src/lib/merchant_api_patch-private-webhooks-WEBHOOK_ID.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/patch-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/patch-private-webhooks-WEBHOOK_ID.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-management-instances-INSTANCE-auth.c b/src/lib/merchant_api_post-management-instances-INSTANCE-auth.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-management-instances-INSTANCE-auth.h> +#include <taler/merchant/post-management-instances-INSTANCE-auth.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-management-instances.c b/src/lib/merchant_api_post-management-instances.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-management-instances.h> +#include <taler/merchant/post-management-instances.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-orders-ORDER_ID-abort.c b/src/lib/merchant_api_post-orders-ORDER_ID-abort.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-abort.h> +#include <taler/merchant/post-orders-ORDER_ID-abort.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-orders-ORDER_ID-claim.c b/src/lib/merchant_api_post-orders-ORDER_ID-claim.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-claim.h> +#include <taler/merchant/post-orders-ORDER_ID-claim.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-orders-ORDER_ID-paid.c b/src/lib/merchant_api_post-orders-ORDER_ID-paid.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-paid.h> +#include <taler/merchant/post-orders-ORDER_ID-paid.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-orders-ORDER_ID-pay.c b/src/lib/merchant_api_post-orders-ORDER_ID-pay.c @@ -28,7 +28,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-pay.h> +#include <taler/merchant/post-orders-ORDER_ID-pay.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-orders-ORDER_ID-refund.c b/src/lib/merchant_api_post-orders-ORDER_ID-refund.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-refund.h> +#include <taler/merchant/post-orders-ORDER_ID-refund.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-accounts.c b/src/lib/merchant_api_post-private-accounts.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-accounts.h> +#include <taler/merchant/post-private-accounts.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-categories.c b/src/lib/merchant_api_post-private-categories.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-categories.h> +#include <taler/merchant/post-private-categories.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-donau.c b/src/lib/merchant_api_post-private-donau.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-donau.h> +#include <taler/merchant/post-private-donau.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-orders-ORDER_ID-refund.c b/src/lib/merchant_api_post-private-orders-ORDER_ID-refund.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-orders-ORDER_ID-refund.h> +#include <taler/merchant/post-private-orders-ORDER_ID-refund.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-orders.c b/src/lib/merchant_api_post-private-orders.c @@ -25,7 +25,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-orders.h> +#include <taler/merchant/post-private-orders.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-otp-devices.c b/src/lib/merchant_api_post-private-otp-devices.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-otp-devices.h> +#include <taler/merchant/post-private-otp-devices.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-products-PRODUCT_ID-lock.c b/src/lib/merchant_api_post-private-products-PRODUCT_ID-lock.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-products-PRODUCT_ID-lock.h> +#include <taler/merchant/post-private-products-PRODUCT_ID-lock.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-products.c b/src/lib/merchant_api_post-private-products.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-products.h> +#include <taler/merchant/post-private-products.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-templates.c b/src/lib/merchant_api_post-private-templates.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-templates.h> +#include <taler/merchant/post-private-templates.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-token.c b/src/lib/merchant_api_post-private-token.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-token.h> +#include <taler/merchant/post-private-token.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-tokenfamilies.c b/src/lib/merchant_api_post-private-tokenfamilies.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-tokenfamilies.h> +#include <taler/merchant/post-private-tokenfamilies.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-transfers.c b/src/lib/merchant_api_post-private-transfers.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-transfers.h> +#include <taler/merchant/post-private-transfers.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-units.c b/src/lib/merchant_api_post-private-units.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-units.h> +#include <taler/merchant/post-private-units.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-private-webhooks.c b/src/lib/merchant_api_post-private-webhooks.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-private-webhooks.h> +#include <taler/merchant/post-private-webhooks.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post-templates-TEMPLATE_ID.c b/src/lib/merchant_api_post-templates-TEMPLATE_ID.c @@ -27,7 +27,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> -#include <taler/taler-merchant/post-templates-TEMPLATE_ID.h> +#include <taler/merchant/post-templates-TEMPLATE_ID.h> #include "merchant_api_curl_defaults.h" #include "merchant_api_common.h" #include <taler/taler_json_lib.h> diff --git a/src/testing/testing_api_cmd_abort_order.c b/src/testing/testing_api_cmd_abort_order.c @@ -27,7 +27,7 @@ #include <taler/taler_signatures.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-orders-ORDER_ID-abort.h> +#include <taler/merchant/post-orders-ORDER_ID-abort.h> /** * State for a " abort" CMD. diff --git a/src/testing/testing_api_cmd_claim_order.c b/src/testing/testing_api_cmd_claim_order.c @@ -27,7 +27,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-orders-ORDER_ID-claim.h> +#include <taler/merchant/post-orders-ORDER_ID-claim.h> /** * State for a "order claim" CMD. Not used by diff --git a/src/testing/testing_api_cmd_config.c b/src/testing/testing_api_cmd_config.c @@ -27,7 +27,7 @@ #include <taler/taler_exchange_service.h> #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-config.h> +#include <taler/merchant/get-config.h> /** diff --git a/src/testing/testing_api_cmd_delete_account.c b/src/testing/testing_api_cmd_delete_account.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-accounts-H_WIRE.h> +#include <taler/merchant/delete-private-accounts-H_WIRE.h> /** diff --git a/src/testing/testing_api_cmd_delete_donau_instances.c b/src/testing/testing_api_cmd_delete_donau_instances.c @@ -24,7 +24,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-donau-DONAU_SERIAL.h> +#include <taler/merchant/delete-private-donau-DONAU_SERIAL.h> /** * State for DELETE /donau/$charity_id testing command. diff --git a/src/testing/testing_api_cmd_delete_instance.c b/src/testing/testing_api_cmd_delete_instance.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-management-instances-INSTANCE.h> +#include <taler/merchant/delete-management-instances-INSTANCE.h> /** diff --git a/src/testing/testing_api_cmd_delete_order.c b/src/testing/testing_api_cmd_delete_order.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-orders-ORDER_ID.h> +#include <taler/merchant/delete-private-orders-ORDER_ID.h> /** diff --git a/src/testing/testing_api_cmd_delete_otp_device.c b/src/testing/testing_api_cmd_delete_otp_device.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/delete-private-otp-devices-DEVICE_ID.h> /** diff --git a/src/testing/testing_api_cmd_delete_product.c b/src/testing/testing_api_cmd_delete_product.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-products-PRODUCT_ID.h> +#include <taler/merchant/delete-private-products-PRODUCT_ID.h> /** diff --git a/src/testing/testing_api_cmd_delete_template.c b/src/testing/testing_api_cmd_delete_template.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/delete-private-templates-TEMPLATE_ID.h> /** diff --git a/src/testing/testing_api_cmd_delete_transfer.c b/src/testing/testing_api_cmd_delete_transfer.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-transfers-TID.h> +#include <taler/merchant/delete-private-transfers-TID.h> /** diff --git a/src/testing/testing_api_cmd_delete_unit.c b/src/testing/testing_api_cmd_delete_unit.c @@ -25,7 +25,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-units-UNIT.h> +#include <taler/merchant/delete-private-units-UNIT.h> /** diff --git a/src/testing/testing_api_cmd_delete_webhook.c b/src/testing/testing_api_cmd_delete_webhook.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/delete-private-webhooks-WEBHOOK_ID.h> /** diff --git a/src/testing/testing_api_cmd_forget_order.c b/src/testing/testing_api_cmd_forget_order.c @@ -27,7 +27,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/patch-private-orders-ORDER_ID-forget.h> +#include <taler/merchant/patch-private-orders-ORDER_ID-forget.h> /** diff --git a/src/testing/testing_api_cmd_get_donau_instances.c b/src/testing/testing_api_cmd_get_donau_instances.c @@ -27,7 +27,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-donau.h> +#include <taler/merchant/get-private-donau.h> /** * State of a "GET donau instances" CMD. diff --git a/src/testing/testing_api_cmd_get_instance.c b/src/testing/testing_api_cmd_get_instance.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-management-instances-INSTANCE.h> +#include <taler/merchant/get-management-instances-INSTANCE.h> /** diff --git a/src/testing/testing_api_cmd_get_instances.c b/src/testing/testing_api_cmd_get_instances.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-management-instances.h> +#include <taler/merchant/get-management-instances.h> /** diff --git a/src/testing/testing_api_cmd_get_orders.c b/src/testing/testing_api_cmd_get_orders.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-orders.h> +#include <taler/merchant/get-private-orders.h> /** diff --git a/src/testing/testing_api_cmd_get_otp_device.c b/src/testing/testing_api_cmd_get_otp_device.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/get-private-otp-devices-DEVICE_ID.h> /** diff --git a/src/testing/testing_api_cmd_get_otp_devices.c b/src/testing/testing_api_cmd_get_otp_devices.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-otp-devices.h> +#include <taler/merchant/get-private-otp-devices.h> /** diff --git a/src/testing/testing_api_cmd_get_product.c b/src/testing/testing_api_cmd_get_product.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-products-PRODUCT_ID.h> +#include <taler/merchant/get-private-products-PRODUCT_ID.h> /** diff --git a/src/testing/testing_api_cmd_get_product_image.c b/src/testing/testing_api_cmd_get_product_image.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-products-IMAGE_HASH-image.h> +#include <taler/merchant/get-products-IMAGE_HASH-image.h> /** diff --git a/src/testing/testing_api_cmd_get_products.c b/src/testing/testing_api_cmd_get_products.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-products.h> +#include <taler/merchant/get-private-products.h> /** diff --git a/src/testing/testing_api_cmd_get_statisticsamount.c b/src/testing/testing_api_cmd_get_statisticsamount.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-statistics-amount-SLUG.h> +#include <taler/merchant/get-private-statistics-amount-SLUG.h> /** diff --git a/src/testing/testing_api_cmd_get_statisticscounter.c b/src/testing/testing_api_cmd_get_statisticscounter.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-statistics-counter-SLUG.h> +#include <taler/merchant/get-private-statistics-counter-SLUG.h> /** diff --git a/src/testing/testing_api_cmd_get_template.c b/src/testing/testing_api_cmd_get_template.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/get-private-templates-TEMPLATE_ID.h> /** diff --git a/src/testing/testing_api_cmd_get_templates.c b/src/testing/testing_api_cmd_get_templates.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-templates.h> +#include <taler/merchant/get-private-templates.h> /** diff --git a/src/testing/testing_api_cmd_get_transfers.c b/src/testing/testing_api_cmd_get_transfers.c @@ -27,7 +27,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-transfers.h> +#include <taler/merchant/get-private-transfers.h> /** diff --git a/src/testing/testing_api_cmd_get_unit.c b/src/testing/testing_api_cmd_get_unit.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-units-UNIT.h> +#include <taler/merchant/get-private-units-UNIT.h> /** diff --git a/src/testing/testing_api_cmd_get_units.c b/src/testing/testing_api_cmd_get_units.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-units.h> +#include <taler/merchant/get-private-units.h> /** diff --git a/src/testing/testing_api_cmd_get_webhook.c b/src/testing/testing_api_cmd_get_webhook.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/get-private-webhooks-WEBHOOK_ID.h> /** diff --git a/src/testing/testing_api_cmd_get_webhooks.c b/src/testing/testing_api_cmd_get_webhooks.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-webhooks.h> +#include <taler/merchant/get-private-webhooks.h> /** diff --git a/src/testing/testing_api_cmd_instance_auth.c b/src/testing/testing_api_cmd_instance_auth.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-management-instances-INSTANCE-auth.h> +#include <taler/merchant/post-management-instances-INSTANCE-auth.h> /** diff --git a/src/testing/testing_api_cmd_instance_token.c b/src/testing/testing_api_cmd_instance_token.c @@ -26,8 +26,8 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/delete-private-tokens-SERIAL.h> -#include <taler/taler-merchant/post-private-token.h> +#include <taler/merchant/delete-private-tokens-SERIAL.h> +#include <taler/merchant/post-private-token.h> /** diff --git a/src/testing/testing_api_cmd_kyc_get.c b/src/testing/testing_api_cmd_kyc_get.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-kyc.h> +#include <taler/merchant/get-private-kyc.h> /** diff --git a/src/testing/testing_api_cmd_lock_product.c b/src/testing/testing_api_cmd_lock_product.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-products-PRODUCT_ID-lock.h> +#include <taler/merchant/post-private-products-PRODUCT_ID-lock.h> /** diff --git a/src/testing/testing_api_cmd_merchant_get_order.c b/src/testing/testing_api_cmd_merchant_get_order.c @@ -25,7 +25,7 @@ #include <taler/taler_exchange_service.h> #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-private-orders-ORDER_ID.h> +#include <taler/merchant/get-private-orders-ORDER_ID.h> /** diff --git a/src/testing/testing_api_cmd_patch_instance.c b/src/testing/testing_api_cmd_patch_instance.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/patch-management-instances-INSTANCE.h> +#include <taler/merchant/patch-management-instances-INSTANCE.h> /** diff --git a/src/testing/testing_api_cmd_patch_otp_device.c b/src/testing/testing_api_cmd_patch_otp_device.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/patch-private-otp-devices-DEVICE_ID.h> +#include <taler/merchant/patch-private-otp-devices-DEVICE_ID.h> /** diff --git a/src/testing/testing_api_cmd_patch_product.c b/src/testing/testing_api_cmd_patch_product.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/patch-private-products-PRODUCT_ID.h> +#include <taler/merchant/patch-private-products-PRODUCT_ID.h> /** diff --git a/src/testing/testing_api_cmd_patch_template.c b/src/testing/testing_api_cmd_patch_template.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/patch-private-templates-TEMPLATE_ID.h> +#include <taler/merchant/patch-private-templates-TEMPLATE_ID.h> /** diff --git a/src/testing/testing_api_cmd_patch_unit.c b/src/testing/testing_api_cmd_patch_unit.c @@ -25,7 +25,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/patch-private-units-UNIT.h> +#include <taler/merchant/patch-private-units-UNIT.h> /** diff --git a/src/testing/testing_api_cmd_patch_webhook.c b/src/testing/testing_api_cmd_patch_webhook.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/patch-private-webhooks-WEBHOOK_ID.h> +#include <taler/merchant/patch-private-webhooks-WEBHOOK_ID.h> /** diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c @@ -34,7 +34,7 @@ #include <taler/taler_signatures.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-orders-ORDER_ID-pay.h> +#include <taler/merchant/post-orders-ORDER_ID-pay.h> #include <donau/donau_service.h> #include <donau/donau_testing_lib.h> #include <donau/donau_json_lib.h> diff --git a/src/testing/testing_api_cmd_post_account.c b/src/testing/testing_api_cmd_post_account.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-accounts.h> +#include <taler/merchant/post-private-accounts.h> /** diff --git a/src/testing/testing_api_cmd_post_categories.c b/src/testing/testing_api_cmd_post_categories.c @@ -24,7 +24,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-categories.h> +#include <taler/merchant/post-private-categories.h> /** * State of a "POST /private/categories" CMD. diff --git a/src/testing/testing_api_cmd_post_donau_instances.c b/src/testing/testing_api_cmd_post_donau_instances.c @@ -29,7 +29,7 @@ #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" #include <donau/donau_testing_lib.h> -#include <taler/taler-merchant/post-private-donau.h> +#include <taler/merchant/post-private-donau.h> /** diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-management-instances.h> +#include <taler/merchant/post-management-instances.h> /** diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c @@ -35,8 +35,8 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-orders.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-claim.h> +#include <taler/merchant/post-private-orders.h> +#include <taler/merchant/post-orders-ORDER_ID-claim.h> /** * State for a "POST /orders" CMD. diff --git a/src/testing/testing_api_cmd_post_orders_paid.c b/src/testing/testing_api_cmd_post_orders_paid.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-orders-ORDER_ID-paid.h> +#include <taler/merchant/post-orders-ORDER_ID-paid.h> /** diff --git a/src/testing/testing_api_cmd_post_otp_devices.c b/src/testing/testing_api_cmd_post_otp_devices.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-otp-devices.h> +#include <taler/merchant/post-private-otp-devices.h> /** diff --git a/src/testing/testing_api_cmd_post_products.c b/src/testing/testing_api_cmd_post_products.c @@ -25,7 +25,7 @@ #include <taler/taler_exchange_service.h> #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-products.h> +#include <taler/merchant/post-private-products.h> /** diff --git a/src/testing/testing_api_cmd_post_templates.c b/src/testing/testing_api_cmd_post_templates.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-templates.h> +#include <taler/merchant/post-private-templates.h> /** diff --git a/src/testing/testing_api_cmd_post_tokenfamilies.c b/src/testing/testing_api_cmd_post_tokenfamilies.c @@ -28,7 +28,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-tokenfamilies.h> +#include <taler/merchant/post-private-tokenfamilies.h> /** diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-transfers.h> +#include <taler/merchant/post-private-transfers.h> /** diff --git a/src/testing/testing_api_cmd_post_units.c b/src/testing/testing_api_cmd_post_units.c @@ -25,7 +25,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-units.h> +#include <taler/merchant/post-private-units.h> /** diff --git a/src/testing/testing_api_cmd_post_using_templates.c b/src/testing/testing_api_cmd_post_using_templates.c @@ -26,8 +26,8 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-templates-TEMPLATE_ID.h> -#include <taler/taler-merchant/post-orders-ORDER_ID-claim.h> +#include <taler/merchant/post-templates-TEMPLATE_ID.h> +#include <taler/merchant/post-orders-ORDER_ID-claim.h> /** diff --git a/src/testing/testing_api_cmd_post_webhooks.c b/src/testing/testing_api_cmd_post_webhooks.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-webhooks.h> +#include <taler/merchant/post-private-webhooks.h> /** diff --git a/src/testing/testing_api_cmd_refund_order.c b/src/testing/testing_api_cmd_refund_order.c @@ -27,7 +27,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-private-orders-ORDER_ID-refund.h> +#include <taler/merchant/post-private-orders-ORDER_ID-refund.h> /** diff --git a/src/testing/testing_api_cmd_wallet_get_order.c b/src/testing/testing_api_cmd_wallet_get_order.c @@ -26,7 +26,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-orders-ORDER_ID.h> +#include <taler/merchant/get-orders-ORDER_ID.h> /** diff --git a/src/testing/testing_api_cmd_wallet_get_template.c b/src/testing/testing_api_cmd_wallet_get_template.c @@ -24,7 +24,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/get-templates-TEMPLATE_ID.h> +#include <taler/merchant/get-templates-TEMPLATE_ID.h> /** * State of a "GET template" wallet CMD. diff --git a/src/testing/testing_api_cmd_wallet_post_orders_refund.c b/src/testing/testing_api_cmd_wallet_post_orders_refund.c @@ -27,7 +27,7 @@ #include <taler/taler_testing_lib.h> #include "taler/taler_merchant_service.h" #include "taler/taler_merchant_testing_lib.h" -#include <taler/taler-merchant/post-orders-ORDER_ID-refund.h> +#include <taler/merchant/post-orders-ORDER_ID-refund.h> /**