@spritz-finance/service-client 0.4.6 → 0.4.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.
- package/lib/rain/rainServiceClient.d.ts +7 -3
- package/lib/rain/rainServiceClient.js +10 -2
- package/lib/rain/types.d.ts +10 -19
- package/lib/rain/types.js +15 -15
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as RainClient from
|
|
2
|
-
import { VirtualCardStatus } from
|
|
3
|
-
import { ApplicationStatus, CardOrderStatus, CardType, CreateRainApplicationInput, OrderPhysicalCardInput, OrderPhysicalCardResponse, RainCard, RainContract, RainUser, ShippingDetails, WithdrawalSignature } from
|
|
1
|
+
export * as RainClient from "./rainServiceClient";
|
|
2
|
+
import { VirtualCardStatus } from "../payableAccounts/types";
|
|
3
|
+
import { ApplicationStatus, CardDetailsResponse, CardOrderStatus, CardType, CreateRainApplicationInput, OrderPhysicalCardInput, OrderPhysicalCardResponse, RainCard, RainContract, RainUser, ShippingDetails, WithdrawalSignature } from "./types";
|
|
4
4
|
export declare function createCardApplication(userId: string, input: CreateRainApplicationInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RainUser>>;
|
|
5
5
|
export declare function getUserDepositAddress({ userId, network, }: {
|
|
6
6
|
userId: string;
|
|
@@ -33,6 +33,10 @@ export declare function getLiveBalance({ userId }: {
|
|
|
33
33
|
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<{
|
|
34
34
|
balance: number;
|
|
35
35
|
}>>;
|
|
36
|
+
export declare function getCardDetails({ userId, cardId }: {
|
|
37
|
+
userId: string;
|
|
38
|
+
cardId: string;
|
|
39
|
+
}): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<CardDetailsResponse>>;
|
|
36
40
|
export declare function requestWithdrawalSignature({ userId, network, amount, }: {
|
|
37
41
|
userId: string;
|
|
38
42
|
network: string;
|
|
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getCardUser = exports.getPendingCardOrder = exports.orderPhysicalCard = exports.adminGetUserInfo = exports.requestWithdrawalSignature = exports.getLiveBalance = exports.activatePhysicalCard = exports.updateCardStatus = exports.createRainCard = exports.validateContractAddress = exports.getUserDepositAddress = exports.createCardApplication = exports.RainClient = void 0;
|
|
26
|
+
exports.getCardUser = exports.getPendingCardOrder = exports.orderPhysicalCard = exports.adminGetUserInfo = exports.requestWithdrawalSignature = exports.getCardDetails = exports.getLiveBalance = exports.activatePhysicalCard = exports.updateCardStatus = exports.createRainCard = exports.validateContractAddress = exports.getUserDepositAddress = exports.createCardApplication = exports.RainClient = void 0;
|
|
27
27
|
exports.RainClient = __importStar(require("./rainServiceClient"));
|
|
28
28
|
const serviceClient_1 = require("../serviceClient");
|
|
29
|
-
const RAIN_ENDPOINT =
|
|
29
|
+
const RAIN_ENDPOINT = "/rain-v2";
|
|
30
30
|
async function createCardApplication(userId, input) {
|
|
31
31
|
return serviceClient_1.baseClient
|
|
32
32
|
.post(`${RAIN_ENDPOINT}/application?userId=${userId}`, input)
|
|
@@ -83,6 +83,14 @@ async function getLiveBalance({ userId }) {
|
|
|
83
83
|
.then((res) => res.data);
|
|
84
84
|
}
|
|
85
85
|
exports.getLiveBalance = getLiveBalance;
|
|
86
|
+
async function getCardDetails({ userId, cardId }) {
|
|
87
|
+
return serviceClient_1.baseClient
|
|
88
|
+
.post(`${RAIN_ENDPOINT}/api/cards/${cardId}/details`, {
|
|
89
|
+
userId,
|
|
90
|
+
})
|
|
91
|
+
.then((res) => res.data);
|
|
92
|
+
}
|
|
93
|
+
exports.getCardDetails = getCardDetails;
|
|
86
94
|
async function requestWithdrawalSignature({ userId, network, amount, }) {
|
|
87
95
|
return serviceClient_1.baseClient
|
|
88
96
|
.post(`${RAIN_ENDPOINT}/withdrawl-signature`, {
|
package/lib/rain/types.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export type RainUser = {
|
|
|
15
15
|
createdAt: string;
|
|
16
16
|
updatedAt: string;
|
|
17
17
|
};
|
|
18
|
+
export type CardDetailsResponse = {
|
|
19
|
+
number: string;
|
|
20
|
+
cvv: string;
|
|
21
|
+
expirationMonth: string;
|
|
22
|
+
expirationYear: string;
|
|
23
|
+
};
|
|
18
24
|
export type RainContract = {
|
|
19
25
|
id: string;
|
|
20
26
|
externalId: string;
|
|
@@ -38,7 +44,7 @@ export declare const CardStatus: {
|
|
|
38
44
|
readonly Locked: "locked";
|
|
39
45
|
readonly Canceled: "canceled";
|
|
40
46
|
};
|
|
41
|
-
export type CardStatus = typeof CardStatus[keyof typeof CardStatus];
|
|
47
|
+
export type CardStatus = (typeof CardStatus)[keyof typeof CardStatus];
|
|
42
48
|
export type ShippingDetails = {
|
|
43
49
|
address: {
|
|
44
50
|
street: string;
|
|
@@ -62,12 +68,12 @@ export declare const ApplicationStatus: {
|
|
|
62
68
|
readonly Canceled: "canceled";
|
|
63
69
|
readonly NotStarted: "notStarted";
|
|
64
70
|
};
|
|
65
|
-
export type ApplicationStatus = typeof ApplicationStatus[keyof typeof ApplicationStatus];
|
|
71
|
+
export type ApplicationStatus = (typeof ApplicationStatus)[keyof typeof ApplicationStatus];
|
|
66
72
|
export declare const CardType: {
|
|
67
73
|
readonly Physical: "physical";
|
|
68
74
|
readonly Virtual: "virtual";
|
|
69
75
|
};
|
|
70
|
-
export type CardType = typeof CardType[keyof typeof CardType];
|
|
76
|
+
export type CardType = (typeof CardType)[keyof typeof CardType];
|
|
71
77
|
export type RainCard = {
|
|
72
78
|
id: string;
|
|
73
79
|
externalId: string;
|
|
@@ -83,22 +89,7 @@ export type RainCard = {
|
|
|
83
89
|
};
|
|
84
90
|
export type WithdrawalSignature = {
|
|
85
91
|
to: string;
|
|
86
|
-
args: [
|
|
87
|
-
string,
|
|
88
|
-
string,
|
|
89
|
-
string,
|
|
90
|
-
string,
|
|
91
|
-
number,
|
|
92
|
-
number[],
|
|
93
|
-
string,
|
|
94
|
-
[
|
|
95
|
-
string
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
string
|
|
99
|
-
],
|
|
100
|
-
boolean
|
|
101
|
-
];
|
|
92
|
+
args: [string, string, string, string, number, number[], string, [string], [string], boolean];
|
|
102
93
|
};
|
|
103
94
|
export interface OrderPhysicalCardInput {
|
|
104
95
|
userId: string;
|
package/lib/rain/types.js
CHANGED
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CardOrderStatus = exports.CardType = exports.ApplicationStatus = exports.CardStatus = void 0;
|
|
4
4
|
exports.CardStatus = {
|
|
5
|
-
NotActivated:
|
|
6
|
-
Active:
|
|
7
|
-
Locked:
|
|
8
|
-
Canceled:
|
|
5
|
+
NotActivated: "notActivated",
|
|
6
|
+
Active: "active",
|
|
7
|
+
Locked: "locked",
|
|
8
|
+
Canceled: "canceled",
|
|
9
9
|
};
|
|
10
10
|
exports.ApplicationStatus = {
|
|
11
|
-
Approved:
|
|
12
|
-
Pending:
|
|
13
|
-
NeedsInformation:
|
|
14
|
-
NeedsVerification:
|
|
15
|
-
ManualReview:
|
|
16
|
-
Denied:
|
|
17
|
-
Locked:
|
|
18
|
-
Canceled:
|
|
11
|
+
Approved: "approved",
|
|
12
|
+
Pending: "pending",
|
|
13
|
+
NeedsInformation: "needsInformation",
|
|
14
|
+
NeedsVerification: "needsVerification",
|
|
15
|
+
ManualReview: "manualReview",
|
|
16
|
+
Denied: "denied",
|
|
17
|
+
Locked: "locked",
|
|
18
|
+
Canceled: "canceled",
|
|
19
19
|
// internal status
|
|
20
|
-
NotStarted:
|
|
20
|
+
NotStarted: "notStarted",
|
|
21
21
|
};
|
|
22
22
|
exports.CardType = {
|
|
23
|
-
Physical:
|
|
24
|
-
Virtual:
|
|
23
|
+
Physical: "physical",
|
|
24
|
+
Virtual: "virtual",
|
|
25
25
|
};
|
|
26
26
|
var CardOrderStatus;
|
|
27
27
|
(function (CardOrderStatus) {
|