merchant

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

lookup_inventory_products_filtered.h (2902B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2025 Taler Systems SA
      4 
      5    TALER is free software; you can redistribute it and/or modify it under the
      6    terms of the GNU General Public License as published by the Free Software
      7    Foundation; either version 3, or (at your option) any later version.
      8 
      9    TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11    A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 
     13    You should have received a copy of the GNU General Public License along with
     14    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15  */
     16 /**
     17  * @file src/include/merchant-database/lookup_inventory_products_filtered.h
     18  * @brief Lookup inventory product details for templates (filtered)
     19  * @author Bohdan Potuzhnyi
     20  */
     21 #ifndef MERCHANT_DATABASE_LOOKUP_INVENTORY_PRODUCTS_FILTERED_H
     22 #define MERCHANT_DATABASE_LOOKUP_INVENTORY_PRODUCTS_FILTERED_H
     23 
     24 #include "merchantdb_lib.h"
     25 
     26 
     27 struct TALER_MERCHANTDB_PostgresContext;
     28 /* Callback typedefs */
     29 /**
     30  * Typically called by `lookup_inventory_products`.
     31  *
     32  * @param cls a `json_t *` JSON array to build
     33  * @param product_id ID of the product
     34  * @param pd inventory product details
     35  * @param num_categories length of @a categories array
     36  * @param categories array of categories the
     37  *   product is in
     38  */
     39 typedef void
     40 (*TALER_MERCHANTDB_InventoryProductCallback)(
     41   void *cls,
     42   const char *product_id,
     43   const struct TALER_MERCHANTDB_InventoryProductDetails *pd,
     44   size_t num_categories,
     45   const uint64_t *categories);
     46 
     47 /**
     48  * Lookup inventory details for a subset of products.
     49  *
     50  * @param pg database context
     51  * @param instance_id instance to lookup products for
     52  * @param product_ids product IDs to include (can be NULL/empty)
     53  * @param num_product_ids number of entries in @a product_ids
     54  * @param categories category IDs to include (can be NULL/empty)
     55  * @param num_categories number of entries in @a categories
     56  * @param cb function to call on all products found
     57  * @param cb_cls closure for @a cb
     58  * @return database result code
     59  */
     60 enum GNUNET_DB_QueryStatus
     61 TALER_MERCHANTDB_lookup_inventory_products_filtered (struct TALER_MERCHANTDB_PostgresContext *pg,
     62                                                      const char *instance_id,
     63                                                      const char *const *product_ids,
     64                                                      size_t num_product_ids,
     65                                                      const uint64_t *categories,
     66                                                      size_t num_categories,
     67                                                      TALER_MERCHANTDB_InventoryProductCallback cb,
     68                                                      void *cb_cls);
     69 
     70 #endif  /* MERCHANT_DATABASE_LOOKUP_INVENTORY_PRODUCTS_FILTERED_H */