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

Removes identity number field on onboarding flow #182

Merged
merged 1 commit into from
Apr 1, 2024
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
7 changes: 4 additions & 3 deletions samples/onboarding/CreateBuyer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ const request = {
contactSurname: 'Demir',
email: '[email protected]',
phoneNumber: '905551111111',
identityNumber: '11111111110',
name: 'Haluk Demir',
memberType: Craftgate.Model.MemberType.Personal,
memberExternalId: 'random-id',
address: 'Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul',
address: 'Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul'
};

craftgate.onboarding().createMember(request)
craftgate
.onboarding()
.createMember(request)
.then(result => console.info('Buyer member created', result))
.catch(err => console.error('Failed to create buyer member', err));
5 changes: 3 additions & 2 deletions samples/onboarding/CreateMemberAsBuyerAndSubMerchant.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const request = {
email: '[email protected]',
phoneNumber: '905551111111',
iban: 'TR930006701000000001111111',
identityNumber: '11111111110',
legalCompanyTitle: 'Dem Zeytinyağı Üretim Ltd. Şti.',
name: 'Dem Zeytinyağı Üretim Ltd. Şti.',
memberType: Craftgate.Model.MemberType.LimitedOrStockJointCompany,
Expand All @@ -24,6 +23,8 @@ const request = {
address: 'Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul'
};

craftgate.onboarding().createMember(request)
craftgate
.onboarding()
.createMember(request)
.then(result => console.info('Member created', result))
.catch(err => console.error('Failed to create member', err));
5 changes: 3 additions & 2 deletions samples/onboarding/CreateSubMerchant.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const request = {
email: '[email protected]',
phoneNumber: '905551111111',
iban: 'TR930006701000000001111111',
identityNumber: '11111111110',
legalCompanyTitle: 'Dem Zeytinyağı Üretim Ltd. Şti.',
name: 'Dem Zeytinyağı Üretim Ltd. Şti.',
memberType: Craftgate.Model.MemberType.LimitedOrStockJointCompany,
Expand All @@ -24,6 +23,8 @@ const request = {
address: 'Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul'
};

craftgate.onboarding().createMember(request)
craftgate
.onboarding()
.createMember(request)
.then(result => console.info('Sub merchant member created', result))
.catch(err => console.error('Failed to create sub merchant member', err));
5 changes: 3 additions & 2 deletions samples/onboarding/UpdateBuyer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ const request = {
contactSurname: 'Demir',
email: '[email protected]',
phoneNumber: '905551111111',
identityNumber: '11111111110',
name: 'Haluk Demir',
memberType: Craftgate.Model.MemberType.Personal,
address: 'Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul'
};

// change the memberId (displayed as 1 below) with a valid id to run the sample
craftgate.onboarding().updateMember(1, request)
craftgate
.onboarding()
.updateMember(1, request)
.then(result => console.info('Buyer member updated', result))
.catch(err => console.error('Failed to update buyer member', err));
5 changes: 3 additions & 2 deletions samples/onboarding/UpdateSubMerchant.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const request = {
email: '[email protected]',
phoneNumber: '905551111111',
iban: 'TR930006701000000001111111',
identityNumber: '11111111110',
legalCompanyTitle: 'Dem Zeytinyağı Üretim Ltd. Şti.',
name: 'Dem Zeytinyağı Üretim Ltd. Şti.',
memberType: Craftgate.Model.MemberType.LimitedOrStockJointCompany,
Expand All @@ -25,6 +24,8 @@ const request = {
};

// change the memberId (displayed as 1 below) with a valid id to run the sample
craftgate.onboarding().updateMember(1, request)
craftgate
.onboarding()
.updateMember(1, request)
.then(result => console.info('Sub merchant member updated', result))
.catch(err => console.error('Failed to update sub merchant member', err));
1 change: 0 additions & 1 deletion src/request/CreateMemberRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type CreateMemberRequest = {
taxNumber?: string;
contactName?: string;
contactSurname?: string;
identityNumber?: string;
legalCompanyTitle?: string;
/**
* @deprecated use @{@link CreateMemberWalletRequest.negativeAmountLimit} instead.
Expand Down
1 change: 0 additions & 1 deletion src/request/UpdateMemberRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type UpdateMemberRequest = {
taxNumber?: string;
contactName?: string;
contactSurname?: string;
identityNumber?: string;
legalCompanyTitle?: string;
settlementEarningsDestination?: SettlementEarningsDestination;
/**
Expand Down
1 change: 0 additions & 1 deletion src/response/MemberResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type MemberResponse = {
taxNumber: string;
contactName: string;
contactSurname: string;
identityNumber: string;
legalCompanyTitle: string;
settlementEarningsDestination: SettlementEarningsDestination;
};
Expand Down
57 changes: 8 additions & 49 deletions test/adapter/OnboardingAdapter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ test('createSubMerchant() should create sub merchant member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation'
};

Expand All @@ -44,14 +43,11 @@ test('createSubMerchant() should create sub merchant member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Wallet
};

nock('http://localhost:8000')
.post('/onboarding/v1/members', request)
.reply(200, {data: response});
nock('http://localhost:8000').post('/onboarding/v1/members', request).reply(200, {data: response});

const result = await onboardingAdapter.createMember(request);
t.is(result.id, 42);
Expand All @@ -69,7 +65,6 @@ test('createSubMerchant() should create sub merchant member', async t => {
t.is(result.taxNumber, '1234123456');
t.is(result.contactName, 'Luke');
t.is(result.contactSurname, 'Skywalker');
t.is(result.identityNumber, '12341234912');
t.is(result.legalCompanyTitle, 'Skywalker Aviation');
});

Expand All @@ -87,7 +82,6 @@ test('updateSubMerchant() should update sub merchant member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};
Expand All @@ -108,14 +102,11 @@ test('updateSubMerchant() should update sub merchant member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};

nock('http://localhost:8000')
.put('/onboarding/v1/members/42', request)
.reply(200, {data: response});
nock('http://localhost:8000').put('/onboarding/v1/members/42', request).reply(200, {data: response});

const result = await onboardingAdapter.updateMember(response.id, request);
t.is(result.id, 42);
Expand All @@ -133,7 +124,6 @@ test('updateSubMerchant() should update sub merchant member', async t => {
t.is(result.taxNumber, '1234123456');
t.is(result.contactName, 'Luke');
t.is(result.contactSurname, 'Skywalker');
t.is(result.identityNumber, '12341234912');
t.is(result.legalCompanyTitle, 'Skywalker Aviation');
});

Expand All @@ -154,14 +144,11 @@ test('retrieveSubMerchant() should retrieve sub merchant member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};

nock('http://localhost:8000')
.get(`/onboarding/v1/members/${response.id}`)
.reply(200, {data: response});
nock('http://localhost:8000').get(`/onboarding/v1/members/${response.id}`).reply(200, {data: response});

const result = await onboardingAdapter.retrieveMember(response.id);
t.is(result.id, 42);
Expand All @@ -179,7 +166,6 @@ test('retrieveSubMerchant() should retrieve sub merchant member', async t => {
t.is(result.taxNumber, '1234123456');
t.is(result.contactName, 'Luke');
t.is(result.contactSurname, 'Skywalker');
t.is(result.identityNumber, '12341234912');
t.is(result.legalCompanyTitle, 'Skywalker Aviation');
});

Expand All @@ -198,7 +184,6 @@ test('createBuyer() should create buyer member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};
Expand All @@ -219,14 +204,11 @@ test('createBuyer() should create buyer member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};

nock('http://localhost:8000')
.post('/onboarding/v1/members', request)
.reply(200, {data: response});
nock('http://localhost:8000').post('/onboarding/v1/members', request).reply(200, {data: response});

const result = await onboardingAdapter.createMember(request);
t.is(result.id, 43);
Expand All @@ -244,7 +226,6 @@ test('createBuyer() should create buyer member', async t => {
t.is(result.taxNumber, '1234123456');
t.is(result.contactName, 'Luke');
t.is(result.contactSurname, 'Skywalker');
t.is(result.identityNumber, '12341234912');
t.is(result.legalCompanyTitle, 'Skywalker Aviation');
});

Expand All @@ -262,7 +243,6 @@ test('updateBuyer() should update buyer member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};
Expand All @@ -283,14 +263,11 @@ test('updateBuyer() should update buyer member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};

nock('http://localhost:8000')
.put('/onboarding/v1/members/43', request)
.reply(200, {data: response});
nock('http://localhost:8000').put('/onboarding/v1/members/43', request).reply(200, {data: response});

const result = await onboardingAdapter.updateMember(response.id, request);
t.is(result.id, 43);
Expand All @@ -308,7 +285,6 @@ test('updateBuyer() should update buyer member', async t => {
t.is(result.taxNumber, '1234123456');
t.is(result.contactName, 'Luke');
t.is(result.contactSurname, 'Skywalker');
t.is(result.identityNumber, '12341234912');
t.is(result.legalCompanyTitle, 'Skywalker Aviation');
});

Expand All @@ -329,14 +305,11 @@ test('retrieveBuyer() should retrieve buyer member', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
};

nock('http://localhost:8000')
.get(`/onboarding/v1/members/${response.id}`)
.reply(200, {data: response});
nock('http://localhost:8000').get(`/onboarding/v1/members/${response.id}`).reply(200, {data: response});

const result = await onboardingAdapter.retrieveMember(response.id);
t.is(result.id, 43);
Expand All @@ -354,7 +327,6 @@ test('retrieveBuyer() should retrieve buyer member', async t => {
t.is(result.taxNumber, '1234123456');
t.is(result.contactName, 'Luke');
t.is(result.contactSurname, 'Skywalker');
t.is(result.identityNumber, '12341234912');
t.is(result.legalCompanyTitle, 'Skywalker Aviation');
});

Expand All @@ -368,16 +340,7 @@ test('searchMembers() should search for members', async t => {
size: 25
};

const queryString = [
'name=luke',
'memberIds=1',
'memberIds=2',
'memberIds=42',
'memberExternalId=wormie',
'memberType=PERSONAL',
'page=0',
'size=25'
].join('&');
const queryString = ['name=luke', 'memberIds=1', 'memberIds=2', 'memberIds=42', 'memberExternalId=wormie', 'memberType=PERSONAL', 'page=0', 'size=25'].join('&');

const response = {
page: 0,
Expand All @@ -400,16 +363,13 @@ test('searchMembers() should search for members', async t => {
taxNumber: '1234123456',
contactName: 'Luke',
contactSurname: 'Skywalker',
identityNumber: '12341234912',
legalCompanyTitle: 'Skywalker Aviation',
settlementEarningsDestination: Craftgate.Model.SettlementEarningsDestination.Iban
}
]
};

nock('http://localhost:8000')
.get(`/onboarding/v1/members?${queryString}`)
.reply(200, {data: response});
nock('http://localhost:8000').get(`/onboarding/v1/members?${queryString}`).reply(200, {data: response});

const {page, size, totalSize, items} = await onboardingAdapter.searchMembers(request);
t.is(page, 0);
Expand All @@ -431,6 +391,5 @@ test('searchMembers() should search for members', async t => {
t.is(items[0].taxNumber, '1234123456');
t.is(items[0].contactName, 'Luke');
t.is(items[0].contactSurname, 'Skywalker');
t.is(items[0].identityNumber, '12341234912');
t.is(items[0].legalCompanyTitle, 'Skywalker Aviation');
});
Loading