
CREATE TABLE IF NOT EXISTS "wspay"
(
    "id" uuid NOT NULL,
    "shop_id" varchar(128) NOT NULL,
    "shopping_card_id" varchar(128) NOT NULL,
    "total_amount" int NOT NULL,

    "lang" varchar(128) DEFAULT '',

    "customer_first_name" varchar(128) DEFAULT '',
    "customer_last_name" varchar(128) DEFAULT '',
    "customer_address" varchar(128) DEFAULT '',
    "customer_city" varchar(128) DEFAULT '',
    "customer_zip" varchar(128) DEFAULT '',
    "customer_country" varchar(128) DEFAULT '',
    "customer_phone" varchar(128) DEFAULT '',

    "payment_plan" varchar(128) DEFAULT '',
    "credit_card_name" varchar(128) DEFAULT '',
    "credit_card_number" varchar(128) DEFAULT '',
    "payment_method" varchar(128) DEFAULT '',
    "currency_code" int DEFAULT 0,

    "date_time" timestamp DEFAULT current_timestamp,

    "eci" varchar(256) DEFAULT '',
    "stan" varchar(256) DEFAULT '',

    "success" int DEFAULT 0,
    "approval_code" varchar(256) DEFAULT '',
    "error_message" varchar(256) DEFAULT '',
    "error_codes" varchar(256) DEFAULT '',

    "payment_state" varchar(256) DEFAULT '',

    PRIMARY KEY (id),
    CONSTRAINT unique_id UNIQUE ("shopping_card_id")
);


CREATE TABLE IF NOT EXISTS "stripe"
(
    "id" uuid NOT NULL,
    "total_amount" int NOT NULL,

    "lang" varchar(128) DEFAULT '',

    "payment_intent_id" varchar(256) DEFAULT '',

    "payment_state" varchar(256) DEFAULT '',

    PRIMARY KEY (id)
);
