@zeniai/client-epic-state 4.11.30 → 4.11.31

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.
@@ -1,9 +1,10 @@
1
1
  import { Amount } from '../../commonStateTypes/amount';
2
2
  import { ID } from '../../commonStateTypes/common';
3
3
  import { ZeniDate } from '../../zeniDayJS';
4
+ import { CardTypePayload } from './chargeCardPayload';
4
5
  export interface ChargeCard {
5
6
  id: ID;
6
- type: string;
7
+ type: CardType;
7
8
  cardName: string;
8
9
  limit: Amount;
9
10
  balance: Amount;
@@ -43,3 +44,10 @@ export interface ValidThru {
43
44
  month: number;
44
45
  year: number;
45
46
  }
47
+ export declare const toCardCodeType: (v: string) => "business_physical_credit_card" | "business_virtual_credit_card";
48
+ export declare type CardCodeType = ReturnType<typeof toCardCodeType>;
49
+ export interface CardType {
50
+ code: CardCodeType;
51
+ name: string;
52
+ }
53
+ export declare const toCardType: (payload: CardTypePayload) => CardType;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCardStatusCodeTypeStrict = exports.toCardStatusCodeType = exports.toCreditLimitFrequencyCodeTypeStrict = exports.toCreditLimitFrequencyCodeType = void 0;
3
+ exports.toCardType = exports.toCardCodeType = exports.toCardStatusCodeTypeStrict = exports.toCardStatusCodeType = exports.toCreditLimitFrequencyCodeTypeStrict = exports.toCreditLimitFrequencyCodeType = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
5
  const ALL_CREDIT_LIMIT_FREQUENCY_TYPE_CODE = [
6
6
  'monthly',
@@ -26,3 +26,14 @@ const toCardStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CA
26
26
  exports.toCardStatusCodeType = toCardStatusCodeType;
27
27
  const toCardStatusCodeTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v !== null && v !== void 0 ? v : '', ALL_CARD_STATUS_CODE);
28
28
  exports.toCardStatusCodeTypeStrict = toCardStatusCodeTypeStrict;
29
+ const CARD_TYPE_CODE = [
30
+ 'business_physical_credit_card',
31
+ 'business_virtual_credit_card',
32
+ ];
33
+ const toCardCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, CARD_TYPE_CODE);
34
+ exports.toCardCodeType = toCardCodeType;
35
+ const toCardType = (payload) => ({
36
+ code: (0, exports.toCardCodeType)(payload.code),
37
+ name: payload.name,
38
+ });
39
+ exports.toCardType = toCardType;
@@ -1,8 +1,12 @@
1
1
  import { AllowedValueWithCode } from '../../commonStateTypes/allowedValue';
2
2
  import { AddressPayload } from '../address/addressPayload';
3
3
  import { ChargeCard } from './chargeCard';
4
+ export interface CardTypePayload {
5
+ code: string;
6
+ name: string;
7
+ }
4
8
  export interface ChargeCardPayload {
5
- card_type: string;
9
+ card_type: CardTypePayload;
6
10
  card_id: string;
7
11
  card_name: string;
8
12
  credit_limit: number;
@@ -7,7 +7,7 @@ const zeniDayJS_1 = require("../../zeniDayJS");
7
7
  const chargeCard_1 = require("./chargeCard");
8
8
  const mapChargeCardPayloadToChargeCard = (payload) => ({
9
9
  id: payload.card_id,
10
- type: payload.card_type,
10
+ type: (0, chargeCard_1.toCardType)(payload.card_type),
11
11
  cardName: payload.card_name,
12
12
  limit: (0, amount_1.toAmount)(payload.credit_limit, payload.currency_code, payload.currency_symbol),
13
13
  balance: (0, amount_1.toAmount)(payload.balance_amount, payload.currency_code, payload.currency_symbol),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.11.30",
3
+ "version": "4.11.31",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",