forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cashier-v2] Aum / FEQ-1929 / cashier-v2-transfer-receipt-and-transfe…
…r-no-account (deriv-com#14194) * feat: added TransferReceipt along with required utils and components * perf: added unit tests * feat: added TransferNoAccount screen * perf: added unit tests for utils * chore: fix CI * refactor: changed logic for MT5 mapper and removed unused PlatformDetails mapper * chore: removed business logic related mappers/helpers/utils * chore: fix CI by removing unwanted function call
- Loading branch information
Showing
18 changed files
with
198 additions
and
253 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/cashier-v2/src/assets/images/ic-cashier-no-balance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...ages/cashier-v2/src/flows/AccountTransfer/screens/TransferNoAccount/TransferNoAccount.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import { ActionScreen, Button } from '@deriv-com/ui'; | ||
import NoAccountIcon from '../../../../assets/images/ic-cashier-no-balance.svg'; | ||
|
||
const TransferNoAccount = () => { | ||
return ( | ||
<ActionScreen | ||
actionButtons={<Button size='lg'>Create Account</Button>} | ||
description='Please create another Deriv, Deriv MT5, or Deriv X account.' | ||
icon={<NoAccountIcon />} | ||
title='You need at least two accounts' | ||
/> | ||
); | ||
}; | ||
|
||
export default TransferNoAccount; |
1 change: 1 addition & 0 deletions
1
packages/cashier-v2/src/flows/AccountTransfer/screens/TransferNoAccount/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './TransferNoAccount'; |
107 changes: 0 additions & 107 deletions
107
packages/cashier-v2/src/helpers/__tests__/helpers.spec.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/cashier-v2/src/lib/Transfer/components/TransferAccountIcon/TransferAccountIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { CurrencyIcon, TradingAppIcon } from '../../../../components'; | ||
import { TTransferableAccounts } from '../../types'; | ||
|
||
type TProps = { | ||
account: TTransferableAccounts[number]; | ||
size?: React.ComponentProps<typeof CurrencyIcon>['size'] | React.ComponentProps<typeof TradingAppIcon>['size']; | ||
}; | ||
|
||
const TransferAccountIcon: React.FC<React.PropsWithChildren<TProps>> = ({ account, size = 'md' }) => { | ||
if (account.account_type === 'binary' && account.currency) | ||
return <CurrencyIcon currency={account.currency} size={size} />; | ||
|
||
if (account.account_type === 'dxtrade') return <TradingAppIcon name='DERIVX' size={size} />; | ||
|
||
if (account.account_type === 'mt5') return <div>MT5</div>; | ||
|
||
return null; | ||
}; | ||
|
||
export default TransferAccountIcon; |
52 changes: 52 additions & 0 deletions
52
...v2/src/lib/Transfer/components/TransferAccountIcon/__tests__/TransferAccountIcon.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import TransferAccountIcon from '../TransferAccountIcon'; | ||
|
||
jest.mock('../../../../../components', () => ({ | ||
...jest.requireActual('../../../../../components'), | ||
CurrencyIcon: jest.fn(({ currency, size }) => ( | ||
<div> | ||
CurrencyIcon-{currency}-{size} | ||
</div> | ||
)), | ||
TradingAppIcon: jest.fn(({ name, size }) => ( | ||
<div> | ||
TradingAppIcon-{name}-{size} | ||
</div> | ||
)), | ||
})); | ||
|
||
describe('<TransferAccountIcon />', () => { | ||
it('should display the correct currency icon for deriv accounts', () => { | ||
render(<TransferAccountIcon account={{ account_type: 'binary', currency: 'BTC' }} />); | ||
|
||
expect(screen.getByText('CurrencyIcon-BTC-md')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display the correct MT5 icon for MT5 app', () => { | ||
render( | ||
<TransferAccountIcon | ||
account={{ | ||
account_type: 'mt5', | ||
currency: 'USD', | ||
mt5_group: 'real\\p01_ts01\\financial\\svg_std-hr_usd', | ||
}} | ||
/> | ||
); | ||
|
||
expect(screen.getByText('MT5')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display the correct Deriv X icon for Deriv X app', () => { | ||
render( | ||
<TransferAccountIcon | ||
account={{ | ||
account_type: 'dxtrade', | ||
currency: 'USD', | ||
}} | ||
/> | ||
); | ||
|
||
expect(screen.getByText('TradingAppIcon-DERIVX-md')).toBeInTheDocument(); | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/cashier-v2/src/lib/Transfer/components/TransferAccountIcon/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as TransferAccountIcon } from './TransferAccountIcon'; |
27 changes: 27 additions & 0 deletions
27
packages/cashier-v2/src/lib/Transfer/components/TransferReceipt/TransferReceipt.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.actions { | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 0.8rem; | ||
|
||
@include mobile-cashier-v2 { | ||
flex-direction: column; | ||
} | ||
} | ||
|
||
.account-info { | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 0.8rem; | ||
} | ||
|
||
.account-id { | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: 0.4rem; | ||
} |
Oops, something went wrong.