@dascompany/product 4.1.5 → 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
|
}
|
package/dist/repo/OrderRepo.js
CHANGED
|
@@ -6,7 +6,7 @@ export default class OrderRepo {
|
|
|
6
6
|
return this.createOrderFromRow(orderData);
|
|
7
7
|
}
|
|
8
8
|
static createOrderFromRow(orderData) {
|
|
9
|
-
const order = new Order(orderData.email, orderData.net_price, orderData.client_id, orderData.delivery_details_id, orderData.company_details_id, orderData.payment_details_id, orderData.invoice
|
|
9
|
+
const order = new Order(orderData.email, orderData.net_price, orderData.vat, orderData.client_id, orderData.delivery_details_id, orderData.company_details_id, orderData.payment_details_id, orderData.invoice);
|
|
10
10
|
order.setId(orderData.id);
|
|
11
11
|
return order;
|
|
12
12
|
}
|
|
@@ -9,7 +9,7 @@ export default class Order extends StockObject {
|
|
|
9
9
|
private invoice;
|
|
10
10
|
private zsiId;
|
|
11
11
|
private vat;
|
|
12
|
-
constructor(email: string, net_price: number, clientId: string | null, deliveryDetailsId: string, companyDetailsId
|
|
12
|
+
constructor(email: string, net_price: number, vat: number, clientId: string | null, deliveryDetailsId: string, companyDetailsId?: string | null, paymentDetailsId?: string | null, invoice?: boolean);
|
|
13
13
|
getData(): Promise<{
|
|
14
14
|
id: string | null;
|
|
15
15
|
email: string;
|
|
@@ -12,7 +12,7 @@ export default class Order extends StockObject {
|
|
|
12
12
|
invoice;
|
|
13
13
|
zsiId;
|
|
14
14
|
vat;
|
|
15
|
-
constructor(email, net_price, clientId, deliveryDetailsId, companyDetailsId = null, paymentDetailsId = null, invoice = false
|
|
15
|
+
constructor(email, net_price, vat, clientId, deliveryDetailsId, companyDetailsId = null, paymentDetailsId = null, invoice = false) {
|
|
16
16
|
super();
|
|
17
17
|
this.email = email;
|
|
18
18
|
this.net_price = net_price;
|