@dascompany/product 4.1.6 → 4.1.7
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.
|
@@ -2,6 +2,7 @@ import { ParameterType, QueryOptions } from "@dascompany/database";
|
|
|
2
2
|
import DatabaseConnection from "../../DatabaseConnection";
|
|
3
3
|
import PaymentMethodReader from "./PaymentMethodReader";
|
|
4
4
|
import PaymentStatusesReader from "./PaymentStatusesReader";
|
|
5
|
+
import createQueryOptionsForId from "../../utils/createQueryOptionsForId";
|
|
5
6
|
export default class PaymentDetailsReader {
|
|
6
7
|
static async get(queryOptions) {
|
|
7
8
|
const paymentDetails = await DatabaseConnection.getInstance().paymentDetails.select(queryOptions);
|
|
@@ -9,26 +10,20 @@ export default class PaymentDetailsReader {
|
|
|
9
10
|
}
|
|
10
11
|
static async correctPaymentDetails(paymentDetails) {
|
|
11
12
|
const id = paymentDetails.id;
|
|
12
|
-
const queryOptionsForPaymentMethod =
|
|
13
|
-
|
|
14
|
-
name: 'id',
|
|
15
|
-
type: ParameterType.bigint,
|
|
16
|
-
value: paymentDetails.payment_method_id
|
|
17
|
-
}]);
|
|
13
|
+
const queryOptionsForPaymentMethod = createQueryOptionsForId(paymentDetails.payment_method_id);
|
|
14
|
+
const paymentMethod = await PaymentMethodReader.get(queryOptionsForPaymentMethod);
|
|
18
15
|
const queryOptionsForPaymentStatus = new QueryOptions();
|
|
19
16
|
queryOptionsForPaymentStatus.setWhere([{
|
|
20
17
|
name: 'payment_details_id',
|
|
21
18
|
type: ParameterType.bigint,
|
|
22
19
|
value: paymentDetails.id
|
|
23
20
|
}]);
|
|
24
|
-
const
|
|
25
|
-
PaymentMethodReader.get(queryOptionsForPaymentMethod),
|
|
26
|
-
PaymentStatusesReader.getAll(queryOptionsForPaymentStatus)
|
|
27
|
-
]);
|
|
21
|
+
const statuses = await PaymentStatusesReader.getAll(queryOptionsForPaymentStatus);
|
|
28
22
|
return {
|
|
29
23
|
id,
|
|
30
24
|
paymentMethod,
|
|
31
25
|
statuses,
|
|
26
|
+
paymentOrderId: paymentDetails.payment_order_id
|
|
32
27
|
};
|
|
33
28
|
}
|
|
34
29
|
}
|