web3-banking-system-sdk 1.0.6 → 1.0.8
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/api/service/baseService.d.ts +0 -1
- package/dist/api/service/baseService.js +3 -8
- package/dist/api/service/programService.js +2 -1
- package/dist/api/service/promotionService.d.ts +1 -7
- package/dist/api/service/promotionService.js +9 -14
- package/dist/api/service/transactionService.js +2 -2
- package/package.json +1 -1
|
@@ -18,7 +18,6 @@ declare abstract class BaseService {
|
|
|
18
18
|
protected PUT<T extends BaseResult>(url: string, data: object | string, options?: ServiceRequestOptions): Promise<ApiResponse<T>>;
|
|
19
19
|
protected DELETE<T extends BaseResult>(url: string, options?: ServiceRequestOptions): Promise<ApiResponse<T>>;
|
|
20
20
|
protected resolveURL(path?: string | number): string;
|
|
21
|
-
protected getBaseURL(): string | undefined;
|
|
22
21
|
private buildConfig;
|
|
23
22
|
private buildFlagHeaders;
|
|
24
23
|
}
|
|
@@ -53,17 +53,12 @@ class BaseService {
|
|
|
53
53
|
const normalized = p && !p.startsWith("/") ? `/${p}` : p;
|
|
54
54
|
return `${this.endpoint}${normalized}`;
|
|
55
55
|
}
|
|
56
|
-
// Override in a subclass to route all its requests to a different host.
|
|
57
|
-
// Returning undefined falls back to context.getBaseUrl() in the interceptor.
|
|
58
|
-
getBaseURL() {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
56
|
// Precedence: caller `headers` > flag-derived headers; interceptor wins over both.
|
|
62
|
-
// Caller `baseURL` > service `getBaseURL()` > context base URL.
|
|
63
57
|
buildConfig(options) {
|
|
64
|
-
|
|
58
|
+
if (!options)
|
|
59
|
+
return {};
|
|
60
|
+
const { flags, headers, ...rest } = options;
|
|
65
61
|
return {
|
|
66
|
-
baseURL: this.getBaseURL(),
|
|
67
62
|
...rest,
|
|
68
63
|
headers: { ...this.buildFlagHeaders(flags), ...headers },
|
|
69
64
|
};
|
|
@@ -15,7 +15,8 @@ class ProgramService extends BaseService {
|
|
|
15
15
|
await AxiosHelper.injectLimitedToken(req, this.authService, this.cookiesHelper);
|
|
16
16
|
return req;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
// #endregion
|
|
19
|
+
// #region "GET"
|
|
19
20
|
get() {
|
|
20
21
|
const url = this.resolveURL(this.context.getProgramId());
|
|
21
22
|
return this.GET(url);
|
|
@@ -4,13 +4,7 @@ import type { GGEZGiftRewards, PromotionDetails, PromotionIncrementResult, Promo
|
|
|
4
4
|
declare class PromotionService extends BaseService {
|
|
5
5
|
protected endpoint: string;
|
|
6
6
|
constructor(data: PromotionServiceParameters);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Every endpoint on this service nests its payload under `data` instead of
|
|
10
|
-
* returning it flat — the same shape `BlockchainAPI.getBalanceAndFee` works
|
|
11
|
-
* around. Hoist it here so every caller sees one flat result.
|
|
12
|
-
*/
|
|
13
|
-
private static flatten;
|
|
7
|
+
private onPromotionRequest;
|
|
14
8
|
getPromotionByCode(promotionCode: string): Promise<ApiResponse<PromotionDetails>>;
|
|
15
9
|
getTwitterSpotlightPostIds(): Promise<ApiResponse<TwitterSpotlightPostIdsResult>>;
|
|
16
10
|
incrementPromotionParticipants(data: GGEZGiftRewards): Promise<ApiResponse<PromotionIncrementResult>>;
|
|
@@ -4,36 +4,31 @@ class PromotionService extends BaseService {
|
|
|
4
4
|
endpoint = Endpoints.Promotion;
|
|
5
5
|
constructor(data) {
|
|
6
6
|
super(data);
|
|
7
|
+
this.axiosInstance.interceptors.request.use((req) => this.onPromotionRequest(req));
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Every endpoint on this service nests its payload under `data` instead of
|
|
13
|
-
* returning it flat — the same shape `BlockchainAPI.getBalanceAndFee` works
|
|
14
|
-
* around. Hoist it here so every caller sees one flat result.
|
|
15
|
-
*/
|
|
16
|
-
static flatten(response) {
|
|
17
|
-
const { data: nested, ...flat } = response.data;
|
|
18
|
-
return { ...response, data: { ...flat, ...nested } };
|
|
9
|
+
// #region "Interceptors Handlers"
|
|
10
|
+
async onPromotionRequest(req) {
|
|
11
|
+
req.baseURL = this.context.getNodeUrl();
|
|
12
|
+
return req;
|
|
19
13
|
}
|
|
14
|
+
// #endregion
|
|
20
15
|
// #region "GET"
|
|
21
16
|
async getPromotionByCode(promotionCode) {
|
|
22
17
|
const url = this.resolveURL(`/${promotionCode}`);
|
|
23
18
|
const response = await this.GET(url);
|
|
24
|
-
return
|
|
19
|
+
return response;
|
|
25
20
|
}
|
|
26
21
|
async getTwitterSpotlightPostIds() {
|
|
27
22
|
const url = this.resolveURL("/spotlight/twitter");
|
|
28
23
|
const response = await this.GET(url);
|
|
29
|
-
return
|
|
24
|
+
return response;
|
|
30
25
|
}
|
|
31
26
|
// #endregion
|
|
32
27
|
// #region "PUT"
|
|
33
28
|
async incrementPromotionParticipants(data) {
|
|
34
29
|
const url = this.resolveURL();
|
|
35
30
|
const response = await this.PUT(url, data);
|
|
36
|
-
return
|
|
31
|
+
return response;
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
export { PromotionService };
|
|
@@ -8,13 +8,13 @@ class TransactionService extends BaseService {
|
|
|
8
8
|
// #region "GET"
|
|
9
9
|
inquiry(payload) {
|
|
10
10
|
const url = this.resolveURL(TransactionEndpoints.Inquiry);
|
|
11
|
-
return this.GET(url, { params: payload });
|
|
11
|
+
return this.GET(url, { params: payload, flags: { showSensitiveData: true } });
|
|
12
12
|
}
|
|
13
13
|
// #endregion
|
|
14
14
|
// #region "POST"
|
|
15
15
|
create(payload) {
|
|
16
16
|
const url = this.resolveURL();
|
|
17
|
-
return this.POST(url, payload);
|
|
17
|
+
return this.POST(url, payload, { flags: { showSensitiveData: true } });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
export { TransactionService };
|
package/package.json
CHANGED