@opengis/pay 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -12
- package/module/pay/pt/marketplace-service-payment-client-template.html +5 -5
- package/package.json +9 -7
- package/plugin.js +2 -0
- package/server/migrations/7_transactions.sql +35 -0
- package/server/plugins/hook.js +27 -10
- package/server/plugins/payment/createPayment.js +29 -0
- package/server/plugins/payment/createTransaction.js +26 -0
- package/server/plugins/payment/liqpay.checkStatus.js +43 -0
- package/server/plugins/payment/liqpay.createTransaction.js +103 -0
- package/server/plugins/payment/monopay.checkStatus.js +48 -0
- package/server/plugins/payment/monopay.createTransaction.js +116 -0
- package/server/plugins/payment/paymentInfo.js +26 -0
- package/server/plugins/payment/portmone.checkStatus.js +51 -0
- package/server/plugins/payment/portmone.createTransaction.js +94 -0
- package/server/plugins/payment/processTransaction.js +73 -0
- package/server/routes/{portmone → core}/controllers/payment.info.js +32 -29
- package/server/routes/core/index.mjs +12 -0
- package/server/routes/liqpay/controllers/liqpay.redirect.js +25 -115
- package/server/routes/liqpay/controllers/liqpay.status.js +31 -150
- package/server/routes/monopay/controllers/monopay.redirect.js +25 -117
- package/server/routes/monopay/controllers/monopay.status.js +8 -56
- package/server/routes/portmone/controllers/portmone.redirect.js +27 -116
- package/server/routes/portmone/controllers/portmone.status.js +36 -136
- package/server/routes/portmone/index.mjs +5 -6
- package/utils.js +11 -0
- package/server/migrations/1_users.sql +0 -121
- package/server/migrations/2_accounts.sql +0 -59
- package/server/migrations/3_utils.sql +0 -74
- package/server/migrations/4_subscriptions.sql +0 -36
- package/server/migrations/5_payments.sql +0 -39
- package/server/migrations/6_invoices.sql +0 -55
- package/server/routes/liqpay/utils/check.status.js +0 -34
- package/server/routes/portmone/utils/portmone.check.status.js +0 -34
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
1
|
+
/* import path from 'node:path';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
|
|
5
|
-
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url)); */
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import pgClients from '../../../plugins/pg/pgClients.js';
|
|
9
|
-
import dataUpdate from '../../../plugins/crud/dataUpdate.js';
|
|
7
|
+
import processTransaction from '../../../plugins/payment/processTransaction.js';
|
|
10
8
|
|
|
11
|
-
import sendNotification from '../../../utils/sendNotification.js';
|
|
9
|
+
// import sendNotification from '../../../utils/sendNotification.js';
|
|
12
10
|
|
|
13
|
-
const ptBody = readFileSync(path.join(dirname, '../../../../module/pay/pt/marketplace-service-payment-client-template.html'), { encoding: 'utf8' });
|
|
11
|
+
// const ptBody = readFileSync(path.join(dirname, '../../../../module/pay/pt/marketplace-service-payment-client-template.html'), { encoding: 'utf8' });
|
|
14
12
|
|
|
15
|
-
const newDate = () => {
|
|
13
|
+
/* const newDate = () => {
|
|
16
14
|
const date = new Date();
|
|
17
15
|
const tzOffset = date.getTimezoneOffset();
|
|
18
16
|
const currentTimeWithTimezome = date - tzOffset * 60 * 1000;
|
|
19
17
|
return new Date(currentTimeWithTimezome).toISOString();
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const { host } = config.integrations?.pay || {};
|
|
18
|
+
}; */
|
|
23
19
|
|
|
24
20
|
/**
|
|
25
21
|
* Апі перенаправлює з portmone назад на сторінку замовлення
|
|
@@ -40,139 +36,43 @@ const { host } = config.integrations?.pay || {};
|
|
|
40
36
|
|
|
41
37
|
export default async function portmoneStatus(req, reply) {
|
|
42
38
|
const {
|
|
43
|
-
|
|
39
|
+
params = {}, headers = {}, body = {},
|
|
44
40
|
} = req;
|
|
45
41
|
|
|
46
|
-
if (!host) {
|
|
47
|
-
return { message: 'empty integration host', status: 400 };
|
|
48
|
-
}
|
|
49
|
-
|
|
50
42
|
const origin = headers?.origin || headers?.referer;
|
|
51
43
|
const responseStatus = body?.status || params?.status;
|
|
52
|
-
const paymentId = body?.shopOrderNumber || params?.id;
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
const data = await pg.query('select * from billing.payments where payment_id=$1', [paymentId])
|
|
56
|
-
.then(el => el.rows?.[0] || {});
|
|
57
|
-
|
|
58
|
-
const {
|
|
59
|
-
payment_id: trx,
|
|
60
|
-
payment_amount: refillSum,
|
|
61
|
-
referer_url: redirectUrl,
|
|
62
|
-
payment_status: trxStatus,
|
|
63
|
-
account_id: accountId,
|
|
64
|
-
} = data;
|
|
65
|
-
|
|
66
|
-
if (trxStatus === 'success') {
|
|
67
|
-
console.log(
|
|
68
|
-
'payments/skip',
|
|
69
|
-
'status',
|
|
70
|
-
'portmone',
|
|
71
|
-
paymentId,
|
|
72
|
-
origin,
|
|
73
|
-
user?.uid || '0',
|
|
74
|
-
'Transaction was already processed',
|
|
75
|
-
);
|
|
76
|
-
return { message: 'Transaction was already processed', status: 400 };
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (!trx) {
|
|
80
|
-
return { message: 'Transaction not found', status: 400 };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const refill = responseStatus === 'success' ? (body?.billAmount || refillSum || 0) : 0;
|
|
84
44
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'payments/warn',
|
|
89
|
-
'status',
|
|
90
|
-
'portmone',
|
|
91
|
-
paymentId,
|
|
92
|
-
origin,
|
|
93
|
-
user?.uid || '0',
|
|
94
|
-
refill,
|
|
95
|
-
'invalid referer',
|
|
96
|
-
);
|
|
97
|
-
if (!config.auth?.disableRestricted) return { message: 'access restricted: host', status: 403 };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
console.log(
|
|
101
|
-
'payments/info',
|
|
102
|
-
'status',
|
|
103
|
-
'portmone',
|
|
104
|
-
paymentId,
|
|
105
|
-
origin,
|
|
106
|
-
user?.uid || '0',
|
|
107
|
-
refill,
|
|
108
|
-
body,
|
|
109
|
-
params,
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
// last trx contains total balance
|
|
113
|
-
const { total_balance: totalBalance } = await pg.query(`select total_balance from billing.payments
|
|
114
|
-
where account_id=$1 and payment_status in ('success', 'error') and total_balance is not null order by cdate desc limit 1`, [accountId])
|
|
115
|
-
.then(el => el.rows?.[0] || {});
|
|
45
|
+
if (responseStatus !== 'success') {
|
|
46
|
+
return reply.status(400).send('transaction aborted');
|
|
47
|
+
}
|
|
116
48
|
|
|
117
|
-
|
|
118
|
-
table: 'billing.payments',
|
|
119
|
-
data: {
|
|
120
|
-
payment_data: body,
|
|
121
|
-
payment_status: responseStatus,
|
|
122
|
-
total_balance: +(refill) + (+totalBalance || 0),
|
|
123
|
-
success_date: newDate(),
|
|
124
|
-
},
|
|
125
|
-
id: paymentId,
|
|
126
|
-
uid: user?.uid || '0',
|
|
127
|
-
});
|
|
49
|
+
const paymentId = body?.shopOrderNumber || params?.id;
|
|
128
50
|
|
|
129
|
-
|
|
130
|
-
console.log(`id:${trx}, status: ${responseStatus}, before: ${totalBalance || 0}, after: ${+(refill) + (+totalBalance || 0)} (${body?.billAmount || refillSum || 0})`);
|
|
131
|
-
}
|
|
51
|
+
const trx = await processTransaction(paymentId, origin);
|
|
132
52
|
|
|
133
|
-
|
|
134
|
-
|
|
53
|
+
if (!trx) {
|
|
54
|
+
return reply.status(404).send('Transaction not found');
|
|
55
|
+
}
|
|
135
56
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
57
|
+
/*
|
|
58
|
+
const { account_email: to } = {};
|
|
59
|
+
if (to) {
|
|
60
|
+
const pt = (ptBody || 'empty template')
|
|
61
|
+
.replace(/{{domain}}/g, req.hostname)
|
|
62
|
+
.replace(/{{balance}}/g, trx.balance)
|
|
63
|
+
.replace(/{{username}}/g, to)
|
|
64
|
+
.replace(/{{created_at}}/g, (trx?.created_at || new Date()).toLocaleString('uk-UA'))
|
|
65
|
+
.replace(/{{status}}/g, responseStatus)
|
|
66
|
+
.replace(/{{amount}}/g, trx.amount || 0);
|
|
67
|
+
const options = {
|
|
68
|
+
pg,
|
|
142
69
|
to,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
.replace(/{{total_balance}}/g, +(refillSum || 0) + (+totalBalance || 0))
|
|
152
|
-
.replace(/{{username}}/g, to)
|
|
153
|
-
.replace(/{{created_at}}/g, (data?.cdate || data?.created_at || new Date()).toLocaleString('uk-UA'))
|
|
154
|
-
.replace(/{{payment_status}}/g, responseStatus)
|
|
155
|
-
.replace(/{{payment_amount}}/g, refillSum || 0);
|
|
156
|
-
const options = {
|
|
157
|
-
pg,
|
|
158
|
-
to,
|
|
159
|
-
title: `Поповнення рахунку на порталі ${req.hostname}`,
|
|
160
|
-
pt,
|
|
161
|
-
nocache: config?.local,
|
|
162
|
-
};
|
|
163
|
-
await sendNotification(options);
|
|
164
|
-
}
|
|
165
|
-
return reply.redirect(redirectUrl || '/');
|
|
166
|
-
}
|
|
167
|
-
catch (err) {
|
|
168
|
-
console.error('payments/error', JSON.stringify({
|
|
169
|
-
type: 'status',
|
|
170
|
-
service: 'portmone',
|
|
171
|
-
paymentId,
|
|
172
|
-
origin,
|
|
173
|
-
responseStatus,
|
|
174
|
-
uid: user?.uid || '0',
|
|
175
|
-
}), err.toString(), err.stack);
|
|
176
|
-
return reply.status(500).send(err.toString());
|
|
177
|
-
}
|
|
70
|
+
title: `Поповнення рахунку на порталі ${req.hostname}`,
|
|
71
|
+
pt,
|
|
72
|
+
nocache: config?.local,
|
|
73
|
+
};
|
|
74
|
+
await sendNotification(options);
|
|
75
|
+
} */
|
|
76
|
+
|
|
77
|
+
return reply.redirect(trx.referer_url || '/');
|
|
178
78
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import portmoneRedirect from './controllers/portmone.redirect.js';
|
|
2
2
|
import portmoneStatus from './controllers/portmone.status.js';
|
|
3
|
-
import paymentInfo from './controllers/payment.info.js';
|
|
4
3
|
|
|
5
4
|
export default async function plugin(app, opts) {
|
|
6
5
|
app.route({
|
|
@@ -12,15 +11,15 @@ export default async function plugin(app, opts) {
|
|
|
12
11
|
handler: portmoneRedirect,
|
|
13
12
|
});
|
|
14
13
|
app.route({
|
|
15
|
-
method: '
|
|
16
|
-
url: '/
|
|
14
|
+
method: 'POST',
|
|
15
|
+
url: '/portmone/:id/:status',
|
|
17
16
|
config: {
|
|
18
|
-
policy: ['
|
|
17
|
+
policy: ['public'],
|
|
19
18
|
},
|
|
20
|
-
handler:
|
|
19
|
+
handler: portmoneStatus,
|
|
21
20
|
});
|
|
22
21
|
app.route({
|
|
23
|
-
method: '
|
|
22
|
+
method: 'GET',
|
|
24
23
|
url: '/portmone/:id/:status',
|
|
25
24
|
config: {
|
|
26
25
|
policy: ['public'],
|
package/utils.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import paymentInfo from './server/plugins/payment/paymentInfo.js';
|
|
2
|
+
import processTransaction from './server/plugins/payment/processTransaction.js';
|
|
3
|
+
import createTransaction from './server/plugins/payment/createTransaction.js';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
paymentInfo, processTransaction, createTransaction,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
paymentInfo, processTransaction, createTransaction,
|
|
11
|
+
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
create schema if not exists billing;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE if not exists billing.users();
|
|
4
|
-
ALTER TABLE billing.users DROP CONSTRAINT if exists billing_user_id_pkey cascade;
|
|
5
|
-
|
|
6
|
-
ALTER TABLE billing.users add column if not exists user_id text NOT NULL DEFAULT next_id();
|
|
7
|
-
ALTER TABLE billing.users add column if not exists login text;
|
|
8
|
-
ALTER TABLE billing.users add column if not exists password text NOT NULL DEFAULT ''::text;
|
|
9
|
-
ALTER TABLE billing.users add column if not exists user_name text;
|
|
10
|
-
ALTER TABLE billing.users add column if not exists sur_name text;
|
|
11
|
-
ALTER TABLE billing.users add column if not exists father_name text;
|
|
12
|
-
ALTER TABLE billing.users add column if not exists email text;
|
|
13
|
-
ALTER TABLE billing.users add column if not exists phone text;
|
|
14
|
-
ALTER TABLE billing.users add column if not exists avatar text;
|
|
15
|
-
ALTER TABLE billing.users add column if not exists enabled boolean;
|
|
16
|
-
ALTER TABLE billing.users add column if not exists user_personal_code text;
|
|
17
|
-
ALTER TABLE billing.users add column if not exists last_activity_date timestamp without time zone;
|
|
18
|
-
ALTER TABLE billing.users add column if not exists user_type text DEFAULT 'regular'::text;
|
|
19
|
-
ALTER TABLE billing.users add column if not exists salt text;
|
|
20
|
-
ALTER TABLE billing.users add column if not exists uid text;
|
|
21
|
-
ALTER TABLE billing.users add column if not exists cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
22
|
-
ALTER TABLE billing.users add column if not exists editor_id text;
|
|
23
|
-
ALTER TABLE billing.users add column if not exists editor_date timestamp without time zone;
|
|
24
|
-
ALTER TABLE billing.users add column if not exists files json;
|
|
25
|
-
|
|
26
|
-
COMMENT ON TABLE billing.users IS 'Користувачі';
|
|
27
|
-
|
|
28
|
-
COMMENT ON COLUMN billing.users.user_id IS 'ID користувача';
|
|
29
|
-
COMMENT ON COLUMN billing.users.login IS 'Логін користувача';
|
|
30
|
-
COMMENT ON COLUMN billing.users.password IS 'Пароль користувача';
|
|
31
|
-
COMMENT ON COLUMN billing.users.user_name IS 'Ім''я користувача';
|
|
32
|
-
COMMENT ON COLUMN billing.users.sur_name IS 'Прізвище користувача';
|
|
33
|
-
COMMENT ON COLUMN billing.users.father_name IS 'По-батькові користувача';
|
|
34
|
-
COMMENT ON COLUMN billing.users.email IS 'Ел. пошта користувача';
|
|
35
|
-
COMMENT ON COLUMN billing.users.phone IS 'Номер телефону користувача';
|
|
36
|
-
COMMENT ON COLUMN billing.users.avatar IS 'Аватар';
|
|
37
|
-
COMMENT ON COLUMN billing.users.enabled IS 'On / Off';
|
|
38
|
-
COMMENT ON COLUMN billing.users.last_activity_date IS 'Дата останньої активності';
|
|
39
|
-
COMMENT ON COLUMN billing.users.user_type IS 'Тип користувача';
|
|
40
|
-
COMMENT ON COLUMN billing.users.salt IS 'Сіль';
|
|
41
|
-
|
|
42
|
-
CREATE EXTENSION if not exists pgcrypto SCHEMA public VERSION "1.3";
|
|
43
|
-
CREATE OR REPLACE FUNCTION billing.crypt(text, text) RETURNS text AS '$libdir/pgcrypto', 'pg_crypt' LANGUAGE c IMMUTABLE STRICT COST 1;
|
|
44
|
-
|
|
45
|
-
CREATE OR REPLACE FUNCTION billing.insert_update_user_before()
|
|
46
|
-
RETURNS trigger AS
|
|
47
|
-
|
|
48
|
-
$BODY$
|
|
49
|
-
DECLARE
|
|
50
|
-
|
|
51
|
-
iterations int;
|
|
52
|
-
hash character varying;
|
|
53
|
-
|
|
54
|
-
BEGIN
|
|
55
|
-
|
|
56
|
-
if(TG_OP='INSERT' or (TG_OP='UPDATE' and new.password<>old.password)) then
|
|
57
|
-
if(char_length(new.password) <> 0 and char_length(new.password) < 8) then
|
|
58
|
-
--raise exception 'password must be longer than 8 characters';
|
|
59
|
-
end if;
|
|
60
|
-
new.salt=md5(now()::text);
|
|
61
|
-
--raise exception '%','change pass';
|
|
62
|
-
if(new.salt ='') then
|
|
63
|
-
new.salt=gen_salt('md5');
|
|
64
|
-
end if;
|
|
65
|
-
iterations = 10;
|
|
66
|
-
hash='';
|
|
67
|
-
|
|
68
|
-
loop
|
|
69
|
-
if iterations=0 then
|
|
70
|
-
exit;
|
|
71
|
-
end if;
|
|
72
|
-
hash = md5(new.password||hash||new.salt);
|
|
73
|
-
iterations=iterations-1;
|
|
74
|
-
end loop;
|
|
75
|
-
new.password=billing.crypt(hash,new.salt);
|
|
76
|
-
|
|
77
|
-
end if;
|
|
78
|
-
RETURN new;
|
|
79
|
-
END
|
|
80
|
-
$BODY$
|
|
81
|
-
|
|
82
|
-
LANGUAGE plpgsql VOLATILE COST 100;
|
|
83
|
-
|
|
84
|
-
DROP TRIGGER if exists insert_update_user_before on billing.users;
|
|
85
|
-
CREATE TRIGGER insert_update_user_before BEFORE INSERT OR UPDATE ON billing.users FOR EACH ROW
|
|
86
|
-
EXECUTE PROCEDURE billing.insert_update_user_before();
|
|
87
|
-
|
|
88
|
-
CREATE TABLE if not exists billing.users_social_auth();
|
|
89
|
-
ALTER TABLE billing.users_social_auth DROP CONSTRAINT if exists billing_users_social_auth_usa_id_pkey cascade;
|
|
90
|
-
ALTER TABLE billing.users_social_auth DROP CONSTRAINT if exists billing_users_social_auth_user_id_fkey cascade;
|
|
91
|
-
|
|
92
|
-
CREATE TABLE if not exists billing.users_social_auth();
|
|
93
|
-
ALTER TABLE billing.users_social_auth add column if not exists usa_id text NOT NULL DEFAULT next_id();
|
|
94
|
-
ALTER TABLE billing.users_social_auth add column if not exists user_id text;
|
|
95
|
-
ALTER TABLE billing.users_social_auth add column if not exists user_name text;
|
|
96
|
-
ALTER TABLE billing.users_social_auth add column if not exists sur_name text;
|
|
97
|
-
ALTER TABLE billing.users_social_auth add column if not exists email text;
|
|
98
|
-
ALTER TABLE billing.users_social_auth add column if not exists city text;
|
|
99
|
-
ALTER TABLE billing.users_social_auth add column if not exists phone text;
|
|
100
|
-
ALTER TABLE billing.users_social_auth add column if not exists social_auth_id text;
|
|
101
|
-
ALTER TABLE billing.users_social_auth add column if not exists social_auth_type text;
|
|
102
|
-
ALTER TABLE billing.users_social_auth add column if not exists social_auth_code text;
|
|
103
|
-
ALTER TABLE billing.users_social_auth add column if not exists social_auth_obj json;
|
|
104
|
-
ALTER TABLE billing.users_social_auth add column if not exists social_auth_date timestamp without time zone;
|
|
105
|
-
ALTER TABLE billing.users_social_auth add column if not exists social_auth_softpro_code text;
|
|
106
|
-
ALTER TABLE billing.users_social_auth add column if not exists enabled boolean;
|
|
107
|
-
ALTER TABLE billing.users_social_auth add column if not exists cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
108
|
-
ALTER TABLE billing.users_social_auth add column if not exists editor_date timestamp without time zone;
|
|
109
|
-
ALTER TABLE billing.users_social_auth add column if not exists uid text;
|
|
110
|
-
ALTER TABLE billing.users_social_auth add column if not exists editor_id text;
|
|
111
|
-
ALTER TABLE billing.users_social_auth add column if not exists files json;
|
|
112
|
-
ALTER TABLE billing.users_social_auth add column if not exists lang text;
|
|
113
|
-
ALTER TABLE billing.users_social_auth add column if not exists social_auth_url text;
|
|
114
|
-
|
|
115
|
-
COMMENT ON TABLE billing.users_social_auth IS 'Авторизація користувачів через соц. мережі';
|
|
116
|
-
COMMENT ON COLUMN billing.users_social_auth.user_id IS 'ID користувача';
|
|
117
|
-
|
|
118
|
-
ALTER TABLE billing.users add CONSTRAINT billing_user_id_pkey PRIMARY KEY (user_id);
|
|
119
|
-
ALTER TABLE billing.users_social_auth add CONSTRAINT billing_users_social_auth_usa_id_pkey PRIMARY KEY (usa_id);
|
|
120
|
-
ALTER TABLE billing.users_social_auth add CONSTRAINT billing_users_social_auth_user_id_fkey FOREIGN KEY (user_id)
|
|
121
|
-
REFERENCES billing.users (user_id);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
create schema if not exists billing;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE if not exists billing.accounts();
|
|
4
|
-
|
|
5
|
-
ALTER TABLE billing.accounts DROP CONSTRAINT if exists billing_account_account_id_pkey cascade;
|
|
6
|
-
ALTER TABLE billing.accounts DROP CONSTRAINT if exists billing_account_account_edrpou_unique cascade;
|
|
7
|
-
|
|
8
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS account_id text NOT NULL DEFAULT next_id();
|
|
9
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS account_name text NOT NULL;
|
|
10
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS account_edrpou text;
|
|
11
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS account_email text;
|
|
12
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS enabled boolean not null default true;
|
|
13
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
14
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS uid text NOT NULL;
|
|
15
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS editor_id text;
|
|
16
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
17
|
-
ALTER TABLE billing.accounts ADD COLUMN IF NOT EXISTS files json;
|
|
18
|
-
|
|
19
|
-
COMMENT ON TABLE billing.accounts IS 'Акаунти';
|
|
20
|
-
COMMENT ON COLUMN billing.accounts.account_id IS 'ID';
|
|
21
|
-
COMMENT ON COLUMN billing.accounts.account_name IS 'Назва';
|
|
22
|
-
COMMENT ON COLUMN billing.accounts.account_edrpou IS 'Код ЄДРПОУ';
|
|
23
|
-
COMMENT ON COLUMN billing.accounts.enabled IS 'On / Off';
|
|
24
|
-
|
|
25
|
-
CREATE TABLE IF NOT EXISTS billing.account_user();
|
|
26
|
-
|
|
27
|
-
ALTER TABLE billing.account_user DROP CONSTRAINT if exists billing_account_user_au_id_pkey cascade;
|
|
28
|
-
ALTER TABLE billing.account_user DROP CONSTRAINT if exists billing_account_user_account_id_fkey cascade;
|
|
29
|
-
ALTER TABLE billing.account_user DROP CONSTRAINT if exists billing_account_user_user_id_fkey;
|
|
30
|
-
ALTER TABLE billing.account_user DROP CONSTRAINT if exists billing_account_user_account_id_user_id_unique;
|
|
31
|
-
|
|
32
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS au_id text NOT NULL DEFAULT next_id();
|
|
33
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS account_id text NOT NULL;
|
|
34
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS user_id text NOT NULL;
|
|
35
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
36
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS uid text NOT NULL;
|
|
37
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS editor_id text;
|
|
38
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
39
|
-
ALTER TABLE billing.account_user ADD COLUMN IF NOT EXISTS files json;
|
|
40
|
-
|
|
41
|
-
COMMENT ON TABLE billing.account_user IS 'Відношення акаунтів та користувачів';
|
|
42
|
-
COMMENT ON COLUMN billing.account_user.au_id IS 'ID';
|
|
43
|
-
COMMENT ON COLUMN billing.account_user.account_id IS 'Акаунт організації';
|
|
44
|
-
COMMENT ON COLUMN billing.account_user.user_id IS 'Акаунт користувача';
|
|
45
|
-
|
|
46
|
-
CREATE INDEX if not exists billing_account_user_account_id_btree_idx ON billing.account_user USING btree (account_id COLLATE pg_catalog."default");
|
|
47
|
-
CREATE INDEX if not exists billing_account_user_account_id_trgm_idx ON billing.account_user USING gin (account_id COLLATE pg_catalog."default" gin_trgm_ops);
|
|
48
|
-
CREATE INDEX if not exists billing_account_user_user_id_btree_idx ON billing.account_user USING btree (user_id COLLATE pg_catalog."default");
|
|
49
|
-
CREATE INDEX if not exists billing_account_user_user_id_trgm_idx ON billing.account_user USING gin (user_id COLLATE pg_catalog."default" gin_trgm_ops);
|
|
50
|
-
|
|
51
|
-
ALTER TABLE billing.accounts ADD CONSTRAINT billing_account_account_id_pkey PRIMARY KEY (account_id);
|
|
52
|
-
ALTER TABLE billing.accounts ADD CONSTRAINT billing_account_account_edrpou_unique UNIQUE (account_edrpou);
|
|
53
|
-
|
|
54
|
-
ALTER TABLE billing.account_user ADD CONSTRAINT billing_account_user_au_id_pkey PRIMARY KEY (au_id);
|
|
55
|
-
ALTER TABLE billing.account_user ADD CONSTRAINT billing_account_user_account_id_fkey FOREIGN KEY (account_id)
|
|
56
|
-
REFERENCES billing.accounts (account_id);
|
|
57
|
-
ALTER TABLE billing.account_user ADD CONSTRAINT billing_account_user_user_id_fkey FOREIGN KEY (user_id)
|
|
58
|
-
REFERENCES billing.users (user_id);
|
|
59
|
-
ALTER TABLE billing.account_user ADD CONSTRAINT billing_account_user_account_id_user_id_unique UNIQUE (account_id,user_id);
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
create schema if not exists billing;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE IF NOT EXISTS billing.products();
|
|
4
|
-
ALTER TABLE billing.products DROP CONSTRAINT IF EXISTS billing_product_id_pkey CASCADE;
|
|
5
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS product_id text not null default next_id();
|
|
6
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS name text not null;
|
|
7
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS description text;
|
|
8
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS price_type text;
|
|
9
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS image text;
|
|
10
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS enabled boolean not null default true;
|
|
11
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
12
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS uid text NOT NULL;
|
|
13
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS editor_id text;
|
|
14
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
15
|
-
ALTER TABLE billing.products ADD COLUMN IF NOT EXISTS files json;
|
|
16
|
-
|
|
17
|
-
CREATE TABLE IF NOT EXISTS billing.plans();
|
|
18
|
-
ALTER TABLE billing.plans DROP CONSTRAINT IF EXISTS billing_plan_id_pkey CASCADE;
|
|
19
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS plan_id text not null default next_id();
|
|
20
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS name text not null;
|
|
21
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS enabled boolean not null default true;
|
|
22
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS multiplier numeric not null default 0;
|
|
23
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
24
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS uid text NOT NULL;
|
|
25
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS editor_id text;
|
|
26
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
27
|
-
ALTER TABLE billing.plans ADD COLUMN IF NOT EXISTS files json;
|
|
28
|
-
|
|
29
|
-
CREATE TABLE IF NOT EXISTS billing.product_plans();
|
|
30
|
-
ALTER TABLE billing.product_plans DROP CONSTRAINT IF EXISTS billing_product_plan_id_pkey CASCADE;
|
|
31
|
-
ALTER TABLE billing.product_plans DROP CONSTRAINT IF EXISTS billing_product_product_id_fkey CASCADE;
|
|
32
|
-
ALTER TABLE billing.product_plans DROP CONSTRAINT IF EXISTS billing_product_plan_id_fkey CASCADE;
|
|
33
|
-
|
|
34
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS product_plan_id text not null default next_id();
|
|
35
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS product_id text not null;
|
|
36
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS plan_id text not null;
|
|
37
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS price numeric not null default 0;
|
|
38
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS max_unit numeric not null default 1;
|
|
39
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS enabled boolean default true;
|
|
40
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
41
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS uid text NOT NULL;
|
|
42
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS editor_id text;
|
|
43
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
44
|
-
ALTER TABLE billing.product_plans ADD COLUMN IF NOT EXISTS files json;
|
|
45
|
-
|
|
46
|
-
ALTER TABLE billing.products ADD CONSTRAINT billing_product_id_pkey PRIMARY KEY (product_id);
|
|
47
|
-
ALTER TABLE billing.plans ADD CONSTRAINT billing_plan_id_pkey PRIMARY KEY (plan_id);
|
|
48
|
-
|
|
49
|
-
ALTER TABLE billing.product_plans ADD CONSTRAINT billing_product_plan_id_pkey PRIMARY KEY (product_plan_id);
|
|
50
|
-
ALTER TABLE billing.product_plans ADD CONSTRAINT billing_product_product_id_fkey FOREIGN KEY (product_id)
|
|
51
|
-
REFERENCES billing.products (product_id);
|
|
52
|
-
ALTER TABLE billing.product_plans ADD CONSTRAINT billing_product_plan_id_fkey FOREIGN KEY (plan_id)
|
|
53
|
-
REFERENCES billing.plans (plan_id);
|
|
54
|
-
|
|
55
|
-
COMMENT ON TABLE billing.products IS 'Товари (послуги)';
|
|
56
|
-
COMMENT ON COLUMN billing.products.product_id IS 'ID';
|
|
57
|
-
COMMENT ON COLUMN billing.products.name IS 'Назва';
|
|
58
|
-
COMMENT ON COLUMN billing.products.description IS 'Опис';
|
|
59
|
-
COMMENT ON COLUMN billing.products.price_type IS 'Тип плати (account/unit)';
|
|
60
|
-
COMMENT ON COLUMN billing.products.image is 'Зображення';
|
|
61
|
-
COMMENT ON COLUMN billing.products.enabled is 'On / Off';
|
|
62
|
-
|
|
63
|
-
COMMENT ON TABLE billing.plans IS 'Перелік тарифних планів';
|
|
64
|
-
COMMENT ON COLUMN billing.plans.plan_id IS 'ID';
|
|
65
|
-
COMMENT ON COLUMN billing.plans.name IS 'Назва';
|
|
66
|
-
COMMENT ON COLUMN billing.plans.enabled is 'On / Off';
|
|
67
|
-
|
|
68
|
-
COMMENT ON TABLE billing.product_plans IS 'Відношення планів та товарів (послуг)';
|
|
69
|
-
COMMENT ON COLUMN billing.product_plans.product_plan_id is 'ID';
|
|
70
|
-
COMMENT ON COLUMN billing.product_plans.product_id is 'ID товару (послуги)';
|
|
71
|
-
COMMENT ON COLUMN billing.product_plans.plan_id is 'ID тарифного плану';
|
|
72
|
-
COMMENT ON COLUMN billing.product_plans.price is 'Вартість';
|
|
73
|
-
COMMENT ON COLUMN billing.product_plans.max_unit is 'Максимальна кількість користувачів в межах тарифу';
|
|
74
|
-
COMMENT ON COLUMN billing.product_plans.enabled is 'On / Off';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
create schema if not exists billing;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE if not exists billing.subscriptions();
|
|
4
|
-
alter table billing.subscriptions drop constraint if exists billing_subscriptions_subscription_id_pkey cascade;
|
|
5
|
-
alter table billing.subscriptions drop constraint if exists billing_subscriptions_account_id_fkey cascade;
|
|
6
|
-
alter table billing.subscriptions drop constraint if exists billing_subscriptions_product_id_fkey cascade;
|
|
7
|
-
alter table billing.subscriptions drop constraint if exists billing_subscriptions_plan_id_fkey cascade;
|
|
8
|
-
|
|
9
|
-
alter table billing.subscriptions add column if not exists subscription_id text not null default next_id();
|
|
10
|
-
alter table billing.subscriptions add column if not exists account_id text not null;
|
|
11
|
-
alter table billing.subscriptions add column if not exists product_id text not null;
|
|
12
|
-
alter table billing.subscriptions add column if not exists product_plan_id text not null;
|
|
13
|
-
alter table billing.subscriptions add column if not exists is_trial boolean not null default false;
|
|
14
|
-
alter table billing.subscriptions add column if not exists start_date date not null default CURRENT_DATE;
|
|
15
|
-
alter table billing.subscriptions add column if not exists cdate timestamp without time zone default date_trunc('seconds'::text, now());
|
|
16
|
-
alter table billing.subscriptions add column if not exists uid text not null;
|
|
17
|
-
alter table billing.subscriptions add column if not exists editor_id text;
|
|
18
|
-
alter table billing.subscriptions add column if not exists editor_date timestamp without time zone;
|
|
19
|
-
alter table billing.subscriptions add column if not exists files json;
|
|
20
|
-
|
|
21
|
-
ALTER TABLE billing.subscriptions add constraint billing_subscriptions_subscription_id_pkey PRIMARY KEY(subscription_id);
|
|
22
|
-
ALTER TABLE billing.subscriptions add constraint billing_subscriptions_account_id_fkey FOREIGN KEY(account_id)
|
|
23
|
-
REFERENCES billing.accounts (account_id);
|
|
24
|
-
ALTER TABLE billing.subscriptions add constraint billing_subscriptions_product_id_fkey FOREIGN KEY(product_id)
|
|
25
|
-
REFERENCES billing.products (product_id);
|
|
26
|
-
ALTER TABLE billing.subscriptions add constraint billing_subscriptions_plan_id_fkey FOREIGN KEY(product_plan_id)
|
|
27
|
-
REFERENCES billing.product_plans (product_plan_id);
|
|
28
|
-
|
|
29
|
-
COMMENT ON TABLE billing.subscriptions IS 'Підписки';
|
|
30
|
-
COMMENT ON COLUMN billing.subscriptions.subscription_id IS 'ID';
|
|
31
|
-
|
|
32
|
-
COMMENT ON COLUMN billing.subscriptions.account_id IS 'ID акаунту';
|
|
33
|
-
COMMENT ON COLUMN billing.subscriptions.product_id IS 'ID товару';
|
|
34
|
-
COMMENT ON COLUMN billing.subscriptions.product_plan_id IS 'ID тарифного плану';
|
|
35
|
-
COMMENT ON COLUMN billing.subscriptions.is_trial IS 'Випробувальний строк';
|
|
36
|
-
COMMENT ON COLUMN billing.subscriptions.start_date IS 'Дата початку дії підписки';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
create schema if not exists billing;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE if not exists billing.payments();
|
|
4
|
-
alter table billing.payments drop constraint if exists billing_payments_payment_id_pkey cascade;
|
|
5
|
-
alter table billing.payments drop constraint if exists billing_payments_payment_id_account_id_fkey cascade;
|
|
6
|
-
|
|
7
|
-
alter table billing.payments add column if not exists payment_id text NOT NULL default next_id();
|
|
8
|
-
alter table billing.payments add column if not exists account_id text;
|
|
9
|
-
alter table billing.payments alter column account_id drop NOT NULL;
|
|
10
|
-
alter table billing.payments add column if not exists payment_status text NOT NULL DEFAULT 'inprogress'::text;
|
|
11
|
-
alter table billing.payments add column if not exists success_date timestamp with time zone;
|
|
12
|
-
alter table billing.payments add column if not exists payment_data json;
|
|
13
|
-
alter table billing.payments add column if not exists payment_amount numeric;
|
|
14
|
-
alter table billing.payments add column if not exists payment_service text;
|
|
15
|
-
alter table billing.payments add column if not exists total_balance numeric;
|
|
16
|
-
alter table billing.payments add column if not exists referer_url text;
|
|
17
|
-
alter table billing.payments add column if not exists cdate timestamp without time zone DEFAULT now();
|
|
18
|
-
alter table billing.payments add column if not exists uid text NOT NULL;
|
|
19
|
-
alter table billing.payments add column if not exists editor_id text;
|
|
20
|
-
alter table billing.payments add column if not exists editor_date timestamp without time zone;
|
|
21
|
-
alter table billing.payments add column if not exists files json;
|
|
22
|
-
|
|
23
|
-
COMMENT ON TABLE billing.payments IS 'Платежі';
|
|
24
|
-
COMMENT ON COLUMN billing.payments.payment_id IS 'ID';
|
|
25
|
-
COMMENT ON COLUMN billing.payments.account_id IS 'ID акаунту клієнта';
|
|
26
|
-
COMMENT ON COLUMN billing.payments.payment_status IS 'Статус транзації';
|
|
27
|
-
COMMENT ON COLUMN billing.payments.success_date IS 'Дата успішного завершення транзакції';
|
|
28
|
-
COMMENT ON COLUMN billing.payments.payment_data IS 'Дані від сервісу оплати';
|
|
29
|
-
COMMENT ON COLUMN billing.payments.payment_service IS 'Сервіс оплати (portmone, liqpay)';
|
|
30
|
-
COMMENT ON COLUMN billing.payments.payment_amount IS 'Сума поповнення рахунку';
|
|
31
|
-
COMMENT ON COLUMN billing.payments.total_balance IS 'Поточний баланс';
|
|
32
|
-
COMMENT ON COLUMN billing.payments.referer_url IS 'Посилання';
|
|
33
|
-
|
|
34
|
-
CREATE INDEX if not exists billing_payments_account_id_btree_idx ON billing.payments USING btree (account_id COLLATE pg_catalog."default");
|
|
35
|
-
CREATE INDEX if not exists billing_payments_account_id_trgm_idx ON billing.payments USING gin (account_id COLLATE pg_catalog."default" gin_trgm_ops);
|
|
36
|
-
CREATE INDEX if not exists billing_payments_payments_status_btree_idx ON billing.payments USING btree (payment_status COLLATE pg_catalog."default");
|
|
37
|
-
|
|
38
|
-
alter table billing.payments add CONSTRAINT billing_payments_payment_id_pkey PRIMARY KEY (payment_id);
|
|
39
|
-
alter table billing.payments add CONSTRAINT billing_payments_payment_id_account_id_fkey FOREIGN KEY (account_id) REFERENCES billing.accounts (account_id);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
create schema if not exists billing;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE if not exists billing.invoices();
|
|
4
|
-
alter table billing.invoices drop constraint if exists billing_invoices_invoice_id_pkey cascade;
|
|
5
|
-
alter table billing.invoices drop constraint if exists billing_invoices_subscription_id_fkey cascade;
|
|
6
|
-
|
|
7
|
-
alter table billing.invoices add column if not exists invoice_id text NOT NULL default next_id();
|
|
8
|
-
alter table billing.invoices add column if not exists account_id text NOT NULL;
|
|
9
|
-
alter table billing.invoices add column if not exists subscription_id text;
|
|
10
|
-
alter table billing.invoices add column if not exists total_amount numeric;
|
|
11
|
-
alter table billing.invoices add column if not exists cdate timestamp without time zone DEFAULT now();
|
|
12
|
-
alter table billing.invoices add column if not exists uid text NOT NULL;
|
|
13
|
-
alter table billing.invoices add column if not exists editor_id text;
|
|
14
|
-
alter table billing.invoices add column if not exists editor_date timestamp without time zone;
|
|
15
|
-
alter table billing.invoices add column if not exists files json;
|
|
16
|
-
|
|
17
|
-
COMMENT ON TABLE billing.invoices IS 'Накладні (рахунки)';
|
|
18
|
-
COMMENT ON COLUMN billing.invoices.invoice_id IS 'ID';
|
|
19
|
-
COMMENT ON COLUMN billing.invoices.account_id IS 'ID акаунту клієнта';
|
|
20
|
-
COMMENT ON COLUMN billing.invoices.total_amount IS 'Сума списання';
|
|
21
|
-
COMMENT ON COLUMN billing.invoices.subscription_id IS 'ID підписки';
|
|
22
|
-
|
|
23
|
-
CREATE TABLE if not exists billing.invoices_subscribe();
|
|
24
|
-
alter table billing.invoices_subscribe drop constraint if exists billing_invoices_subscribe_id_pkey cascade;
|
|
25
|
-
alter table billing.invoices_subscribe drop constraint if exists billing_invoices_subscribe_invoice_id_fkey cascade;
|
|
26
|
-
|
|
27
|
-
alter table billing.invoices_subscribe add column if not exists is_id text NOT NULL default next_id();
|
|
28
|
-
alter table billing.invoices_subscribe add column if not exists invoice_id text NOT NULL;
|
|
29
|
-
alter table billing.invoices_subscribe add column if not exists list_price numeric not null default 0;
|
|
30
|
-
alter table billing.invoices_subscribe add column if not exists dicsounts numeric not null default 0;
|
|
31
|
-
alter table billing.invoices_subscribe add column if not exists amount_excl_tax numeric not null default 0;
|
|
32
|
-
alter table billing.invoices_subscribe add column if not exists tax numeric not null default 0;
|
|
33
|
-
alter table billing.invoices_subscribe add column if not exists amount numeric not null default 0;
|
|
34
|
-
alter table billing.invoices_subscribe add column if not exists cdate timestamp without time zone DEFAULT now();
|
|
35
|
-
alter table billing.invoices_subscribe add column if not exists uid text NOT NULL;
|
|
36
|
-
alter table billing.invoices_subscribe add column if not exists editor_id text;
|
|
37
|
-
alter table billing.invoices_subscribe add column if not exists editor_date timestamp without time zone;
|
|
38
|
-
alter table billing.invoices_subscribe add column if not exists files json;
|
|
39
|
-
|
|
40
|
-
COMMENT ON TABLE billing.invoices_subscribe IS 'Складові накладних (рахунків)';
|
|
41
|
-
COMMENT ON COLUMN billing.invoices_subscribe.is_id IS 'ID';
|
|
42
|
-
COMMENT ON COLUMN billing.invoices_subscribe.invoice_id IS 'ID накладної (рахунку)';
|
|
43
|
-
COMMENT ON COLUMN billing.invoices_subscribe.list_price IS 'Встановлена вартість';
|
|
44
|
-
COMMENT ON COLUMN billing.invoices_subscribe.dicsounts IS 'Знижка';
|
|
45
|
-
COMMENT ON COLUMN billing.invoices_subscribe.amount_excl_tax IS 'Сума, без податків';
|
|
46
|
-
COMMENT ON COLUMN billing.invoices_subscribe.tax IS 'Сума податків';
|
|
47
|
-
COMMENT ON COLUMN billing.invoices_subscribe.amount IS 'Сума';
|
|
48
|
-
|
|
49
|
-
alter table billing.invoices add CONSTRAINT billing_invoices_invoice_id_pkey PRIMARY KEY (invoice_id);
|
|
50
|
-
alter table billing.invoices add CONSTRAINT billing_invoices_subscription_id_fkey FOREIGN KEY (subscription_id)
|
|
51
|
-
REFERENCES billing.subscriptions (subscription_id);
|
|
52
|
-
|
|
53
|
-
alter table billing.invoices_subscribe add CONSTRAINT billing_invoices_subscribe_id_pkey PRIMARY KEY (is_id);
|
|
54
|
-
alter table billing.invoices_subscribe add CONSTRAINT billing_invoices_subscribe_invoice_id_fkey FOREIGN KEY (invoice_id)
|
|
55
|
-
REFERENCES billing.invoices (invoice_id);
|