@longvansoftware/storefront-js-client 1.3.0 → 1.3.2
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/dist/src/graphql/payment/queries.d.ts +1 -0
- package/dist/src/graphql/payment/queries.js +11 -1
- package/dist/src/graphql/user/mutations.d.ts +1 -0
- package/dist/src/graphql/user/mutations.js +52 -21
- package/dist/src/lib/payment/index.d.ts +1 -0
- package/dist/src/lib/payment/index.js +19 -0
- package/dist/src/lib/user/index.d.ts +3 -1
- package/dist/src/lib/user/index.js +44 -0
- package/dist/src/types/user.d.ts +15 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PAYMENT_METHOD = void 0;
|
|
3
|
+
exports.GEN_QR_PAYMENT = exports.GET_PAYMENT_METHOD = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_PAYMENT_METHOD = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetPaymentMethod($orgId: String!, $storeChannelId: String) {
|
|
@@ -11,3 +11,13 @@ exports.GET_PAYMENT_METHOD = (0, graphql_tag_1.gql) `
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
|
+
exports.GEN_QR_PAYMENT = (0, graphql_tag_1.gql) `
|
|
15
|
+
query GenQRPayment($orgId: String!, $orderId: String!, $storeId: String!, $totalAmount: BigDecimal){
|
|
16
|
+
genQRPayment(
|
|
17
|
+
orgId: $orgId
|
|
18
|
+
orderId: $orderId
|
|
19
|
+
storeId: $storeId
|
|
20
|
+
totalAmount: $totalAmount
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const CREATE_COMPANY: import("graphql").DocumentNode;
|
|
2
2
|
export declare const UPDATE_COMPANY_INFOR: import("graphql").DocumentNode;
|
|
3
3
|
export declare const UPDATE_CUSTOMER_V2: import("graphql").DocumentNode;
|
|
4
|
+
export declare const CREATE_CUSTOMER_V2: import("graphql").DocumentNode;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UPDATE_CUSTOMER_V2 = exports.UPDATE_COMPANY_INFOR = exports.CREATE_COMPANY = void 0;
|
|
3
|
+
exports.CREATE_CUSTOMER_V2 = exports.UPDATE_CUSTOMER_V2 = exports.UPDATE_COMPANY_INFOR = exports.CREATE_COMPANY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.CREATE_COMPANY = (0, graphql_tag_1.gql) `
|
|
6
6
|
mutation CreateCompany(
|
|
7
|
-
$createCompanyRequest: CreateCompanyRequest
|
|
8
|
-
$createTaxCodeRequest: CreateTaxCodeRequest
|
|
9
|
-
$orgId: String
|
|
7
|
+
$createCompanyRequest: CreateCompanyRequest!
|
|
8
|
+
$createTaxCodeRequest: CreateTaxCodeRequest
|
|
9
|
+
$orgId: String!
|
|
10
10
|
$createdBy: String!
|
|
11
11
|
) {
|
|
12
12
|
createCompany(
|
|
13
|
-
createCompanyRequest: $createCompanyRequest
|
|
14
|
-
createTaxCodeRequest: $createTaxCodeRequest
|
|
15
|
-
orgId: $orgId
|
|
13
|
+
createCompanyRequest: $createCompanyRequest
|
|
14
|
+
createTaxCodeRequest: $createTaxCodeRequest
|
|
15
|
+
orgId: $orgId
|
|
16
16
|
createdBy: $createdBy
|
|
17
17
|
) {
|
|
18
18
|
id
|
|
@@ -31,17 +31,17 @@ exports.CREATE_COMPANY = (0, graphql_tag_1.gql) `
|
|
|
31
31
|
`;
|
|
32
32
|
exports.UPDATE_COMPANY_INFOR = (0, graphql_tag_1.gql) `
|
|
33
33
|
mutation UpdateCompanyInfo(
|
|
34
|
-
$id: String
|
|
35
|
-
$fieldName: String
|
|
36
|
-
$valueUpdate: String
|
|
37
|
-
$orgId: String
|
|
34
|
+
$id: String!
|
|
35
|
+
$fieldName: String!
|
|
36
|
+
$valueUpdate: String!
|
|
37
|
+
$orgId: String!
|
|
38
38
|
$updatedBy: String!
|
|
39
39
|
) {
|
|
40
40
|
updateCompanyInfo(
|
|
41
|
-
id: $id
|
|
42
|
-
fieldName: $fieldName
|
|
43
|
-
valueUpdate: $valueUpdate
|
|
44
|
-
orgId: $orgId
|
|
41
|
+
id: $id
|
|
42
|
+
fieldName: $fieldName
|
|
43
|
+
valueUpdate: $valueUpdate
|
|
44
|
+
orgId: $orgId
|
|
45
45
|
updatedBy: $updatedBy
|
|
46
46
|
) {
|
|
47
47
|
id
|
|
@@ -60,15 +60,15 @@ exports.UPDATE_COMPANY_INFOR = (0, graphql_tag_1.gql) `
|
|
|
60
60
|
`;
|
|
61
61
|
exports.UPDATE_CUSTOMER_V2 = (0, graphql_tag_1.gql) `
|
|
62
62
|
mutation UpdateCustomerV2(
|
|
63
|
-
$id: String
|
|
64
|
-
$updateCustomerRequest: UpdateCustomerRequest
|
|
65
|
-
$tenantId: String
|
|
63
|
+
$id: String!
|
|
64
|
+
$updateCustomerRequest: UpdateCustomerRequest!
|
|
65
|
+
$tenantId: String!
|
|
66
66
|
$updatedBy: String!
|
|
67
67
|
) {
|
|
68
68
|
updateCustomerV2(
|
|
69
|
-
id: $id
|
|
70
|
-
updateCustomerRequest: $updateCustomerRequest
|
|
71
|
-
tenantId: $tenantId
|
|
69
|
+
id: $id
|
|
70
|
+
updateCustomerRequest: $updateCustomerRequest
|
|
71
|
+
tenantId: $tenantId
|
|
72
72
|
updatedBy: $updatedBy
|
|
73
73
|
) {
|
|
74
74
|
id
|
|
@@ -85,3 +85,34 @@ exports.UPDATE_CUSTOMER_V2 = (0, graphql_tag_1.gql) `
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
`;
|
|
88
|
+
exports.CREATE_CUSTOMER_V2 = (0, graphql_tag_1.gql) `
|
|
89
|
+
mutation CreateCustomerV2(
|
|
90
|
+
$name: String!
|
|
91
|
+
$phone: String
|
|
92
|
+
$email: String
|
|
93
|
+
$birthDate: DateCustom
|
|
94
|
+
$tenantId: String!
|
|
95
|
+
$tenantId: String
|
|
96
|
+
) {
|
|
97
|
+
createCustomerV2(
|
|
98
|
+
name: $name
|
|
99
|
+
phone: $phone
|
|
100
|
+
email: $email
|
|
101
|
+
birthDate: $birthDate
|
|
102
|
+
tenantId: $tenantId
|
|
103
|
+
createdBy: $tenantId
|
|
104
|
+
) {
|
|
105
|
+
id
|
|
106
|
+
name
|
|
107
|
+
address
|
|
108
|
+
gender
|
|
109
|
+
identityNumber
|
|
110
|
+
birthDate
|
|
111
|
+
email
|
|
112
|
+
phone
|
|
113
|
+
createdStamp
|
|
114
|
+
createdBy
|
|
115
|
+
memberLevel
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
@@ -3,4 +3,5 @@ export declare class PaymentService extends Service {
|
|
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
4
|
getPaymentMethod(): Promise<any>;
|
|
5
5
|
createPaymentOrder(paymentOrderData: any): Promise<any>;
|
|
6
|
+
genQRPayment(orderId: any, totalAmount: any): Promise<any>;
|
|
6
7
|
}
|
|
@@ -46,5 +46,24 @@ class PaymentService extends service_1.Service {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
genQRPayment(orderId, totalAmount) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const query = queries_1.GEN_QR_PAYMENT;
|
|
52
|
+
const variables = {
|
|
53
|
+
orgId: this.orgId,
|
|
54
|
+
orderId,
|
|
55
|
+
storeId: this.storeId,
|
|
56
|
+
totalAmount,
|
|
57
|
+
};
|
|
58
|
+
try {
|
|
59
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
60
|
+
return response.genQRPayment;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.log(`Error fetching get genQRPayment method: ${error}`);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
49
68
|
}
|
|
50
69
|
exports.PaymentService = PaymentService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Service } from "../service";
|
|
2
|
-
import { createCompanyRequest, updateCustomerRequest } from "../../types/user";
|
|
2
|
+
import { createCompanyRequest, createCustomerRequest, dataCustomerRequest, updateCustomerRequest } from "../../types/user";
|
|
3
3
|
export declare class UserService extends Service {
|
|
4
4
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
5
5
|
getPersonByPartyIds(partyIds: string[]): Promise<any>;
|
|
@@ -8,4 +8,6 @@ export declare class UserService extends Service {
|
|
|
8
8
|
updateCustomerV2(id: string, customerItem: updateCustomerRequest, updatedBy: string): Promise<any>;
|
|
9
9
|
getCustomerById(id: string): Promise<any>;
|
|
10
10
|
searchCompany(keyword: string, limit: number): Promise<any>;
|
|
11
|
+
createCustomerV2(createCustomerRequest: createCustomerRequest, createdBy: string): Promise<any>;
|
|
12
|
+
createCustomer(dataCustomerRequest: dataCustomerRequest, createdBy: string, type: string): Promise<void>;
|
|
11
13
|
}
|
|
@@ -123,5 +123,49 @@ class UserService extends service_1.Service {
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
+
createCustomerV2(createCustomerRequest, createdBy) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const mutation = mutations_1.CREATE_CUSTOMER_V2;
|
|
129
|
+
const variables = {
|
|
130
|
+
name: createCustomerRequest === null || createCustomerRequest === void 0 ? void 0 : createCustomerRequest.name,
|
|
131
|
+
phone: (createCustomerRequest === null || createCustomerRequest === void 0 ? void 0 : createCustomerRequest.phone) || "",
|
|
132
|
+
email: (createCustomerRequest === null || createCustomerRequest === void 0 ? void 0 : createCustomerRequest.email) || "",
|
|
133
|
+
birthDate: (createCustomerRequest === null || createCustomerRequest === void 0 ? void 0 : createCustomerRequest.birthDate) || "",
|
|
134
|
+
tenantId: this.orgId,
|
|
135
|
+
createdBy: createdBy,
|
|
136
|
+
};
|
|
137
|
+
try {
|
|
138
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
139
|
+
return response.createCustomerV2;
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.log(`Error in createCustomerV2: ${error}`);
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
//PERSON/COMPANY
|
|
148
|
+
createCustomer(dataCustomerRequest, createdBy, type) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
const dataCreateCustomer = {
|
|
151
|
+
name: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.name) || "",
|
|
152
|
+
phone: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.phone) || "",
|
|
153
|
+
email: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.email) || "",
|
|
154
|
+
birthDate: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.birthDate) || "",
|
|
155
|
+
};
|
|
156
|
+
const dataCreateCompany = {
|
|
157
|
+
name: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.name) || "",
|
|
158
|
+
phone: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.phone) || "",
|
|
159
|
+
email: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.email) || "",
|
|
160
|
+
address: (dataCustomerRequest === null || dataCustomerRequest === void 0 ? void 0 : dataCustomerRequest.address) || "",
|
|
161
|
+
};
|
|
162
|
+
if (type == "PERSON") {
|
|
163
|
+
this.createCustomerV2(dataCreateCustomer, createdBy);
|
|
164
|
+
}
|
|
165
|
+
else if (type == "COMPANY") {
|
|
166
|
+
this.createCompany(dataCreateCompany, createdBy);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
126
170
|
}
|
|
127
171
|
exports.UserService = UserService;
|
package/dist/src/types/user.d.ts
CHANGED
|
@@ -51,3 +51,18 @@ export interface addressModel {
|
|
|
51
51
|
wardName: string;
|
|
52
52
|
isDefault: boolean;
|
|
53
53
|
}
|
|
54
|
+
export interface createCustomerRequest {
|
|
55
|
+
name: string;
|
|
56
|
+
phone: string;
|
|
57
|
+
email: string;
|
|
58
|
+
birthDate: Date;
|
|
59
|
+
}
|
|
60
|
+
export interface dataCustomerRequest {
|
|
61
|
+
name: string;
|
|
62
|
+
phone: string;
|
|
63
|
+
email: string;
|
|
64
|
+
address: string;
|
|
65
|
+
birthDate: Date;
|
|
66
|
+
tenantId: string;
|
|
67
|
+
createdBy: string;
|
|
68
|
+
}
|