merchant

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

update_product_group.sql (1304B)


      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 DROP FUNCTION IF EXISTS merchant_do_update_product_group;
     18 CREATE FUNCTION merchant_do_update_product_group (
     19   IN in_product_group_serial INT8,
     20   IN in_name TEXT,
     21   IN in_description TEXT,
     22   OUT out_conflict BOOL,
     23   OUT out_not_found BOOL)
     24 LANGUAGE plpgsql
     25 AS $$
     26 BEGIN
     27 
     28 BEGIN
     29   UPDATE merchant_product_groups SET
     30     product_group_name=in_name
     31    ,product_group_description=in_description
     32    WHERE product_group_serial=in_product_group_serial;
     33   out_not_found = NOT FOUND;
     34   out_conflict = FALSE;
     35   RETURN;
     36 EXCEPTION
     37   WHEN unique_violation
     38   THEN
     39     out_conflict = TRUE;
     40     RETURN;
     41 END;
     42 
     43 
     44 END $$;