Skip to content

Commit

Permalink
chore: add types to exports (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
kleyow authored Jan 21, 2021
1 parent 48c4c04 commit de9b3c8
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 8 deletions.
17 changes: 14 additions & 3 deletions src/thirdparty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export namespace Schemas {
export type AccountList = components['schemas']['AccountList']
export type Amount = components['schemas']['Amount']
export type AmountType = components['schemas']['AmountType']
export type AuthenticationType = components['schemas']['AuthenticationType']
export type AuthorizationChannelType = components['schemas']['AuthorizationChannelType']
export type AuthorizationResponseType = components['schemas']['AuthorizationResponseType']
export type AuthorizationsPostRequest = components['schemas']['AuthorizationsPostRequest']
Expand All @@ -30,23 +31,26 @@ export namespace Schemas {
export type ConsentsPostRequest = components['schemas']['ConsentsPostRequest']
export type ConsentStatusType = components['schemas']['ConsentStatusType']
export type CorrelationId = components['schemas']['CorrelationId']
export type Currency = components['schemas']['Currency']
export type CredentialChallengeSigned = components['schemas']['CredentialChallengeSigned']
export type CredentialChallengeUnsigned = components['schemas']['CredentialChallengeUnsigned']
export type CredentialType = components['schemas']['CredentialType']
export type DateTime = components['schemas']['DateTime']
export type Currency = components['schemas']['Currency']
export type DateOfBirth = components['schemas']['DateOfBirth']
export type DateTime = components['schemas']['DateTime']
export type ErrorCode = components['schemas']['ErrorCode']
export type ErrorDescription = components['schemas']['ErrorDescription']
export type ErrorInformation = components['schemas']['ErrorInformation']
export type Extension = components['schemas']['Extension']
export type ExtensionKey = components['schemas']['ExtensionKey']
export type ExtensionList = components['schemas']['ExtensionList']
export type ExtensionValue = components['schemas']['ExtensionValue']
export type FirstName = components['schemas']['FirstName']
export type FspId = components['schemas']['FspId']
export type GeoCode = components['schemas']['GeoCode']
export type Integer = components['schemas']['Integer']
export type IlpCondition = components['schemas']['IlpCondition']
export type IlpFulfilment = components['schemas']['IlpFulfilment']
export type IlpPacket = components['schemas']['IlpPacket']
export type Integer = components['schemas']['Integer']
export type LastName = components['schemas']['LastName']
export type Latitude = components['schemas']['Latitude']
export type Longitude = components['schemas']['Longitude']
Expand All @@ -55,12 +59,17 @@ export namespace Schemas {
export type Money = components['schemas']['Money']
export type Name = components['schemas']['Name']
export type Note = components['schemas']['Note']
export type ParticipantsPostRequest = components['schemas']['ParticipantsPostRequest']
export type PartiesTypeIDPutResponse = components['schemas']['PartiesTypeIDPutResponse']
export type Party = components['schemas']['Party']
export type PartyComplexName = components['schemas']['PartyComplexName']
export type PartyIdentifier = components['schemas']['PartyIdentifier']
export type PartyIdInfo = components['schemas']['PartyIdInfo']
export type PartyIdType = components['schemas']['PartyIdType']
export type PartyName = components['schemas']['PartyName']
export type PartyPersonalInfo = components['schemas']['PartyPersonalInfo']
export type PartyResult = components['schemas']['PartyResult']
export type PartySubIdOrType = components['schemas']['PartySubIdOrType']
export type QuotesIDPutResponse = components['schemas']['QuotesIDPutResponse']
export type Scope = components['schemas']['Scope']
export type SignedCredential = components['schemas']['SignedCredential']
Expand All @@ -69,9 +78,11 @@ export namespace Schemas {
export type ThirdpartyRequestsTransactionsIDPatchResponse = components['schemas']['ThirdpartyRequestsTransactionsIDPatchResponse']
export type ThirdpartyRequestsTransactionsIDPutResponse = components['schemas']['ThirdpartyRequestsTransactionsIDPutResponse']
export type ThirdpartyRequestsTransactionsPostRequest = components['schemas']['ThirdpartyRequestsTransactionsPostRequest']
export type TransactionRequestsPostRequest = components['schemas']['TransactionRequestsPostRequest']
export type TransactionRequestState = components['schemas']['TransactionRequestState']
export type TransactionState = components['schemas']['TransactionState']
export type TransactionType = components['schemas']['TransactionType']
export type UnsignedCredential = components['schemas']['UnsignedCredential']
export type VerifiedCredential = components['schemas']['VerifiedCredential']

}
69 changes: 64 additions & 5 deletions tests/dto/thirdparty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Schemas } from '../../lib/thirdparty'

describe('thirdparty', () => {
const accountAddress: Schemas.AccountAddress = 'account-address'
const authenticationTypeQRCODE: Schemas.AuthenticationType = 'QRCODE'
const currency: Schemas.Currency = 'USD'
const name: Schemas.Name = 'name'
const account: Schemas.Account = {
Expand All @@ -21,6 +22,13 @@ describe('thirdparty', () => {
const extensionList: Schemas.ExtensionList = {
extension: [extension]
}
const errorCode: Schemas.ErrorCode = '00001'
const errorDescription: Schemas.ErrorDescription = 'error description'
const errorInformation: Schemas.ErrorInformation = {
errorCode,
errorDescription,
extensionList
}
const integer: Schemas.Integer = '1'
const correlationId: Schemas.CorrelationId = 'abcd-efgh'
const dateTime: Schemas.DateTime = '2021-01-01T00:00:0000'
Expand Down Expand Up @@ -121,6 +129,15 @@ describe('thirdparty', () => {
initiator: 'PAYER',
initiatorType: 'CONSUMER',
}
const partyResult: Schemas.PartyResult = {
partyId: partyIdInfo,
errorInformation
}

const partyIdentifier: Schemas.PartyIdentifier = 'abcdef'
const partyName: Schemas.PartyName = 'party-name'
const partySubIdOrType: Schemas.PartySubIdOrType = 'party-sub-id-or-type'

test('Account', () => {
expect(account).toBeDefined()
})
Expand Down Expand Up @@ -258,7 +275,7 @@ describe('thirdparty', () => {
}
expect(consentsIDPutResponseSigned).toBeDefined()
})

test('ConsentsIDPutResponseUnsigned', () => {
const consentsIDPutResponseUnsigned: Schemas.ConsentsIDPutResponseUnsigned = {
requestId: correlationId,
Expand Down Expand Up @@ -372,12 +389,22 @@ describe('thirdparty', () => {
expect(note).toBeDefined()
})

test('ParticipantsPostRequest', () => {
const participantsPostRequest: Schemas.ParticipantsPostRequest = {
requestId: correlationId,
partyList: [partyIdInfo],
currency
}
expect(participantsPostRequest).toBeDefined()
})

test('PartiesTypeIDPutResponse', () => {
const partiesTypeIDPutResponse: Schemas.PartiesTypeIDPutResponse = {
party
}
expect(partiesTypeIDPutResponse).toBeDefined()
})

test('Party', () => {
expect(party).toBeDefined()
})
Expand All @@ -386,6 +413,10 @@ describe('thirdparty', () => {
expect(partyComplexName).toBeDefined()
})

test('PartyIdentifier', () => {
expect(partyIdentifier).toBeDefined()
})

test('PartyIdInfo', () => {
expect(partyIdInfo).toBeDefined()
})
Expand All @@ -394,6 +425,18 @@ describe('thirdparty', () => {
expect(partyIdTypeEMAIL).toBeDefined()
})

test('PartyName', () => {
expect(partyName).toBeDefined()
})

test('PartyResult', () => {
expect(partyResult).toBeDefined()
})

test('PartySubIdOrType', () => {
expect(partySubIdOrType).toBeDefined()
})

test('PartyPersonalInfo', () => {
const partyPersonalInfo: Schemas.PartyPersonalInfo = {
complexName: partyComplexName,
Expand Down Expand Up @@ -424,11 +467,11 @@ describe('thirdparty', () => {
test('SignedCredential', () => {
expect(signedCredential).toBeDefined()
})

test('ThirdpartyRequestsTransactionsIDAuthorizationsPostRequest', () => {
const thirdpartyRequestsTransactionsIDAuthorizationsPostRequest: Schemas.ThirdpartyRequestsTransactionsIDAuthorizationsPostRequest = {
challenge: 'the-challenge',
value: 'signed-challenge',
value: 'signed-challenge',
consentId: correlationId,
sourceAccountId: accountAddress,
status: 'PENDING'
Expand All @@ -439,7 +482,7 @@ describe('thirdparty', () => {
test('ThirdpartyRequestsTransactionsIDAuthorizationsPutResponse', () => {
const thirdpartyRequestsTransactionsIDAuthorizationsPutResponse: Schemas.ThirdpartyRequestsTransactionsIDAuthorizationsPutResponse = {
challenge: 'the-challenge',
value: 'signed-challenge',
value: 'signed-challenge',
consentId: correlationId,
sourceAccountId: accountAddress,
status: 'VERIFIED'
Expand Down Expand Up @@ -484,7 +527,23 @@ describe('thirdparty', () => {
test('TransactionType', () => {
expect(transactionType).toBeDefined()
})


test('TransactionRequestsPostRequest', () => {
const transactionRequestsPostRequest: Schemas.TransactionRequestsPostRequest = {
transactionRequestId: correlationId,
payee: party,
payer: partyIdInfo,
amount: money,
transactionType,
note,
geoCode,
authenticationType: authenticationTypeQRCODE,
expiration: dateTime,
extensionList
}
expect(transactionRequestsPostRequest).toBeDefined()
})

test('UnsignedCredential', () => {
expect(unsignedCredential).toBeDefined()
})
Expand Down

0 comments on commit de9b3c8

Please sign in to comment.