Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/kyc verification #523

Merged
merged 16 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion maas-schemas-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maas-schemas-ts",
"version": "14.2.2",
"version": "14.3.0",
"description": "TypeScript types and io-ts validators for maas-schemas",
"main": "index.js",
"files": [
Expand Down
7 changes: 7 additions & 0 deletions maas-schemas-ts/src/maas-backend/customers/customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as Authorization_ from '../../core/components/authorization';
import * as PersonalDocument_ from '../../core/personal-document';
import * as Common_ from '../../core/components/common';
import * as VirtualCard_ from './virtual-cards/virtualCard';
import * as VerificationObject_ from './verification/verification-object';

type Defined =
| Record<string, unknown>
Expand All @@ -44,6 +45,7 @@ export type Customer = t.Branded<
identityId?: Units_.IdentityId;
profileImageUrl?: string;
personalData?: PersonalData_.PersonalData;
personalDataVerifiedItems?: Array<string>;
paymentSources?: Array<PaymentSource_.PaymentSource>;
balances?: Array<Fare_.Fare>;
region?: Region_.Region;
Expand All @@ -60,6 +62,7 @@ export type Customer = t.Branded<
>;
personalDocumentConsents?: Array<Common_.AgencyId>;
virtualCards?: Array<VirtualCard_.VirtualCard>;
verifications?: Array<VerificationObject_.VerificationObject>;
} & {
personalData: Defined;
paymentSources: Defined;
Expand All @@ -75,6 +78,7 @@ export const Customer = t.brand(
identityId: Units_.IdentityId,
profileImageUrl: t.string,
personalData: PersonalData_.PersonalData,
personalDataVerifiedItems: t.array(t.string),
paymentSources: t.array(PaymentSource_.PaymentSource),
balances: t.array(Fare_.Fare),
region: Region_.Region,
Expand All @@ -94,6 +98,7 @@ export const Customer = t.brand(
),
personalDocumentConsents: t.array(Common_.AgencyId),
virtualCards: t.array(VirtualCard_.VirtualCard),
verifications: t.array(VerificationObject_.VerificationObject),
}),
t.type({
personalData: Defined,
Expand All @@ -110,6 +115,7 @@ export const Customer = t.brand(
identityId?: Units_.IdentityId;
profileImageUrl?: string;
personalData?: PersonalData_.PersonalData;
personalDataVerifiedItems?: Array<string>;
paymentSources?: Array<PaymentSource_.PaymentSource>;
balances?: Array<Fare_.Fare>;
region?: Region_.Region;
Expand All @@ -126,6 +132,7 @@ export const Customer = t.brand(
>;
personalDocumentConsents?: Array<Common_.AgencyId>;
virtualCards?: Array<VirtualCard_.VirtualCard>;
verifications?: Array<VerificationObject_.VerificationObject>;
} & {
personalData: Defined;
paymentSources: Defined;
Expand Down
3 changes: 3 additions & 0 deletions maas-schemas-ts/src/maas-backend/customers/personalData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type PersonalData = t.Branded<
ssid?: boolean | Common_.Ssid;
subscriberType?: string;
profileImageUrl?: string;
nationality?: string;
} & {},
PersonalDataBrand
>;
Expand All @@ -59,6 +60,7 @@ export const PersonalData = t.brand(
ssid: t.union([t.boolean, Common_.Ssid]),
subscriberType: t.string,
profileImageUrl: t.string,
nationality: t.string,
}),
t.type({}),
]),
Expand All @@ -83,6 +85,7 @@ export const PersonalData = t.brand(
ssid?: boolean | Common_.Ssid;
subscriberType?: string;
profileImageUrl?: string;
nationality?: string;
} & {},
PersonalDataBrand
> => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ See https://www.npmjs.com/package/io-ts-from-json-schema
import * as t from 'io-ts';
import * as Units_ from '../../../../core/components/units';
import * as ApiCommon_ from '../../../../core/components/api-common';
import * as UnitsGeo_ from '../../../../core/components/units-geo';

type Defined =
| Record<string, unknown>
Expand Down Expand Up @@ -39,9 +40,9 @@ export type Request = t.Branded<
headers?: ApiCommon_.Headers;
identityId?: Units_.IdentityId;
payload?: {
type?: string;
location?: UnitsGeo_.ShortLocationString;
} & {
type: Defined;
location: Defined;
};
} & {
identityId: Defined;
Expand All @@ -59,10 +60,10 @@ export const Request = t.brand(
identityId: Units_.IdentityId,
payload: t.intersection([
t.partial({
type: t.string,
location: UnitsGeo_.ShortLocationString,
}),
t.type({
type: Defined,
location: Defined,
}),
]),
}),
Expand All @@ -81,9 +82,9 @@ export const Request = t.brand(
headers?: ApiCommon_.Headers;
identityId?: Units_.IdentityId;
payload?: {
type?: string;
location?: UnitsGeo_.ShortLocationString;
} & {
type: Defined;
location: Defined;
};
} & {
identityId: Defined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ export const schemaId =
// The default export. More information at the top.
export type Response = t.Branded<
{
customer?: {
verification?: Array<VerificationObject_.Verification>;
} & {
verification: Defined;
};
verification?: VerificationObject_.Verification;
} & {
customer: Defined;
},
Expand All @@ -47,14 +43,7 @@ export type Response = t.Branded<
export const Response = t.brand(
t.intersection([
t.partial({
customer: t.intersection([
t.partial({
verification: t.array(VerificationObject_.Verification),
}),
t.type({
verification: Defined,
}),
]),
verification: VerificationObject_.Verification,
}),
t.type({
customer: Defined,
Expand All @@ -64,11 +53,7 @@ export const Response = t.brand(
x,
): x is t.Branded<
{
customer?: {
verification?: Array<VerificationObject_.Verification>;
} & {
verification: Defined;
};
verification?: VerificationObject_.Verification;
} & {
customer: Defined;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ See https://www.npmjs.com/package/io-ts-from-json-schema

import * as t from 'io-ts';
import * as Units_ from '../../../core/components/units';
import * as Common_ from '../../../core/components/common';
import * as StateLog_ from '../../../core/components/state-log';

type Defined =
| Record<string, unknown>
Expand All @@ -37,35 +37,18 @@ export type Verification = t.Branded<
{
id?: string;
identityId?: Units_.IdentityId;
details?: {
url?: string;
sessionToken?: string;
} & {
url: Defined;
sessionToken: Defined;
};
validFrom?: string;
validTo?: string;
kycServiceId?: string;
url?: Units_.Url;
token?: string;
status?: string;
type?: string;
stateLog?: Array<
{
status?: string;
timestamp?: Units_.Time;
} & {
status: Defined;
timestamp: Defined;
}
>;
stateLog?: StateLog_.StateLog;
created?: Units_.Time;
modified?: Units_.Time;
agencyId?: Common_.AgencyId;
} & {
id: Defined;
identityId: Defined;
details: Defined;
kycServiceId: Defined;
status: Defined;
type: Defined;
stateLog: Defined;
},
VerificationBrand
Expand All @@ -75,42 +58,19 @@ export const Verification = t.brand(
t.partial({
id: t.string,
identityId: Units_.IdentityId,
details: t.intersection([
t.partial({
url: t.string,
sessionToken: t.string,
}),
t.type({
url: Defined,
sessionToken: Defined,
}),
]),
validFrom: t.string,
validTo: t.string,
kycServiceId: t.string,
url: Units_.Url,
token: t.string,
status: t.string,
type: t.string,
stateLog: t.array(
t.intersection([
t.partial({
status: t.string,
timestamp: Units_.Time,
}),
t.type({
status: Defined,
timestamp: Defined,
}),
]),
),
stateLog: StateLog_.StateLog,
created: Units_.Time,
modified: Units_.Time,
agencyId: Common_.AgencyId,
}),
t.type({
id: Defined,
identityId: Defined,
details: Defined,
kycServiceId: Defined,
status: Defined,
type: Defined,
stateLog: Defined,
}),
]),
Expand All @@ -120,35 +80,18 @@ export const Verification = t.brand(
{
id?: string;
identityId?: Units_.IdentityId;
details?: {
url?: string;
sessionToken?: string;
} & {
url: Defined;
sessionToken: Defined;
};
validFrom?: string;
validTo?: string;
kycServiceId?: string;
url?: Units_.Url;
token?: string;
status?: string;
type?: string;
stateLog?: Array<
{
status?: string;
timestamp?: Units_.Time;
} & {
status: Defined;
timestamp: Defined;
}
>;
stateLog?: StateLog_.StateLog;
created?: Units_.Time;
modified?: Units_.Time;
agencyId?: Common_.AgencyId;
} & {
id: Defined;
identityId: Defined;
details: Defined;
kycServiceId: Defined;
status: Defined;
type: Defined;
stateLog: Defined;
},
VerificationBrand
Expand Down
Loading