-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: scaffold the PayMe wallet * feat(payme): add the PayMe wallet * refactor(payme): add the logic for the countdownTime * refactor(payme): remove comments * refactor: add translations * test: add some tests * refactor: added tests * refactor: unit test * chore: add changeset
- Loading branch information
1 parent
d358019
commit 8ea9ded
Showing
37 changed files
with
323 additions
and
61 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
'@adyen/adyen-web': minor | ||
--- | ||
|
||
Add support for the PayMe payment method. |
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,15 @@ | ||
@import '../../style/index'; | ||
|
||
.adyen-checkout-payme-instructions { | ||
font-size: $font-size-small; | ||
text-align: center; | ||
color: #5c687c; | ||
line-height: 20px; | ||
|
||
&__steps { | ||
list-style-position: inside; | ||
padding-inline-start: 0; | ||
margin: 16px 0; | ||
padding-bottom: 8px; | ||
} | ||
} |
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,25 @@ | ||
import { render, screen } from '@testing-library/preact'; | ||
import { h } from 'preact'; | ||
import Language from '../../language'; | ||
import { Resources } from '../../core/Context/Resources'; | ||
import CoreProvider from '../../core/Context/CoreProvider'; | ||
import Instructions from './Instructions'; | ||
|
||
describe('Instructions', () => { | ||
const customRender = (ui: h.JSX.Element) => { | ||
return render( | ||
// @ts-ignore ignore | ||
<CoreProvider i18n={new Language()} loadingContext="test" resources={new Resources()}> | ||
{ui} | ||
</CoreProvider> | ||
); | ||
}; | ||
|
||
test('should see a list of instructions and footnote', async () => { | ||
customRender(<Instructions />); | ||
expect(await screen.findByText('Open the PayMe app', { exact: false })).toBeInTheDocument(); | ||
expect(await screen.findByText('Scan the QR code', { exact: false })).toBeInTheDocument(); | ||
expect(await screen.findByText('Complete the payment in the app', { exact: false })).toBeInTheDocument(); | ||
expect(await screen.findByText('Please do not close this page before the payment is completed', { exact: false })).toBeInTheDocument(); | ||
}); | ||
}); |
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,20 @@ | ||
import useCoreContext from '../../core/Context/useCoreContext'; | ||
import { h } from 'preact'; | ||
import './Instructions.scss'; | ||
|
||
export default function Instructions() { | ||
const { i18n } = useCoreContext(); | ||
const steps = i18n.get('payme.instructions.steps'); | ||
const footnote = i18n.get('payme.instructions.footnote'); | ||
|
||
return ( | ||
<div className="adyen-checkout-payme-instructions"> | ||
<ol className="adyen-checkout-payme-instructions__steps"> | ||
{steps.split('%@').map((step, index) => ( | ||
<li key={`instruction-${index}`}>{step}</li> | ||
))} | ||
</ol> | ||
<span>{footnote}</span> | ||
</div> | ||
); | ||
} |
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,23 @@ | ||
import QRLoaderContainer from '../helpers/QRLoaderContainer'; | ||
import Instructions from './Instructions'; | ||
|
||
class PayMeElement extends QRLoaderContainer { | ||
public static type = 'payme'; | ||
private static defaultCountdown = 10; // min | ||
private static defaultDelay = 2000; // ms | ||
|
||
formatProps(props) { | ||
return { | ||
delay: PayMeElement.defaultDelay, | ||
countdownTime: PayMeElement.defaultCountdown, | ||
redirectIntroduction: 'payme.openPayMeApp', | ||
introduction: 'payme.scanQrCode', | ||
timeToPay: 'payme.timeToPay', | ||
buttonLabel: 'payme.redirectButtonLabel', | ||
instructions: Instructions, | ||
...super.formatProps(props) | ||
}; | ||
} | ||
} | ||
|
||
export default PayMeElement; |
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 } from './PayMe'; |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.