squarefi-bff-api-module 1.7.1 → 1.8.1
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/issuing.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.issuing = void 0;
|
|
4
13
|
const apiClientFactory_1 = require("../utils/apiClientFactory");
|
|
5
14
|
const constants_1 = require("../constants");
|
|
15
|
+
const fiat_accounts_1 = require("./fiat_accounts");
|
|
6
16
|
exports.issuing = {
|
|
7
17
|
cards: {
|
|
8
18
|
create: {
|
|
@@ -16,7 +26,12 @@ exports.issuing = {
|
|
|
16
26
|
}),
|
|
17
27
|
getByFiatAccount: (params) => apiClientFactory_1.apiClientV1.getRequest('/issuing/cards', { params }),
|
|
18
28
|
},
|
|
19
|
-
getById: (card_id) =>
|
|
29
|
+
// getById: (card_id: string) => apiClientV1.getRequest<API.Cards.IssuingCardDetailItem>(`/issuing/cards/${card_id}`),
|
|
30
|
+
getById: (card_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
const card = yield apiClientFactory_1.apiClientV1.getRequest(`/issuing/cards/${card_id}`);
|
|
32
|
+
const fiatAccountData = yield fiat_accounts_1.fiat_accounts.getByUuid(card.fiat_account.id);
|
|
33
|
+
return Object.assign(Object.assign({}, card), { fiat_account: Object.assign(Object.assign({}, fiatAccountData), { type: card.fiat_account.type }) });
|
|
34
|
+
}),
|
|
20
35
|
sensitiveData: {
|
|
21
36
|
get: (card_id) => apiClientFactory_1.apiClientV1.getRequest(`/issuing/cards/${card_id}/sensitive`),
|
|
22
37
|
otp: {
|
|
@@ -36,7 +36,7 @@ const tokensFactory_1 = require("../utils/tokensFactory");
|
|
|
36
36
|
const apiV1BaseURL = (_a = process.env.API_URL) !== null && _a !== void 0 ? _a : 'ENV variable API_URL is not defined';
|
|
37
37
|
const apiV2BaseURL = (_b = process.env.API_V2_URL) !== null && _b !== void 0 ? _b : 'ENV variable API_V2_URL is not defined';
|
|
38
38
|
const envTenantId = (_c = process.env.TENANT_ID) !== null && _c !== void 0 ? _c : 'ENV variable TENANT_ID is not defined';
|
|
39
|
-
const envLogoutURL = (_d = process.env.LOGOUT_URL) !== null && _d !== void 0 ? _d : 'auth/logout';
|
|
39
|
+
const envLogoutURL = (_d = process.env.LOGOUT_URL) !== null && _d !== void 0 ? _d : '/auth/logout';
|
|
40
40
|
const createApiClient = ({ baseURL, isBearerToken, tenantId }) => {
|
|
41
41
|
const instance = axios_1.default.create({
|
|
42
42
|
baseURL,
|
package/package.json
CHANGED
package/src/api/issuing.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { API } from './types';
|
|
|
3
3
|
import { apiClientV1 } from '../utils/apiClientFactory';
|
|
4
4
|
|
|
5
5
|
import { defaultPaginationParams, SubAccountType } from '../constants';
|
|
6
|
+
import { fiat_accounts } from './fiat_accounts';
|
|
6
7
|
|
|
7
8
|
export const issuing = {
|
|
8
9
|
cards: {
|
|
@@ -22,7 +23,12 @@ export const issuing = {
|
|
|
22
23
|
getByFiatAccount: (params: API.Cards.CardsList.Request.ByFiatAccountAndWalletId) =>
|
|
23
24
|
apiClientV1.getRequest<API.Cards.CardsList.Response>('/issuing/cards', { params }),
|
|
24
25
|
},
|
|
25
|
-
getById: (card_id: string) => apiClientV1.getRequest<API.Cards.IssuingCardDetailItem>(`/issuing/cards/${card_id}`),
|
|
26
|
+
// getById: (card_id: string) => apiClientV1.getRequest<API.Cards.IssuingCardDetailItem>(`/issuing/cards/${card_id}`),
|
|
27
|
+
getById: async (card_id: string): Promise<API.Cards.IssuingCardDetailItem> => {
|
|
28
|
+
const card = await apiClientV1.getRequest<API.Cards.IssuingCardDetailItem>(`/issuing/cards/${card_id}`);
|
|
29
|
+
const fiatAccountData = await fiat_accounts.getByUuid(card.fiat_account.id);
|
|
30
|
+
return { ...card, fiat_account: { ...fiatAccountData, type: card.fiat_account.type } };
|
|
31
|
+
},
|
|
26
32
|
sensitiveData: {
|
|
27
33
|
get: (card_id: string) => apiClientV1.getRequest<API.Cards.SensitiveData>(`/issuing/cards/${card_id}/sensitive`),
|
|
28
34
|
otp: {
|
|
@@ -13,7 +13,7 @@ import { deleteTokens, refreshTokens } from '../utils/tokensFactory';
|
|
|
13
13
|
const apiV1BaseURL = process.env.API_URL ?? 'ENV variable API_URL is not defined';
|
|
14
14
|
const apiV2BaseURL = process.env.API_V2_URL ?? 'ENV variable API_V2_URL is not defined';
|
|
15
15
|
const envTenantId = process.env.TENANT_ID ?? 'ENV variable TENANT_ID is not defined';
|
|
16
|
-
const envLogoutURL = process.env.LOGOUT_URL ?? 'auth/logout';
|
|
16
|
+
const envLogoutURL = process.env.LOGOUT_URL ?? '/auth/logout';
|
|
17
17
|
|
|
18
18
|
type CreateApiClientOptions = {
|
|
19
19
|
baseURL: string;
|