@spritz-finance/service-client 0.2.101 → 0.3.0

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/index.d.ts CHANGED
@@ -4,7 +4,6 @@ export * from './serviceClient';
4
4
  export * from './verificationServiceClient';
5
5
  export * from './transactionsServiceClient';
6
6
  export * from './usersServiceClient';
7
- export * from './featuresServiceClient';
8
7
  export * from './growthServiceClient';
9
8
  export * from './liabilitiesServiceClient';
10
9
  export * from './payableAccountsServiceClient';
@@ -12,5 +11,3 @@ export * from './exchangeRatesServiceClient';
12
11
  export * from './web3ServiceClient';
13
12
  export * from './unblockServiceClient';
14
13
  export * from './onrampServiceClient';
15
- export * from './utils';
16
- export * from './types';
package/lib/index.js CHANGED
@@ -20,7 +20,6 @@ __exportStar(require("./serviceClient"), exports);
20
20
  __exportStar(require("./verificationServiceClient"), exports);
21
21
  __exportStar(require("./transactionsServiceClient"), exports);
22
22
  __exportStar(require("./usersServiceClient"), exports);
23
- __exportStar(require("./featuresServiceClient"), exports);
24
23
  __exportStar(require("./growthServiceClient"), exports);
25
24
  __exportStar(require("./liabilitiesServiceClient"), exports);
26
25
  __exportStar(require("./payableAccountsServiceClient"), exports);
@@ -28,5 +27,3 @@ __exportStar(require("./exchangeRatesServiceClient"), exports);
28
27
  __exportStar(require("./web3ServiceClient"), exports);
29
28
  __exportStar(require("./unblockServiceClient"), exports);
30
29
  __exportStar(require("./onrampServiceClient"), exports);
31
- __exportStar(require("./utils"), exports);
32
- __exportStar(require("./types"), exports);
@@ -18,7 +18,7 @@ export declare enum RewardCreditSource {
18
18
  OTHER = "OTHER",
19
19
  REVENUE_SHARE = "REVENUE_SHARE"
20
20
  }
21
- export type Payment = {
21
+ type Payment = {
22
22
  _id: string;
23
23
  accountId: string;
24
24
  amount: number;
@@ -128,7 +128,7 @@ interface IEntity {
128
128
  address: IEntityAddress;
129
129
  status: TEntityStatuses;
130
130
  error: IResourceError | null;
131
- metadata: {} | null;
131
+ metadata: any | null;
132
132
  created_at: string;
133
133
  updated_at: string;
134
134
  }
@@ -138,7 +138,7 @@ interface MethodFiEntity extends IEntity {
138
138
  interface IEntityCreateOpts {
139
139
  type: TEntityTypes;
140
140
  address?: IEntityAddress | null;
141
- metadata?: {};
141
+ metadata?: any;
142
142
  }
143
143
  interface IEntityCorporationOwner {
144
144
  first_name: string | null;
@@ -238,7 +238,6 @@ export declare class LiabilitiesServiceClient {
238
238
  createMethodFiEntity(args: CreateEntityParams): Promise<MethodFiEntity>;
239
239
  getMethodFiEntity(userId: string): Promise<MethodFiEntity>;
240
240
  createCheckbookUser(args: CreateCheckbookUserParams): Promise<CheckbookUser>;
241
- upsertCheckbookUser(args: CreateCheckbookUserParams): Promise<import("./types").ApiFailure | import("./types").ApiSuccess<CheckbookUser>>;
242
241
  getCheckbookUser(userId: string): Promise<CheckbookUser>;
243
242
  createCheckbookVirtualCard(userId: string): Promise<CheckbookCardResponse>;
244
243
  createCheckbookDebitCard(input: CreateDebitCardInput): Promise<CheckbookDebitCardResponse>;
@@ -249,12 +248,10 @@ export declare class LiabilitiesServiceClient {
249
248
  createDirectPayment(args: CreateDirectPaymentArgs): Promise<DirectPayment>;
250
249
  validateDirectPayment(args: CreateDirectPaymentArgs): Promise<DirectPayment>;
251
250
  getValidPaymentsForAccount(accountId: string): Promise<Payment[]>;
252
- getValidPaymentsForUser(userId: string): Promise<Payment[]>;
253
251
  getRewardTransactionVolume(args: GetUsersTransactionVolumeBody): Promise<number>;
254
252
  getRewardFeeAmount(args: GetUserRewardFeeAmountBody): Promise<number>;
255
253
  initializeExternalPayment(args: ExternalPaymentInput): Promise<Payment>;
256
254
  scheduleExternalPayment(args: ExternalPaymentInput): Promise<Payment>;
257
255
  updateExternalPaymentStatus(paymentId: string, status: PaymentStatus): Promise<Payment>;
258
- getDirectPaymentToken(directPaymentId: string): Promise<string | null>;
259
256
  }
260
257
  export {};
@@ -58,11 +58,6 @@ class LiabilitiesServiceClient {
58
58
  .post(`/checkbook/user`, args)
59
59
  .then((res) => res.data);
60
60
  }
61
- async upsertCheckbookUser(args) {
62
- return this.client
63
- .post(`/checkbook/user/upsert`, args)
64
- .then((res) => res.data);
65
- }
66
61
  async getCheckbookUser(userId) {
67
62
  return this.client
68
63
  .get(`/checkbook/user/${userId}`)
@@ -119,11 +114,6 @@ class LiabilitiesServiceClient {
119
114
  .get(`/payments/valid-payments/account/${accountId}`)
120
115
  .then((res) => res.data);
121
116
  }
122
- async getValidPaymentsForUser(userId) {
123
- return this.client
124
- .get(`/payments/valid-payments/user/${userId}`)
125
- .then((res) => res.data);
126
- }
127
117
  async getRewardTransactionVolume(args) {
128
118
  return this.client
129
119
  .post('/payments/rewards/volume', args)
@@ -149,10 +139,5 @@ class LiabilitiesServiceClient {
149
139
  .post(`/external-payment/status/${paymentId}`, { status })
150
140
  .then((res) => res.data);
151
141
  }
152
- async getDirectPaymentToken(directPaymentId) {
153
- return this.client
154
- .get(`/direct-payments/${directPaymentId}/token`)
155
- .then((res) => res.data);
156
- }
157
142
  }
158
143
  exports.LiabilitiesServiceClient = LiabilitiesServiceClient;
@@ -86,6 +86,7 @@ export type Address = {
86
86
  export type AdminIssuePaymentInput = {
87
87
  accountId: Scalars['String']['input'];
88
88
  amount: Scalars['Float']['input'];
89
+ paymentProvider: PaymentProvider;
89
90
  userId: Scalars['String']['input'];
90
91
  };
91
92
  export type ApiToken = {
@@ -145,6 +146,7 @@ export type BankAccount = PayableAccount & {
145
146
  paymentCount: Scalars['Int']['output'];
146
147
  paymentVolume: Scalars['Float']['output'];
147
148
  provider: Scalars['String']['output'];
149
+ testPaymentAvailable: Scalars['Boolean']['output'];
148
150
  type: PayableAccountType;
149
151
  user: User;
150
152
  userId: Scalars['String']['output'];
@@ -212,7 +214,6 @@ export type BasicPayableAccount = {
212
214
  export declare enum BasicPayableAccountType {
213
215
  BankAccount = "BANK_ACCOUNT",
214
216
  Bill = "BILL",
215
- DebitCard = "DEBIT_CARD",
216
217
  PayOthers = "PAY_OTHERS",
217
218
  SpritzCard = "SPRITZ_CARD"
218
219
  }
@@ -237,6 +238,7 @@ export type Bill = PayableAccount & {
237
238
  paymentCount: Scalars['Int']['output'];
238
239
  paymentVolume: Scalars['Float']['output'];
239
240
  provider: Scalars['String']['output'];
241
+ testPaymentAvailable: Scalars['Boolean']['output'];
240
242
  type: PayableAccountType;
241
243
  user: User;
242
244
  userId: Scalars['String']['output'];
@@ -291,26 +293,6 @@ export type BillingInfo = {
291
293
  holder: Scalars['String']['output'];
292
294
  phone: Scalars['String']['output'];
293
295
  };
294
- export type BlockchainTransaction = {
295
- __typename?: 'BlockchainTransaction';
296
- asset?: Maybe<Scalars['String']['output']>;
297
- from?: Maybe<Scalars['String']['output']>;
298
- hash: Scalars['String']['output'];
299
- link: Scalars['String']['output'];
300
- network: Scalars['String']['output'];
301
- paymentToken?: Maybe<BlockchainTransactionToken>;
302
- sourceToken?: Maybe<BlockchainTransactionToken>;
303
- to?: Maybe<Scalars['String']['output']>;
304
- value?: Maybe<Scalars['Float']['output']>;
305
- };
306
- export type BlockchainTransactionToken = {
307
- __typename?: 'BlockchainTransactionToken';
308
- address: Scalars['String']['output'];
309
- amount: Scalars['Float']['output'];
310
- amountRaw: Scalars['String']['output'];
311
- decimals: Scalars['Float']['output'];
312
- symbol: Scalars['String']['output'];
313
- };
314
296
  export type BrexBalance = {
315
297
  __typename?: 'BrexBalance';
316
298
  available: Scalars['Float']['output'];
@@ -328,20 +310,6 @@ export type BridgeUser = {
328
310
  type?: Maybe<Scalars['String']['output']>;
329
311
  userId: Scalars['ObjectID']['output'];
330
312
  };
331
- export type BridgeVirtualAccount = {
332
- __typename?: 'BridgeVirtualAccount';
333
- address: Scalars['String']['output'];
334
- createdAt: Scalars['DateTimeISO']['output'];
335
- currency: Scalars['String']['output'];
336
- depositInstructions?: Maybe<VirtualAccountDepositInstructions>;
337
- deposited: Scalars['Boolean']['output'];
338
- externalId: Scalars['String']['output'];
339
- id: Scalars['ID']['output'];
340
- microdeposits?: Maybe<Array<Scalars['Float']['output']>>;
341
- network: Scalars['String']['output'];
342
- token: Scalars['String']['output'];
343
- userId: Scalars['ObjectID']['output'];
344
- };
345
313
  export type BusinessIdentity = {
346
314
  __typename?: 'BusinessIdentity';
347
315
  address?: Maybe<Address>;
@@ -443,11 +411,6 @@ export type CognitoKycFlowTemplate = {
443
411
  id: Scalars['ID']['output'];
444
412
  version: Scalars['Int']['output'];
445
413
  };
446
- export type CreateBridgeVirtualAccountInput = {
447
- address: Scalars['String']['input'];
448
- network: Scalars['String']['input'];
449
- token: Scalars['String']['input'];
450
- };
451
414
  export type CreateDirectPaymentInput = {
452
415
  accountId: Scalars['String']['input'];
453
416
  amount: Scalars['Float']['input'];
@@ -457,6 +420,8 @@ export type CreateDirectPaymentInput = {
457
420
  /** The amount of rewards balance to apply to the payment */
458
421
  rewardsAmount?: InputMaybe<Scalars['Float']['input']>;
459
422
  subscriptionId?: InputMaybe<Scalars['String']['input']>;
423
+ /** Whether to apply testPayment rewards */
424
+ testPayment?: InputMaybe<Scalars['Boolean']['input']>;
460
425
  tokenAddress?: InputMaybe<Scalars['String']['input']>;
461
426
  };
462
427
  export type CreateOnrampPaymentInput = {
@@ -512,10 +477,10 @@ export type DebitCard = PayableAccount & {
512
477
  originalName?: Maybe<Scalars['String']['output']>;
513
478
  originator: PayableAccountOriginator;
514
479
  payable: Scalars['Boolean']['output'];
515
- paymentAddresses: Array<PaymentAddress>;
516
480
  paymentCount: Scalars['Int']['output'];
517
481
  paymentVolume: Scalars['Float']['output'];
518
482
  provider: Scalars['String']['output'];
483
+ testPaymentAvailable: Scalars['Boolean']['output'];
519
484
  type: PayableAccountType;
520
485
  user: User;
521
486
  userId: Scalars['String']['output'];
@@ -564,6 +529,7 @@ export type DirectPayment = {
564
529
  targetCurrencyAmount: Scalars['Float']['output'];
565
530
  targetCurrencyFee: Scalars['Float']['output'];
566
531
  targetCurrencyRate: Scalars['Float']['output'];
532
+ testPayment?: Maybe<Scalars['Boolean']['output']>;
567
533
  toAddress?: Maybe<Scalars['String']['output']>;
568
534
  tokenAddress: Scalars['String']['output'];
569
535
  totalAmount: Scalars['Float']['output'];
@@ -602,10 +568,6 @@ export declare enum DirectPaymentTransactionReferenceStatus {
602
568
  Confirmed = "CONFIRMED",
603
569
  Pending = "PENDING"
604
570
  }
605
- export type DismissedItems = {
606
- __typename?: 'DismissedItems';
607
- onboardingChecklist?: Maybe<Scalars['DateTimeISO']['output']>;
608
- };
609
571
  export type ExchangeRate = {
610
572
  __typename?: 'ExchangeRate';
611
573
  base: Scalars['String']['output'];
@@ -773,7 +735,7 @@ export type MethodFiEntity = {
773
735
  individual?: Maybe<MethodFiEntityIndividual>;
774
736
  locked: Scalars['Boolean']['output'];
775
737
  status: Scalars['String']['output'];
776
- type?: Maybe<Scalars['String']['output']>;
738
+ type: Scalars['String']['output'];
777
739
  updatedAt: Scalars['DateTimeISO']['output'];
778
740
  userId: Scalars['ObjectID']['output'];
779
741
  };
@@ -897,12 +859,10 @@ export type Mutation = {
897
859
  createUSBankAccount: BankAccount;
898
860
  createUSVirtualDebitCard: VirtualCard;
899
861
  createUser: User;
900
- createVirtualAccount: BridgeVirtualAccount;
901
862
  deleteDirectPayment: Scalars['Boolean']['output'];
902
863
  deletePayableAccount: PayableAccount;
903
864
  deleteSubscription: Scalars['Boolean']['output'];
904
865
  disableUser?: Maybe<Verification>;
905
- dismissItem: Scalars['Boolean']['output'];
906
866
  finishBridgeUserSetup: BridgeUser;
907
867
  flushBalances: Array<TokenBalance>;
908
868
  forcePayment: Payment;
@@ -914,8 +874,6 @@ export type Mutation = {
914
874
  markNotificationAsRead?: Maybe<UserNotification>;
915
875
  methodFiUpdateSSN: MethodFiEntity;
916
876
  moveMoney: Scalars['Boolean']['output'];
917
- paymentAddressForceWithdrawal: Scalars['String']['output'];
918
- paymentAddressRescueNative: Scalars['String']['output'];
919
877
  refreshEntities: Scalars['Boolean']['output'];
920
878
  refundPayment: Payment;
921
879
  refundPaymentWithCredits: Payment;
@@ -952,7 +910,6 @@ export type Mutation = {
952
910
  updateEntityAuthentication?: Maybe<MethodFiEntity>;
953
911
  updateReferralCode: Referral;
954
912
  updateTokenPreferences: Scalars['Boolean']['output'];
955
- updateUnblockUser: Scalars['Boolean']['output'];
956
913
  updateUserTimezone: User;
957
914
  };
958
915
  export type MutationAddAssociatedWalletArgs = {
@@ -1040,9 +997,6 @@ export type MutationCreateUsVirtualDebitCardArgs = {
1040
997
  export type MutationCreateUserArgs = {
1041
998
  createUser: CreateUserInput;
1042
999
  };
1043
- export type MutationCreateVirtualAccountArgs = {
1044
- createBridgeVirtualAccountInput: CreateBridgeVirtualAccountInput;
1045
- };
1046
1000
  export type MutationDeleteDirectPaymentArgs = {
1047
1001
  directPaymentId: Scalars['String']['input'];
1048
1002
  };
@@ -1055,9 +1009,6 @@ export type MutationDeleteSubscriptionArgs = {
1055
1009
  export type MutationDisableUserArgs = {
1056
1010
  userId: Scalars['String']['input'];
1057
1011
  };
1058
- export type MutationDismissItemArgs = {
1059
- property: Scalars['String']['input'];
1060
- };
1061
1012
  export type MutationFinishBridgeUserSetupArgs = {
1062
1013
  ssn: Scalars['String']['input'];
1063
1014
  };
@@ -1091,17 +1042,6 @@ export type MutationMoveMoneyArgs = {
1091
1042
  from: Scalars['String']['input'];
1092
1043
  to: Scalars['String']['input'];
1093
1044
  };
1094
- export type MutationPaymentAddressForceWithdrawalArgs = {
1095
- address: Scalars['String']['input'];
1096
- network: Scalars['String']['input'];
1097
- token: Scalars['String']['input'];
1098
- validate: Scalars['Boolean']['input'];
1099
- };
1100
- export type MutationPaymentAddressRescueNativeArgs = {
1101
- address: Scalars['String']['input'];
1102
- network: Scalars['String']['input'];
1103
- to: Scalars['String']['input'];
1104
- };
1105
1045
  export type MutationRefundPaymentArgs = {
1106
1046
  refundPaymentInput: RefundPaymentInput;
1107
1047
  };
@@ -1189,7 +1129,6 @@ export type MutationSubmitBankAccountVerificationArgs = {
1189
1129
  otp: Scalars['String']['input'];
1190
1130
  };
1191
1131
  export type MutationUpdateAnalyticsSessionArgs = {
1192
- gclid?: InputMaybe<Scalars['String']['input']>;
1193
1132
  sessionId: Scalars['String']['input'];
1194
1133
  };
1195
1134
  export type MutationUpdateAppDomainArgs = {
@@ -1210,9 +1149,6 @@ export type MutationUpdateReferralCodeArgs = {
1210
1149
  export type MutationUpdateTokenPreferencesArgs = {
1211
1150
  tokenPreferencesInput: TokenPreferencesInput;
1212
1151
  };
1213
- export type MutationUpdateUnblockUserArgs = {
1214
- unblockUserInput: UnblockUserInput;
1215
- };
1216
1152
  export type MutationUpdateUserTimezoneArgs = {
1217
1153
  timezone: Scalars['String']['input'];
1218
1154
  };
@@ -1245,9 +1181,7 @@ export type OnRampPayment = {
1245
1181
  status: OnrampPaymentStatus;
1246
1182
  token: Scalars['String']['output'];
1247
1183
  totalAmount: Scalars['Float']['output'];
1248
- transactionHash?: Maybe<Scalars['String']['output']>;
1249
1184
  userId: Scalars['ObjectID']['output'];
1250
- virtualAccountId?: Maybe<Scalars['ObjectID']['output']>;
1251
1185
  };
1252
1186
  export type OnrampPaymentDepositInstructions = {
1253
1187
  __typename?: 'OnrampPaymentDepositInstructions';
@@ -1318,6 +1252,7 @@ export type PayableAccount = {
1318
1252
  paymentCount: Scalars['Int']['output'];
1319
1253
  paymentVolume: Scalars['Float']['output'];
1320
1254
  provider: Scalars['String']['output'];
1255
+ testPaymentAvailable: Scalars['Boolean']['output'];
1321
1256
  type: PayableAccountType;
1322
1257
  user: User;
1323
1258
  userId: Scalars['String']['output'];
@@ -1371,7 +1306,6 @@ export type Payment = {
1371
1306
  targetCurrencyFee: Scalars['Float']['output'];
1372
1307
  targetCurrencyRate?: Maybe<Scalars['Float']['output']>;
1373
1308
  targetCurrencyTransactionFee: Scalars['Float']['output'];
1374
- transaction?: Maybe<BlockchainTransaction>;
1375
1309
  type: Scalars['String']['output'];
1376
1310
  user: User;
1377
1311
  userId: Scalars['ObjectID']['output'];
@@ -1427,7 +1361,6 @@ export type PaymentRefund = {
1427
1361
  to?: Maybe<Scalars['String']['output']>;
1428
1362
  };
1429
1363
  export declare enum PaymentSource {
1430
- Admin = "Admin",
1431
1364
  External = "External",
1432
1365
  Integrator = "Integrator",
1433
1366
  Mobile = "Mobile",
@@ -1435,8 +1368,7 @@ export declare enum PaymentSource {
1435
1368
  MobileIos = "MobileIOS",
1436
1369
  PaymentAddress = "PaymentAddress",
1437
1370
  Subscription = "Subscription",
1438
- Web = "Web",
1439
- Widget = "Widget"
1371
+ Web = "Web"
1440
1372
  }
1441
1373
  export declare enum PaymentStatus {
1442
1374
  Cancelled = "CANCELLED",
@@ -1499,30 +1431,24 @@ export type PricingUser = {
1499
1431
  };
1500
1432
  export type Query = {
1501
1433
  __typename?: 'Query';
1502
- adminBridgeUser: BridgeUser;
1503
1434
  adminDirectPayment?: Maybe<DirectPayment>;
1504
1435
  adminDirectPayments: Array<DirectPayment>;
1505
- adminOnrampPayments: Array<OnRampPayment>;
1506
- adminPaginatedReferrals: PaginatedReferral;
1507
1436
  adminPayments: Array<Payment>;
1508
1437
  adminPaymentsCount: Scalars['Int']['output'];
1509
1438
  adminRecentPayments: Array<Payment>;
1510
- adminReferralParticipant?: Maybe<Referral>;
1439
+ adminTransactionPrice: Scalars['Float']['output'];
1511
1440
  adminUtxoInvoices: Array<UtxoInvoice>;
1512
- adminVirtualAccounts: Array<BridgeVirtualAccount>;
1513
1441
  apiTokens: Array<ApiToken>;
1514
1442
  bankAccounts: Array<BankAccount>;
1515
1443
  bills: Array<Bill>;
1516
1444
  brexBalance: BrexBalance;
1517
1445
  bridgeUser: BridgeUser;
1518
- btcCashValue: UtxoBalance;
1519
1446
  checkPayment?: Maybe<UtxoInvoice>;
1520
1447
  checkbookBatchSize: Scalars['Float']['output'];
1521
1448
  checkbookPrefundedAccountBalance?: Maybe<Scalars['Float']['output']>;
1522
1449
  circleBalances: CircleBalances;
1523
1450
  coinbaseBalance: Scalars['Float']['output'];
1524
1451
  cryptoExchangeRate: CryptoExchangeRate;
1525
- dashCashValue: UtxoBalance;
1526
1452
  debitCards: Array<DebitCard>;
1527
1453
  /** @deprecated no longer in use */
1528
1454
  directPayment?: Maybe<DirectPayment>;
@@ -1573,7 +1499,6 @@ export type Query = {
1573
1499
  paymentsForAccount: Array<Payment>;
1574
1500
  paymentsInProgress: Array<Payment>;
1575
1501
  pendingVerificationBills: Array<Bill>;
1576
- points: Scalars['Int']['output'];
1577
1502
  popularUSBillInstitutions: Array<PayableAccountInstitution>;
1578
1503
  referralParticipant?: Maybe<Referral>;
1579
1504
  reversals: MethodFiReversal;
@@ -1588,6 +1513,8 @@ export type Query = {
1588
1513
  tokenBalances: Array<TokenBalance>;
1589
1514
  totalTokenBalance: Scalars['Float']['output'];
1590
1515
  transactionPrice: Scalars['Float']['output'];
1516
+ transactionVolume: Scalars['Float']['output'];
1517
+ transactions: Array<Transaction>;
1591
1518
  tronBalance: Array<TronBalance>;
1592
1519
  unblockKycToken?: Maybe<Scalars['String']['output']>;
1593
1520
  unblockPortal?: Maybe<UnblockVirtualAccount>;
@@ -1600,35 +1527,22 @@ export type Query = {
1600
1527
  userPayableAccounts: Array<PayableAccount>;
1601
1528
  userPayment: Payment;
1602
1529
  userPayments: Array<Payment>;
1603
- userPoints: Scalars['Int']['output'];
1604
1530
  userUpcomingPayments: Array<Payment>;
1605
1531
  userVerification?: Maybe<Verification>;
1606
1532
  userVirtualDebitCard?: Maybe<VirtualCard>;
1607
1533
  utxoBalance: UtxoBalance;
1608
1534
  verification?: Maybe<Verification>;
1609
1535
  verificationFlow: CognitoKycFlow;
1610
- virtualAccounts: Array<BridgeVirtualAccount>;
1611
1536
  virtualCardDetails?: Maybe<Scalars['String']['output']>;
1612
1537
  virtualDebitCard?: Maybe<VirtualCard>;
1613
1538
  virtualDebitCards: Array<VirtualCard>;
1614
1539
  };
1615
- export type QueryAdminBridgeUserArgs = {
1616
- userId: Scalars['String']['input'];
1617
- };
1618
1540
  export type QueryAdminDirectPaymentArgs = {
1619
1541
  directPaymentId: Scalars['String']['input'];
1620
1542
  };
1621
1543
  export type QueryAdminDirectPaymentsArgs = {
1622
1544
  userId?: InputMaybe<Scalars['String']['input']>;
1623
1545
  };
1624
- export type QueryAdminOnrampPaymentsArgs = {
1625
- userId: Scalars['String']['input'];
1626
- };
1627
- export type QueryAdminPaginatedReferralsArgs = {
1628
- page?: Scalars['Int']['input'];
1629
- perPage?: Scalars['Int']['input'];
1630
- userId: Scalars['String']['input'];
1631
- };
1632
1546
  export type QueryAdminPaymentsArgs = {
1633
1547
  filter?: InputMaybe<PaymentsFilter>;
1634
1548
  pagination?: InputMaybe<Pagination>;
@@ -1641,15 +1555,10 @@ export type QueryAdminPaymentsCountArgs = {
1641
1555
  export type QueryAdminRecentPaymentsArgs = {
1642
1556
  userId: Scalars['String']['input'];
1643
1557
  };
1644
- export type QueryAdminReferralParticipantArgs = {
1645
- userId: Scalars['String']['input'];
1646
- };
1647
- export type QueryAdminVirtualAccountsArgs = {
1558
+ export type QueryAdminTransactionPriceArgs = {
1559
+ amount: Scalars['Float']['input'];
1648
1560
  userId: Scalars['String']['input'];
1649
1561
  };
1650
- export type QueryBtcCashValueArgs = {
1651
- address: Scalars['String']['input'];
1652
- };
1653
1562
  export type QueryCheckPaymentArgs = {
1654
1563
  address: Scalars['String']['input'];
1655
1564
  };
@@ -1664,9 +1573,6 @@ export type QueryCryptoExchangeRateArgs = {
1664
1573
  base?: InputMaybe<Scalars['String']['input']>;
1665
1574
  symbol: Scalars['String']['input'];
1666
1575
  };
1667
- export type QueryDashCashValueArgs = {
1668
- address: Scalars['String']['input'];
1669
- };
1670
1576
  export type QueryDirectPaymentArgs = {
1671
1577
  paymentId: Scalars['String']['input'];
1672
1578
  };
@@ -1687,7 +1593,7 @@ export type QueryFeeCalculatorArgs = {
1687
1593
  currency: Scalars['String']['input'];
1688
1594
  deliveryMethod?: InputMaybe<PaymentDeliveryMethod>;
1689
1595
  network: Scalars['String']['input'];
1690
- token: Scalars['String']['input'];
1596
+ usdc: Scalars['Boolean']['input'];
1691
1597
  };
1692
1598
  export type QueryFindByWalletAddressArgs = {
1693
1599
  address: Scalars['String']['input'];
@@ -1778,12 +1684,15 @@ export type QueryTotalTokenBalanceArgs = {
1778
1684
  networks?: InputMaybe<Array<Network>>;
1779
1685
  };
1780
1686
  export type QueryTransactionPriceArgs = {
1781
- accountId: Scalars['String']['input'];
1687
+ accountId?: InputMaybe<Scalars['String']['input']>;
1782
1688
  amount: Scalars['Float']['input'];
1783
1689
  deliveryMethod?: InputMaybe<PaymentDeliveryMethod>;
1784
- network: Scalars['String']['input'];
1690
+ network?: InputMaybe<Scalars['String']['input']>;
1785
1691
  token?: InputMaybe<Scalars['String']['input']>;
1786
1692
  };
1693
+ export type QueryTransactionsArgs = {
1694
+ address: Scalars['String']['input'];
1695
+ };
1787
1696
  export type QueryTronBalanceArgs = {
1788
1697
  address: Scalars['String']['input'];
1789
1698
  };
@@ -1802,9 +1711,6 @@ export type QueryUserPaymentArgs = {
1802
1711
  export type QueryUserPaymentsArgs = {
1803
1712
  userId: Scalars['String']['input'];
1804
1713
  };
1805
- export type QueryUserPointsArgs = {
1806
- userId: Scalars['String']['input'];
1807
- };
1808
1714
  export type QueryUserUpcomingPaymentsArgs = {
1809
1715
  userId: Scalars['String']['input'];
1810
1716
  };
@@ -1822,13 +1728,18 @@ export type QueryVirtualCardDetailsArgs = {
1822
1728
  key: Scalars['String']['input'];
1823
1729
  renderSecret: Scalars['String']['input'];
1824
1730
  };
1731
+ export type RawContract = {
1732
+ __typename?: 'RawContract';
1733
+ address?: Maybe<Scalars['String']['output']>;
1734
+ decimals?: Maybe<Scalars['Float']['output']>;
1735
+ rawValue?: Maybe<Scalars['String']['output']>;
1736
+ };
1825
1737
  export type Referral = {
1826
1738
  __typename?: 'Referral';
1827
1739
  createdAt: Scalars['DateTimeISO']['output'];
1828
1740
  id: Scalars['ID']['output'];
1829
1741
  maskedEmail: Scalars['String']['output'];
1830
1742
  note?: Maybe<Scalars['String']['output']>;
1831
- pendingVolume: Scalars['Float']['output'];
1832
1743
  referralClubRewards: Scalars['Float']['output'];
1833
1744
  referralClubStatus?: Maybe<ReferralClubStatus>;
1834
1745
  referralClubTransactionVolume: Scalars['Float']['output'];
@@ -1996,10 +1907,8 @@ export type TokenBalance = {
1996
1907
  balance: Scalars['Float']['output'];
1997
1908
  balanceRaw: Scalars['String']['output'];
1998
1909
  balanceUSD: Scalars['Float']['output'];
1999
- coinGeckoId: Scalars['String']['output'];
2000
1910
  /** ERC20 decimals */
2001
1911
  decimals: Scalars['Float']['output'];
2002
- name: Scalars['String']['output'];
2003
1912
  network: Scalars['String']['output'];
2004
1913
  price: Scalars['Float']['output'];
2005
1914
  symbol: Scalars['String']['output'];
@@ -2013,6 +1922,35 @@ export type TokenPreferencesInput = {
2013
1922
  targetAddress?: InputMaybe<Scalars['String']['input']>;
2014
1923
  token?: InputMaybe<Scalars['String']['input']>;
2015
1924
  };
1925
+ export type Transaction = {
1926
+ __typename?: 'Transaction';
1927
+ /** @deprecated Unused */
1928
+ address: Scalars['String']['output'];
1929
+ asset?: Maybe<Scalars['String']['output']>;
1930
+ blockNum: Scalars['String']['output'];
1931
+ category: Scalars['String']['output'];
1932
+ from?: Maybe<Scalars['String']['output']>;
1933
+ hash: Scalars['String']['output'];
1934
+ id: Scalars['ID']['output'];
1935
+ log?: Maybe<TransactionLog>;
1936
+ /** Network that the transaction takes place on */
1937
+ network: Scalars['String']['output'];
1938
+ rawContract?: Maybe<RawContract>;
1939
+ to?: Maybe<Scalars['String']['output']>;
1940
+ value?: Maybe<Scalars['Float']['output']>;
1941
+ };
1942
+ export type TransactionLog = {
1943
+ __typename?: 'TransactionLog';
1944
+ address?: Maybe<Scalars['String']['output']>;
1945
+ blockHash?: Maybe<Scalars['String']['output']>;
1946
+ blockNumber?: Maybe<Scalars['String']['output']>;
1947
+ data?: Maybe<Scalars['String']['output']>;
1948
+ logIndex?: Maybe<Scalars['String']['output']>;
1949
+ removed?: Maybe<Scalars['Boolean']['output']>;
1950
+ topics?: Maybe<Array<Scalars['String']['output']>>;
1951
+ transactionHash?: Maybe<Scalars['String']['output']>;
1952
+ transactionIndex?: Maybe<Scalars['String']['output']>;
1953
+ };
2016
1954
  export type TronBalance = {
2017
1955
  __typename?: 'TronBalance';
2018
1956
  address: Scalars['String']['output'];
@@ -2053,7 +1991,6 @@ export type UnblockPreference = {
2053
1991
  export type UnblockUser = {
2054
1992
  __typename?: 'UnblockUser';
2055
1993
  country: Scalars['String']['output'];
2056
- date_of_birth: Scalars['String']['output'];
2057
1994
  externalId: Scalars['String']['output'];
2058
1995
  first_name: Scalars['String']['output'];
2059
1996
  id: Scalars['ID']['output'];
@@ -2063,12 +2000,6 @@ export type UnblockUser = {
2063
2000
  status: Scalars['String']['output'];
2064
2001
  userId: Scalars['ObjectID']['output'];
2065
2002
  };
2066
- export type UnblockUserInput = {
2067
- dob?: InputMaybe<Scalars['String']['input']>;
2068
- firstName?: InputMaybe<Scalars['String']['input']>;
2069
- lastName?: InputMaybe<Scalars['String']['input']>;
2070
- otp: Scalars['String']['input'];
2071
- };
2072
2003
  export type UnblockVirtualAccount = {
2073
2004
  __typename?: 'UnblockVirtualAccount';
2074
2005
  account_number?: Maybe<Scalars['String']['output']>;
@@ -2103,14 +2034,13 @@ export type User = {
2103
2034
  attributionSurvey?: Maybe<AttributionSurvey>;
2104
2035
  createdAt: Scalars['DateTimeISO']['output'];
2105
2036
  deleted?: Maybe<Scalars['Boolean']['output']>;
2106
- dismissedItems?: Maybe<DismissedItems>;
2107
2037
  dob?: Maybe<Scalars['String']['output']>;
2108
2038
  email: Scalars['String']['output'];
2109
2039
  firstName?: Maybe<Scalars['String']['output']>;
2110
2040
  growsurfId?: Maybe<Scalars['String']['output']>;
2111
2041
  id: Scalars['ID']['output'];
2112
2042
  kycStatus: KycStatus;
2113
- lastActivity?: Maybe<Scalars['DateTimeISO']['output']>;
2043
+ lastLogin?: Maybe<Scalars['DateTimeISO']['output']>;
2114
2044
  lastName?: Maybe<Scalars['String']['output']>;
2115
2045
  latestSessionId?: Maybe<Scalars['String']['output']>;
2116
2046
  membership?: Maybe<Scalars['String']['output']>;
@@ -2193,20 +2123,9 @@ export type Verification = {
2193
2123
  identity: IdentityModule;
2194
2124
  methodFiEntity?: Maybe<MethodFiEntity>;
2195
2125
  signature: Scalars['String']['output'];
2196
- unblockUser?: Maybe<UnblockUser>;
2197
2126
  userId: Scalars['ObjectID']['output'];
2198
2127
  virtualCard: VirtualCardModule;
2199
2128
  };
2200
- export type VirtualAccountDepositInstructions = {
2201
- __typename?: 'VirtualAccountDepositInstructions';
2202
- bankAccountNumber: Scalars['String']['output'];
2203
- bankAddress: Scalars['String']['output'];
2204
- bankBeneficiaryName: Scalars['String']['output'];
2205
- bankName: Scalars['String']['output'];
2206
- bankRoutingNumber: Scalars['String']['output'];
2207
- currency: Scalars['String']['output'];
2208
- paymentMethod: Scalars['String']['output'];
2209
- };
2210
2129
  export type VirtualCard = PayableAccount & {
2211
2130
  __typename?: 'VirtualCard';
2212
2131
  balance: Scalars['Float']['output'];
@@ -2229,6 +2148,7 @@ export type VirtualCard = PayableAccount & {
2229
2148
  paymentVolume: Scalars['Float']['output'];
2230
2149
  provider: Scalars['String']['output'];
2231
2150
  renderSecret?: Maybe<Scalars['String']['output']>;
2151
+ testPaymentAvailable: Scalars['Boolean']['output'];
2232
2152
  transactions?: Maybe<Array<SimpleCardTransaction>>;
2233
2153
  type: PayableAccountType;
2234
2154
  user: User;
@@ -43,7 +43,6 @@ var BasicPayableAccountType;
43
43
  (function (BasicPayableAccountType) {
44
44
  BasicPayableAccountType["BankAccount"] = "BANK_ACCOUNT";
45
45
  BasicPayableAccountType["Bill"] = "BILL";
46
- BasicPayableAccountType["DebitCard"] = "DEBIT_CARD";
47
46
  BasicPayableAccountType["PayOthers"] = "PAY_OTHERS";
48
47
  BasicPayableAccountType["SpritzCard"] = "SPRITZ_CARD";
49
48
  })(BasicPayableAccountType || (exports.BasicPayableAccountType = BasicPayableAccountType = {}));
@@ -151,7 +150,6 @@ var PaymentProvider;
151
150
  })(PaymentProvider || (exports.PaymentProvider = PaymentProvider = {}));
152
151
  var PaymentSource;
153
152
  (function (PaymentSource) {
154
- PaymentSource["Admin"] = "Admin";
155
153
  PaymentSource["External"] = "External";
156
154
  PaymentSource["Integrator"] = "Integrator";
157
155
  PaymentSource["Mobile"] = "Mobile";
@@ -160,7 +158,6 @@ var PaymentSource;
160
158
  PaymentSource["PaymentAddress"] = "PaymentAddress";
161
159
  PaymentSource["Subscription"] = "Subscription";
162
160
  PaymentSource["Web"] = "Web";
163
- PaymentSource["Widget"] = "Widget";
164
161
  })(PaymentSource || (exports.PaymentSource = PaymentSource = {}));
165
162
  var PaymentStatus;
166
163
  (function (PaymentStatus) {
@@ -17,32 +17,8 @@ export type SyncOnrampTransferInput = {
17
17
  sourceCurrency: string;
18
18
  userId: string;
19
19
  };
20
- export type CreateBridgeUserParams = {
21
- userId: string;
22
- address: {
23
- street?: string;
24
- street2?: string;
25
- city?: string;
26
- subdivision?: string;
27
- postalCode?: string;
28
- countryCode: string;
29
- };
30
- email: string;
31
- firstName: string;
32
- lastName: string;
33
- };
34
- export type BridgeUser = {
35
- id: string;
36
- userId: string;
37
- externalId: string;
38
- };
39
20
  export declare class OnrampServiceClient {
40
21
  client: AxiosInstance;
41
22
  constructor();
42
23
  syncTransfer(input: SyncOnrampTransferInput): Promise<OnRampPayment>;
43
- getUserCompletedPayments(userId: string): Promise<OnRampPayment[]>;
44
- upsertBridgeUser(input: CreateBridgeUserParams): Promise<import("./types").ApiFailure | import("./types").ApiSuccess<BridgeUser>>;
45
- createBusinessUser(userId: string, businessName: string): Promise<{
46
- success: boolean;
47
- }>;
48
24
  }
@@ -14,23 +14,5 @@ class OnrampServiceClient {
14
14
  .post('/external-transfer', input)
15
15
  .then((res) => res.data);
16
16
  }
17
- async getUserCompletedPayments(userId) {
18
- return this.client
19
- .get(`/payments/user/${userId}/completed`)
20
- .then((res) => res.data);
21
- }
22
- async upsertBridgeUser(input) {
23
- return this.client
24
- .post(`/user`, input)
25
- .then((res) => res.data);
26
- }
27
- async createBusinessUser(userId, businessName) {
28
- return this.client
29
- .post(`/business-user`, {
30
- userId,
31
- businessName,
32
- })
33
- .then((res) => res.data);
34
- }
35
17
  }
36
18
  exports.OnrampServiceClient = OnrampServiceClient;
package/lib/params.d.ts CHANGED
@@ -1,2 +1 @@
1
- import { SSM } from 'aws-sdk';
2
- export declare const getParams: (keys: string[]) => Promise<SSM.Parameter>;
1
+ export declare const getParams: (keys: string[]) => Promise<import("@aws-sdk/client-ssm").Parameter>;
package/lib/params.js CHANGED
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getParams = void 0;
4
- const aws_sdk_1 = require("aws-sdk");
5
- const ssm = new aws_sdk_1.SSM({
4
+ const client_ssm_1 = require("@aws-sdk/client-ssm");
5
+ const ssm = new client_ssm_1.SSM({
6
6
  region: 'us-east-1',
7
7
  });
8
8
  const getParams = async (keys) => {
9
- const params = await ssm
10
- .getParameters({
9
+ const params = await ssm.getParameters({
11
10
  Names: keys,
12
11
  WithDecryption: true,
13
- })
14
- .promise();
12
+ });
15
13
  return params.Parameters.reduce((acc, val) => {
16
14
  return {
17
15
  ...acc,
@@ -72,5 +72,4 @@ export declare class PayableAccountsServiceClient {
72
72
  getAccounts(accountIds: string[]): Promise<PayableAccount[]>;
73
73
  getAccountInstitution(institutionId: string): Promise<PayableAccountInstitution>;
74
74
  upsertBillFromExternalAccount(input: ExternalBillInput): Promise<BillModel>;
75
- createUSVirtualCardNoKyc(userId: string): Promise<import("./types").ApiFailure | import("./types").ApiSuccess<PayableAccount>>;
76
75
  }
@@ -48,10 +48,5 @@ class PayableAccountsServiceClient {
48
48
  .post(`/bills/upsert-external-account`, input)
49
49
  .then((res) => res.data);
50
50
  }
51
- async createUSVirtualCardNoKyc(userId) {
52
- return this.client
53
- .post(`/v2/virtual-card/create-no-kyc/${userId}`)
54
- .then((res) => res.data);
55
- }
56
51
  }
57
52
  exports.PayableAccountsServiceClient = PayableAccountsServiceClient;
@@ -1,5 +1,4 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { ExternalPayment } from './lib/graphClient/generated';
3
2
  export declare enum UnblockUserStatus {
4
3
  Created = "CREATED",
5
4
  KycNeeded = "KYC_NEEDED",
@@ -96,24 +95,6 @@ export type UnblockUser = {
96
95
  currency: string;
97
96
  main_beneficiary: boolean;
98
97
  };
99
- type ExternalTransactionToken = {
100
- address: string;
101
- amountRaw: string;
102
- amount: number;
103
- decimals: number;
104
- symbol: string;
105
- };
106
- type ExternalBlockchainTransaction = {
107
- externalPaymentId: string;
108
- value: number;
109
- to?: string | null;
110
- from?: string | null;
111
- hash: string;
112
- network: string;
113
- asset?: string | null;
114
- paymentToken?: ExternalTransactionToken | null;
115
- sourceToken?: ExternalTransactionToken | null;
116
- };
117
98
  export declare class UnblockServiceClient {
118
99
  client: AxiosInstance;
119
100
  constructor();
@@ -123,7 +104,4 @@ export declare class UnblockServiceClient {
123
104
  createUnblockAccount(input: CreateUnblockAccountInput): Promise<UnblockAccount>;
124
105
  createUnblockUser(input: CreateUnblockUserInput): Promise<UnblockAccount>;
125
106
  getUnblockPayment(externalPaymentId: string): Promise<UnblockPayment>;
126
- getExternalPayments(accountIds: string[]): Promise<ExternalPayment[]>;
127
- getBlockchainTransactions(paymentIds: string[]): Promise<ExternalBlockchainTransaction[]>;
128
107
  }
129
- export {};
@@ -40,15 +40,5 @@ class UnblockServiceClient {
40
40
  .get(`/payment/id/${externalPaymentId}`)
41
41
  .then((res) => res.data);
42
42
  }
43
- async getExternalPayments(accountIds) {
44
- return this.client
45
- .get(`/external-payments?accountIds=${accountIds.join(',')}`)
46
- .then((res) => res.data);
47
- }
48
- async getBlockchainTransactions(paymentIds) {
49
- return this.client
50
- .get(`/blockchain-transactions?paymentIds=${paymentIds.join(',')}`)
51
- .then((res) => res.data);
52
- }
53
43
  }
54
44
  exports.UnblockServiceClient = UnblockServiceClient;
@@ -31,9 +31,4 @@ export declare class UsersServiceClient {
31
31
  findByEmail(email: string): Promise<User>;
32
32
  getIntegratorWebhooks(integratorId: string): Promise<IntegratorWebhook[]>;
33
33
  getIntegrator(integratorId: string): Promise<Integrator>;
34
- validateAdIdentifiers(adIdentifiers?: {
35
- gclid?: string;
36
- twclid?: string;
37
- fbclid?: string;
38
- }): Promise<import("./types").ApiFailure | import("./types").ApiSuccess<boolean>>;
39
34
  }
@@ -41,10 +41,5 @@ class UsersServiceClient {
41
41
  .get(`/integrators/integrator/${integratorId}`)
42
42
  .then((res) => res.data);
43
43
  }
44
- async validateAdIdentifiers(adIdentifiers) {
45
- return this.client
46
- .post('/ad-identifiers/validate', adIdentifiers)
47
- .then((res) => res.data);
48
- }
49
44
  }
50
45
  exports.UsersServiceClient = UsersServiceClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.2.101",
3
+ "version": "0.3.0",
4
4
  "description": "Service client",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  "license": "ISC",
21
21
  "dependencies": {
22
22
  "@spritz-finance/config": "^0.1.6",
23
- "@spritz-finance/logger": "^0.1.24",
23
+ "@spritz-finance/logger": "^0.2.0",
24
24
  "axios": "^0.26.1",
25
25
  "axios-oauth-client": "^1.4.4",
26
26
  "axios-token-interceptor": "^0.2.0",
@@ -28,10 +28,10 @@
28
28
  "graphql-tag": "^2.12.6"
29
29
  },
30
30
  "devDependencies": {
31
+ "@aws-sdk/client-ssm": "^3.549.0",
31
32
  "@graphql-codegen/cli": "^4.0.1",
32
33
  "@graphql-codegen/introspection": "^4.0.0",
33
34
  "@graphql-codegen/typescript": "^4.0.0",
34
- "aws-sdk": "2.1115.0",
35
35
  "jest": "^29.6.4",
36
36
  "ts-jest": "29.1.1",
37
37
  "typescript": "^5.2.2"
@@ -1,36 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- type FeatureFlagDefinition = {
3
- key: string;
4
- label: string;
5
- description: string;
6
- defaultValue: boolean;
7
- };
8
- export interface FeatureFlagDetails extends FeatureFlagDefinition {
9
- value: boolean;
10
- }
11
- export declare enum FeatureFlag {
12
- PaymentsEnabled = "payments.enabled",
13
- EthereumPayments = "payments.network.ethereum",
14
- PolygonPayments = "payments.network.polygon",
15
- OptimismPayments = "payments.network.optimism",
16
- ArbitrumPayments = "payments.network.arbitrum",
17
- BasePayments = "payments.network.base",
18
- AvalancePayments = "payments.network.avalanche",
19
- BinancePayments = "payments.network.binance-smart-chain",
20
- SolanaPayments = "payments.network.solana",
21
- TronPayments = "payments.network.tron",
22
- BtcPayments = "payments.network.bitcoin",
23
- DashPayments = "payments.network.dash",
24
- SpritzCardNoKycEnabled = "spritzCard.noKyc.enabled",
25
- SpritzCardNoKycPayments = "spritzCard.noKyc.payments",
26
- BinanceBridgeEnabled = "binanceBridge.enabled"
27
- }
28
- export type FeatureFlags = Record<FeatureFlag, FeatureFlagDetails>;
29
- export declare class FeatureServiceClient {
30
- client: AxiosInstance;
31
- constructor();
32
- getFeatureFlags(): Promise<import("./types").ApiFailure | import("./types").ApiSuccess<FeatureFlags>>;
33
- isFeatureFlagEnabled(flag: FeatureFlag): Promise<boolean>;
34
- isPaymentsEnabled(network?: string): Promise<boolean>;
35
- }
36
- export {};
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FeatureServiceClient = exports.FeatureFlag = void 0;
4
- const config_1 = require("./config");
5
- const serviceClient_1 = require("./serviceClient");
6
- const utils_1 = require("./utils");
7
- var FeatureFlag;
8
- (function (FeatureFlag) {
9
- FeatureFlag["PaymentsEnabled"] = "payments.enabled";
10
- FeatureFlag["EthereumPayments"] = "payments.network.ethereum";
11
- FeatureFlag["PolygonPayments"] = "payments.network.polygon";
12
- FeatureFlag["OptimismPayments"] = "payments.network.optimism";
13
- FeatureFlag["ArbitrumPayments"] = "payments.network.arbitrum";
14
- FeatureFlag["BasePayments"] = "payments.network.base";
15
- FeatureFlag["AvalancePayments"] = "payments.network.avalanche";
16
- FeatureFlag["BinancePayments"] = "payments.network.binance-smart-chain";
17
- FeatureFlag["SolanaPayments"] = "payments.network.solana";
18
- FeatureFlag["TronPayments"] = "payments.network.tron";
19
- FeatureFlag["BtcPayments"] = "payments.network.bitcoin";
20
- FeatureFlag["DashPayments"] = "payments.network.dash";
21
- FeatureFlag["SpritzCardNoKycEnabled"] = "spritzCard.noKyc.enabled";
22
- FeatureFlag["SpritzCardNoKycPayments"] = "spritzCard.noKyc.payments";
23
- FeatureFlag["BinanceBridgeEnabled"] = "binanceBridge.enabled";
24
- })(FeatureFlag || (exports.FeatureFlag = FeatureFlag = {}));
25
- const networkToFlag = (network) => {
26
- switch (network) {
27
- case 'ethereum':
28
- return FeatureFlag.EthereumPayments;
29
- case 'polygon':
30
- return FeatureFlag.PolygonPayments;
31
- case 'optimism':
32
- return FeatureFlag.OptimismPayments;
33
- case 'arbitrum':
34
- return FeatureFlag.ArbitrumPayments;
35
- case 'base':
36
- return FeatureFlag.BasePayments;
37
- case 'avalanche':
38
- return FeatureFlag.AvalancePayments;
39
- case 'binance-smart-chain':
40
- return FeatureFlag.BinancePayments;
41
- case 'solana':
42
- return FeatureFlag.SolanaPayments;
43
- case 'tron':
44
- return FeatureFlag.TronPayments;
45
- case 'bitcoin':
46
- return FeatureFlag.BtcPayments;
47
- case 'dash':
48
- return FeatureFlag.DashPayments;
49
- default:
50
- return null;
51
- }
52
- };
53
- class FeatureServiceClient {
54
- constructor() {
55
- this.client = (0, serviceClient_1.createServiceClient)({
56
- baseURL: config_1.config.usersServiceEndpoint,
57
- });
58
- }
59
- async getFeatureFlags() {
60
- return this.client
61
- .get('/feature-flags')
62
- .then((res) => res.data);
63
- }
64
- async isFeatureFlagEnabled(flag) {
65
- var _a, _b;
66
- const response = await this.getFeatureFlags();
67
- if ((0, utils_1.isApiError)(response))
68
- return false;
69
- const flags = response.data;
70
- return (_b = (_a = flags[flag]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : false;
71
- }
72
- async isPaymentsEnabled(network) {
73
- var _a, _b, _c;
74
- const response = await this.getFeatureFlags();
75
- if ((0, utils_1.isApiError)(response))
76
- return false;
77
- const flags = response.data;
78
- if (!((_a = flags[FeatureFlag.PaymentsEnabled]) === null || _a === void 0 ? void 0 : _a.value))
79
- return false;
80
- if (!network)
81
- return true;
82
- const networkFlag = networkToFlag(network);
83
- return networkFlag ? (_c = (_b = flags[networkFlag]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : true : true;
84
- }
85
- }
86
- exports.FeatureServiceClient = FeatureServiceClient;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const transactionsServiceClient_1 = require("./transactionsServiceClient");
4
- describe('TransactionsServiceClient', () => {
5
- const client = new transactionsServiceClient_1.TransactionsServiceClient();
6
- it('should work', async () => {
7
- const data = await client.createPaymentInvoice('bitcoin-testnet', 100, '64283904a7ab475a6a2bc4b5');
8
- console.log(data);
9
- });
10
- });
package/lib/types.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import { APIGatewayProxyEvent, APIGatewayProxyResult, Handler } from 'aws-lambda';
2
- export interface PaginationResult<T> {
3
- items: T[];
4
- totalCount: number;
5
- currentPage: number;
6
- pages: number;
7
- }
8
- export interface APIGatewayProxyEventWithDeserializedBody<B = unknown, P = unknown> extends Omit<APIGatewayProxyEvent, 'body' | 'pathParameters'> {
9
- body: B;
10
- pathParameters: P;
11
- }
12
- export interface ServiceClientResult<Result> extends Omit<APIGatewayProxyResult, 'body'> {
13
- body: ApiResponse<Result>;
14
- }
15
- export type ServiceClientHandler<T, U = {}, P = {}> = (event: APIGatewayProxyEventWithDeserializedBody<U, P>) => Promise<T>;
16
- export type ServiceClientResponse<Result, Body = unknown> = Handler<APIGatewayProxyEventWithDeserializedBody<Body>, ServiceClientResult<Result>>;
17
- export interface ApiError {
18
- message: string;
19
- code?: string;
20
- }
21
- export interface ApiSuccess<T> {
22
- status: 'success';
23
- data: T;
24
- }
25
- export interface ApiFailure {
26
- status: 'failure';
27
- error: ApiError;
28
- }
29
- export type ApiResponse<T> = ApiSuccess<T> | ApiFailure;
package/lib/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/lib/utils.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { ApiFailure, ApiResponse, ApiSuccess, ServiceClientResponse, ServiceClientResult } from './types';
2
- export declare function isApiSuccess<T>(response: ApiResponse<T>): response is ApiSuccess<T>;
3
- export declare function isApiError<T>(response: ApiResponse<T>): response is ApiFailure;
4
- export declare function withServiceClientResponse<T>(handler: (event: any) => Promise<T>, fallbackErrorMessage?: string): ServiceClientResponse<T>;
5
- export declare function parseApiSuccess<Result>(data: Result): ServiceClientResult<Result>;
6
- export declare function parseApiError(error: unknown, fallbackMessage?: string): ServiceClientResult<never>;
package/lib/utils.js DELETED
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseApiError = exports.parseApiSuccess = exports.withServiceClientResponse = exports.isApiError = exports.isApiSuccess = void 0;
4
- function isApiSuccess(response) {
5
- return response.status === 'success';
6
- }
7
- exports.isApiSuccess = isApiSuccess;
8
- function isApiError(response) {
9
- return response.status === 'failure';
10
- }
11
- exports.isApiError = isApiError;
12
- function withServiceClientResponse(handler, fallbackErrorMessage) {
13
- return async (event) => {
14
- try {
15
- const result = await handler(event);
16
- return parseApiSuccess(result);
17
- }
18
- catch (e) {
19
- return parseApiError(e, fallbackErrorMessage);
20
- }
21
- };
22
- }
23
- exports.withServiceClientResponse = withServiceClientResponse;
24
- function parseApiSuccess(data) {
25
- return {
26
- statusCode: 200,
27
- body: {
28
- status: 'success',
29
- data,
30
- },
31
- };
32
- }
33
- exports.parseApiSuccess = parseApiSuccess;
34
- function parseApiError(error, fallbackMessage) {
35
- return {
36
- statusCode: 200,
37
- body: {
38
- status: 'failure',
39
- error: {
40
- message: error instanceof Error
41
- ? error.message
42
- : fallbackMessage !== null && fallbackMessage !== void 0 ? fallbackMessage : 'An unknown error occurred',
43
- },
44
- },
45
- };
46
- }
47
- exports.parseApiError = parseApiError;