Skip to content

Commit cf36f11

Browse files
authored
Merge pull request #660 from PAWECOGmbH/development
Dev to Staging
2 parents d340ddb + 2a89072 commit cf36f11

File tree

5 files changed

+161
-121
lines changed

5 files changed

+161
-121
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ config.cfm
1010

1111
### Log files ###
1212
www/logs
13-
.history
13+
.history
14+
15+
### NGINX configs ###
16+
config/nginx/conf.d/*.conf
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ALTER TABLE `schedulecontrol`
2+
MODIFY COLUMN `strTaskName` varchar(20) CHARACTER SET utf8mb4
3+
COLLATE utf8mb4_unicode_ci NOT NULL AFTER `intControlID`;
4+
5+
ALTER TABLE `scheduler_01` COLLATE = utf8mb4_unicode_ci;
6+
ALTER TABLE `scheduler_02` COLLATE = utf8mb4_unicode_ci;
7+
ALTER TABLE `scheduler_03` COLLATE = utf8mb4_unicode_ci;
8+
ALTER TABLE `scheduler_04` COLLATE = utf8mb4_unicode_ci;
9+
ALTER TABLE `scheduler_05` COLLATE = utf8mb4_unicode_ci;
10+
ALTER TABLE `scheduler_06` COLLATE = utf8mb4_unicode_ci;
11+
ALTER TABLE `scheduler_07` COLLATE = utf8mb4_unicode_ci;
12+
ALTER TABLE `scheduler_08` COLLATE = utf8mb4_unicode_ci;
13+
ALTER TABLE `scheduler_09` COLLATE = utf8mb4_unicode_ci;
14+
ALTER TABLE `scheduler_10` COLLATE = utf8mb4_unicode_ci;
15+
ALTER TABLE `scheduler_11` COLLATE = utf8mb4_unicode_ci;
16+
ALTER TABLE `scheduler_12` COLLATE = utf8mb4_unicode_ci;
17+
ALTER TABLE `scheduler_13` COLLATE = utf8mb4_unicode_ci;
18+
ALTER TABLE `scheduler_14` COLLATE = utf8mb4_unicode_ci;
19+
ALTER TABLE `scheduler_15` COLLATE = utf8mb4_unicode_ci;
20+
ALTER TABLE `scheduler_16` COLLATE = utf8mb4_unicode_ci;
21+
ALTER TABLE `scheduler_17` COLLATE = utf8mb4_unicode_ci;
22+
ALTER TABLE `scheduler_18` COLLATE = utf8mb4_unicode_ci;
23+
ALTER TABLE `scheduler_19` COLLATE = utf8mb4_unicode_ci;
24+
ALTER TABLE `scheduler_20` COLLATE = utf8mb4_unicode_ci;
25+
26+
ALTER TABLE `scheduletasks`
27+
MODIFY COLUMN `strName` varchar(255) CHARACTER SET utf8mb4
28+
COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL AFTER `intScheduletaskID`,
29+
MODIFY COLUMN `strPath` varchar(255) CHARACTER SET utf8mb4
30+
COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL AFTER `dtmStartTime`,
31+
COLLATE = utf8mb4_unicode_ci;

config/nginx/conf.d/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

www/frontend/core/handler/payrexx_webhook.cfm

Lines changed: 125 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
if (application.environment eq "dev") {
99
1010
cfhttp( url=variables.payrexxWebhookDev, result="httpRes", method="GET" ) {}
11-
1211
if (isJSON(httpRes.filecontent)) {
1312
jsonData = deSerializeJSON(httpRes.filecontent);
1413
} else {
@@ -34,12 +33,17 @@ if (application.environment eq "dev") {
3433
}
3534
3635
jsonData = getHttpRequestData().content;
36+
if (!isJSON(jsonData)) {
37+
logWrite("payrexx", "warning", "jsonData is not of type JSON!");
38+
abort;
39+
}
40+
3741
jsonData = deSerializeJSON(jsonData);
3842
3943
}
4044
4145
42-
if (structKeyExists(jsonData, "transaction")) {
46+
if (isStruct(jsonData) and structKeyExists(jsonData, "transaction")) {
4347
4448
webhookData = jsonData.transaction;
4549
@@ -64,128 +68,135 @@ if (structKeyExists(jsonData, "transaction")) {
6468
customerID = listFirst(webhookData.referenceId, "@");
6569
projectName = listLast(webhookData.referenceId, "@");
6670
}
67-
if (structKeyExists(webhookData, "id")) {
68-
internTransID = webhookData.id;
69-
}
70-
if (structKeyExists(webhookData, "invoice")) {
71-
invoiceData = webhookData.invoice;
72-
if (structKeyExists(invoiceData, "paymentRequestId") and isNumeric(invoiceData.paymentRequestId)) {
73-
gatewayID = invoiceData.paymentRequestId;
71+
72+
if (isNumeric(customerID) and customerID gt 0) {
73+
74+
if (structKeyExists(webhookData, "id")) {
75+
internTransID = webhookData.id;
7476
}
75-
}
76-
if (structKeyExists(webhookData, "amount") and isNumeric(webhookData.amount) and webhookData.amount gt 0) {
77-
paymentAmount = numberFormat(webhookData.amount/100, "__.__");
78-
}
79-
if (structKeyExists(webhookData, "time") and isDate(webhookData.time)) {
80-
objTime = new backend.core.com.time();
81-
dateTime = objTime.local2utc(webhookData.time, "Europe/Zurich");
82-
}
83-
if (structKeyExists(webhookData, "status")) {
84-
status = webhookData.status;
85-
}
86-
if (structKeyExists(webhookData, "lang")) {
87-
language = webhookData.lang;
88-
}
89-
if (structKeyExists(webhookData, "psp")) {
90-
serviceProvider = webhookData.psp;
91-
}
92-
if (structKeyExists(webhookData, "pspId") and isNumeric(webhookData.pspId) and webhookData.pspId gt 0) {
93-
serviceProviderID = webhookData.pspId;
94-
}
95-
if (structKeyExists(webhookData, "payrexxFee") and isNumeric(webhookData.pspId) and webhookData.pspId gt 0) {
96-
payrexxFee = numberFormat(webhookData.payrexxFee/100, "__.__");
97-
}
98-
if (structKeyExists(webhookData, "payment")) {
99-
if (structKeyExists(webhookData.payment, "brand")) {
100-
paymentBrand = webhookData.payment.brand;
101-
paymentBrand = left(uCase(paymentBrand), 1) & right(paymentBrand, len(paymentBrand) -1);
77+
if (structKeyExists(webhookData, "invoice")) {
78+
invoiceData = webhookData.invoice;
79+
if (structKeyExists(invoiceData, "paymentRequestId") and isNumeric(invoiceData.paymentRequestId)) {
80+
gatewayID = invoiceData.paymentRequestId;
81+
}
10282
}
103-
if (structKeyExists(webhookData.payment, "cardNumber")) {
104-
cardNumber = webhookData.payment.cardNumber;
83+
if (structKeyExists(webhookData, "amount") and isNumeric(webhookData.amount) and webhookData.amount gt 0) {
84+
paymentAmount = numberFormat(webhookData.amount/100, "_.__");
85+
}
86+
if (structKeyExists(webhookData, "time") and isDate(webhookData.time)) {
87+
objTime = new backend.core.com.time();
88+
dateTime = objTime.local2utc(webhookData.time, "Europe/Zurich");
89+
}
90+
if (structKeyExists(webhookData, "status")) {
91+
status = webhookData.status;
92+
}
93+
if (structKeyExists(webhookData, "lang")) {
94+
language = webhookData.lang;
95+
}
96+
if (structKeyExists(webhookData, "psp")) {
97+
serviceProvider = webhookData.psp;
98+
}
99+
if (structKeyExists(webhookData, "pspId") and isNumeric(webhookData.pspId) and webhookData.pspId gt 0) {
100+
serviceProviderID = webhookData.pspId;
101+
}
102+
if (structKeyExists(webhookData, "payrexxFee") and isNumeric(webhookData.pspId) and webhookData.pspId gt 0) {
103+
payrexxFee = numberFormat(webhookData.payrexxFee/100, "_.__");
104+
}
105+
if (structKeyExists(webhookData, "payment")) {
106+
if (structKeyExists(webhookData.payment, "brand")) {
107+
paymentBrand = webhookData.payment.brand;
108+
paymentBrand = left(uCase(paymentBrand), 1) & right(paymentBrand, len(paymentBrand) -1);
109+
}
110+
if (structKeyExists(webhookData.payment, "cardNumber")) {
111+
cardNumber = webhookData.payment.cardNumber;
112+
}
105113
}
106-
}
107114
108-
// Is there already a default payment method?
109-
getWebhook = new backend.core.com.payrexx().getWebhook(customerID, 'authorized', 1);
110-
if (getWebhook.recordCount) {
111-
default = 0;
112-
} else {
113-
default = 1;
114-
}
115+
// Is there already a default payment method?
116+
getWebhook = new backend.core.com.payrexx().getWebhook(customerID, 'authorized', 1);
117+
if (getWebhook.recordCount) {
118+
default = 0;
119+
} else {
120+
default = 1;
121+
}
115122
116-
// Insert only if it's the correct webhook
117-
if (projectName eq variables.applicationname) {
118-
119-
try {
120-
121-
queryExecute(
122-
123-
options = {datasource = application.datasource},
124-
params = {
125-
customerID: {type: "numeric", value: customerID},
126-
transID: {type: "numeric", value: internTransID},
127-
gatewayID: {type: "numeric", value: gatewayID},
128-
paymentAmount: {type: "decimal", value: paymentAmount, scale: 2},
129-
dateTime: {type: "datetime", value: dateTime},
130-
status: {type: "varchar", value: status},
131-
language: {type: "varchar", value: language},
132-
serviceProvider: {type: "varchar", value: serviceProvider},
133-
serviceProviderID: {type: "numeric", value: serviceProviderID},
134-
payrexxFee: {type: "decimal", value: payrexxFee, scale: 2},
135-
paymentBrand: {type: "nvarchar", value: paymentBrand},
136-
cardNumber: {type: "varchar", value: cardNumber},
137-
default: {type: "boolean", value: default}
138-
},
139-
sql = "
140-
INSERT INTO payrexx
141-
(
142-
intCustomerID,
143-
dtmTimeUTC,
144-
intGatewayID,
145-
intTransactionID,
146-
strStatus,
147-
strLanguage,
148-
strPSP,
149-
intPSPID,
150-
decAmount,
151-
decPayrexxFee,
152-
strPaymentBrand,
153-
strCardNumber,
154-
blnDefault
155-
)
156-
VALUES (
157-
:customerID,
158-
:dateTime,
159-
:gatewayID,
160-
:transID,
161-
:status,
162-
:language,
163-
:serviceProvider,
164-
:serviceProviderID,
165-
:paymentAmount,
166-
:payrexxFee,
167-
:paymentBrand,
168-
:cardNumber,
169-
:default
170-
)
171-
172-
"
173-
)
174-
175-
logWrite("payrexx", "info", "Webhook data successfully saved [CustomerID: #customerID#, TransactionID: #internTransID#, Payment: #paymentAmount#]");
176-
177-
178-
} catch (any e) {
179-
180-
logWrite("payrexx", "error", "Could not insert the webhook data into the payrexx table. [CustomerID: #customerID#, TransactionID: #internTransID#, Payment: #paymentAmount#, Error: #e.message#]", true);
123+
// Insert only if it's the correct webhook
124+
if (projectName eq variables.applicationname) {
125+
126+
try {
127+
128+
queryExecute(
129+
130+
options = {datasource = application.datasource},
131+
params = {
132+
customerID: {type: "numeric", value: customerID},
133+
transID: {type: "numeric", value: internTransID},
134+
gatewayID: {type: "numeric", value: gatewayID},
135+
paymentAmount: {type: "decimal", value: paymentAmount, scale: 2},
136+
dateTime: {type: "datetime", value: dateTime},
137+
status: {type: "varchar", value: status},
138+
language: {type: "varchar", value: language},
139+
serviceProvider: {type: "varchar", value: serviceProvider},
140+
serviceProviderID: {type: "numeric", value: serviceProviderID},
141+
payrexxFee: {type: "decimal", value: payrexxFee, scale: 2},
142+
paymentBrand: {type: "nvarchar", value: paymentBrand},
143+
cardNumber: {type: "varchar", value: cardNumber},
144+
default: {type: "boolean", value: default}
145+
},
146+
sql = "
147+
INSERT INTO payrexx
148+
(
149+
intCustomerID,
150+
dtmTimeUTC,
151+
intGatewayID,
152+
intTransactionID,
153+
strStatus,
154+
strLanguage,
155+
strPSP,
156+
intPSPID,
157+
decAmount,
158+
decPayrexxFee,
159+
strPaymentBrand,
160+
strCardNumber,
161+
blnDefault
162+
)
163+
VALUES (
164+
:customerID,
165+
:dateTime,
166+
:gatewayID,
167+
:transID,
168+
:status,
169+
:language,
170+
:serviceProvider,
171+
:serviceProviderID,
172+
:paymentAmount,
173+
:payrexxFee,
174+
:paymentBrand,
175+
:cardNumber,
176+
:default
177+
)
178+
179+
"
180+
)
181+
182+
logWrite("payrexx", "info", "Webhook data successfully saved [CustomerID: #customerID#, TransactionID: #internTransID#, Payment: #paymentAmount#]");
183+
184+
185+
} catch (any e) {
186+
187+
logWrite("payrexx", "error", "Could not insert the webhook data into the payrexx table. [CustomerID: #customerID#, TransactionID: #internTransID#, Payment: #paymentAmount#, Error: #e.message#]", true);
188+
189+
}
190+
191+
} else {
192+
193+
logWrite("payrexx", "warning", "Webhook could not be inserted because the application name does not match the project name. [CustomerID: #customerID#, TransactionID: #internTransID#, Payment: #paymentAmount#, projectName: #projectName#, applicationName: #variables.applicationname#]");
181194
182195
}
183196
184-
} else {
197+
}
185198
186-
logWrite("payrexx", "warning", "Webhook could not be inserted because the application name does not match the project name. [CustomerID: #customerID#, TransactionID: #internTransID#, Payment: #paymentAmount#, projectName: #projectName#, applicationName: #variables.applicationname#]");
187199
188-
}
189200
190201
} else {
191202

www/frontend/core/scheduletasks/subscriptions.cfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ if (url.pass eq variables.schedulePassword) {
372372
invoiceStruct['bookingID'] = qRenewBookings.intBookingID;
373373
invoiceStruct['customerID'] = qRenewBookings.intCustomerID;
374374
invoiceStruct['title'] = getTrans('titRenewal') & " " & moduleData.name;
375-
invoiceStruct['currency'] = lastInvoice.invoiceCurrency;
375+
invoiceStruct['currency'] = currency;
376376
invoiceStruct['isNet'] = moduleData.isNet;
377377
invoiceStruct['vatType'] = moduleData.vatType;
378378
invoiceStruct['paymentStatusID'] = 2;

0 commit comments

Comments
 (0)