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

XOF #129

Merged
merged 30 commits into from
Feb 12, 2024
Merged

XOF #129

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e67bbb0
KYC save data
Frdrcpeter007 Oct 6, 2023
011bbd9
KYC save his data
Frdrcpeter007 Oct 6, 2023
a73a76c
Module to check KYC field
Frdrcpeter007 Oct 6, 2023
af9984b
Module to check KYC field
Frdrcpeter007 Oct 6, 2023
128ff84
Merge branch 'WiiQare:main' into KYC
Frdrcpeter007 Oct 6, 2023
bd01eb6
Add Waiting List module
Frdrcpeter007 Oct 10, 2023
b77f5a0
Module for waiting
Frdrcpeter007 Oct 11, 2023
ad8dec1
fix tests
abhishandilya Oct 11, 2023
3ce7b10
Finished Waiting list
Frdrcpeter007 Oct 12, 2023
815e505
Finished contact form
Frdrcpeter007 Oct 30, 2023
f9b35e8
Merge branch 'main' into Contact
Frdrcpeter007 Oct 30, 2023
d786c61
Finish module for blog
Frdrcpeter007 Nov 6, 2023
f3be427
Merge branch 'main' into Blog
Frdrcpeter007 Nov 6, 2023
c5d12ac
Change all links wiiqare-app.com to app.wiiqare.com
Frdrcpeter007 Nov 15, 2023
a732046
Change link of wiiqare platform
Frdrcpeter007 Nov 15, 2023
c0f8ee3
Finish module to get voucher without stripe webhook
Frdrcpeter007 Nov 24, 2023
b02f559
Change id stripe payment
Frdrcpeter007 Nov 24, 2023
a1ffd59
Change name endpoint
Frdrcpeter007 Nov 24, 2023
e63cbf6
Add comment modules
Frdrcpeter007 Dec 6, 2023
87d6ea3
Comment form it's working now
Frdrcpeter007 Dec 14, 2023
f24c678
Merge branch 'main' into Blog
Frdrcpeter007 Dec 14, 2023
87431cf
Finish with generate voucher module
Frdrcpeter007 Dec 20, 2023
de572a5
transaction
Frdrcpeter007 Jan 12, 2024
44d4879
Add country field
Frdrcpeter007 Jan 16, 2024
55a2d95
Merge branch 'main' into Blog
Frdrcpeter007 Jan 24, 2024
4ccca16
Change CDF to XOF
Frdrcpeter007 Feb 11, 2024
6780c69
Merge branch 'main' into Blog
Frdrcpeter007 Feb 11, 2024
a71e97a
Return CDF
Frdrcpeter007 Feb 12, 2024
6015571
Merge branch 'main' into Blog
Frdrcpeter007 Feb 12, 2024
5f172a5
Change to XOF
Frdrcpeter007 Feb 12, 2024
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 src/modules/payment-svc/payment-swap-svc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class PaymentSwapService {
senderId: randomUUID(),
patientId: randomUUID(),
currencyPatientAmount: 100,
currencyPatient: 'CDF',
currencyPatient: 'XOF',
currencyRate: 1.0,
},
},
Expand Down
42 changes: 21 additions & 21 deletions src/modules/provider-svc/provider-svc.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ describe('ProviderService', () => {
} as unknown as SmsGatewayService;

const mockSmartContractService = {
burnVoucher: () => {},
mintVoucher: () => {}
burnVoucher: () => { },
mintVoucher: () => { }
} as unknown as SmartContractService;

// Mock entities
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('ProviderService', () => {
senderCurrency: 'senderCurrency',
amount: 1000,
conversionRate: 1,
currency: 'CDF',
currency: 'XOF',
senderId: 'senderId',
ownerId: 'ownerId',
hospitalId: null,
Expand Down Expand Up @@ -485,53 +485,53 @@ describe('ProviderService', () => {
mockCachingService.get = jest.fn().mockResolvedValue('savedSecurityCode');

await expect(
service.authorizeVoucherTransfer(shortenHash, providerId, securityCode, services, 1000 ),
service.authorizeVoucherTransfer(shortenHash, providerId, securityCode, services, 1000),
).rejects.toThrow(
new ForbiddenException(_403.INVALID_VOUCHER_TRANSFER_VERIFICATION_CODE),
);
});

it('should throw an error if the voucher currency is not CDF', async () => {
transactionRepository.findOne = jest.fn().mockResolvedValue( {...mockTransaction, currency: 'USD'} );
it('should throw an error if the voucher currency is not XOF', async () => {
transactionRepository.findOne = jest.fn().mockResolvedValue({ ...mockTransaction, currency: 'USD' });

await expect(
service.authorizeVoucherTransfer(shortenHash, providerId, securityCode, services, 1000 ),
service.authorizeVoucherTransfer(shortenHash, providerId, securityCode, services, 1000),
).rejects.toThrow(
new ForbiddenException(_403.WRONG_VOUCHER_CURRENCY),
);
});

it('should split into 2 vouchers with values summing the first voucher', async () => {
mockCachingService.get = jest.fn().mockResolvedValue( securityCode );
mockCachingService.get = jest.fn().mockResolvedValue(securityCode);
const voucher1 = { value: 100 };
const voucher2 = { value: 900 };
transactionRepository.create = jest.fn().
mockImplementationOnce( ( obj ) => { return {value: obj.amount} } ).
mockImplementationOnce( ( obj ) => { return {value: obj.amount} } );
voucherRepository.findOne = jest.fn().mockResolvedValue( mockVoucher );
voucherRepository.create = jest.fn().mockResolvedValue(
mockImplementationOnce((obj) => { return { value: obj.amount } }).
mockImplementationOnce((obj) => { return { value: obj.amount } });

voucherRepository.findOne = jest.fn().mockResolvedValue(mockVoucher);
voucherRepository.create = jest.fn().mockResolvedValue(
{}
);
providerRepository.findOne = jest.fn().mockResolvedValue( mockProvider );
serviceRepository.find = jest.fn().mockResolvedValue( [ mockService ] );
);
providerRepository.findOne = jest.fn().mockResolvedValue(mockProvider);
serviceRepository.find = jest.fn().mockResolvedValue([mockService]);

const mockMintedVoucher = {
events: {
mintVoucherEvent: {
transactionHash: 'hash1',
returnValues: {
'0': 1,
'1': [100, 'CDF', 'ownerId', 'hospitalId', 'patientId', 'UNCLAIMED']
'1': [100, 'XOF', 'ownerId', 'hospitalId', 'patientId', 'UNCLAIMED']
}
}
}
}
mockSmartContractService.mintVoucher = jest.fn().mockResolvedValue( mockMintedVoucher );
mockSmartContractService.mintVoucher = jest.fn().mockResolvedValue(mockMintedVoucher);

const result = await service.authorizeVoucherTransfer(shortenHash, providerId, securityCode, services, 1000 );
expect( transactionRepository.create ).toHaveNthReturnedWith( 1, voucher1 );
expect( transactionRepository.create ).toHaveNthReturnedWith( 2, voucher2 );
const result = await service.authorizeVoucherTransfer(shortenHash, providerId, securityCode, services, 1000);
expect(transactionRepository.create).toHaveNthReturnedWith(1, voucher1);
expect(transactionRepository.create).toHaveNthReturnedWith(2, voucher2);
});
});

Expand Down
Loading