-
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.
- Loading branch information
1 parent
590a5c1
commit 30fe041
Showing
11 changed files
with
147 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { h } from 'preact'; | ||
import UIElement from '../internal/UIElement'; | ||
import { CoreProvider } from '../../core/Context/CoreProvider'; | ||
import { TxVariants } from '../tx-variants'; | ||
import { UIElementProps } from '../internal/UIElement/types'; | ||
|
||
interface FastlaneConfiguration extends UIElementProps { | ||
tokenId: string; | ||
customerId: string; | ||
lastFour: string; | ||
brand: string; | ||
email: string; | ||
/** | ||
* Configuration returned by the backend | ||
* @internal | ||
*/ | ||
configuration?: { | ||
brands: string[]; | ||
}; | ||
} | ||
|
||
class Fastlane extends UIElement<FastlaneConfiguration> { | ||
public static type = TxVariants.fastlane; | ||
|
||
protected override formatData() { | ||
return { | ||
paymentMethod: { | ||
type: Fastlane.type, | ||
fastlaneData: btoa( | ||
JSON.stringify({ | ||
tokenId: this.props.tokenId, | ||
customerId: this.props.customerId | ||
}) | ||
) | ||
} | ||
}; | ||
} | ||
|
||
public override async isAvailable(): Promise<void> { | ||
const { tokenId, customerId, lastFour, brand, email } = this.props; | ||
|
||
if (tokenId && customerId && lastFour && brand && email) { | ||
return Promise.resolve(); | ||
} | ||
return Promise.reject(); | ||
} | ||
|
||
public override get isValid(): boolean { | ||
return true; | ||
} | ||
|
||
render() { | ||
console.log('FASTLANE RENDER'); | ||
|
||
return ( | ||
<CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}> | ||
<div> **** {this.props.lastFour} </div> | ||
<button>pay</button> | ||
</CoreProvider> | ||
); | ||
} | ||
} | ||
|
||
export default Fastlane; |
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 './Fastlane'; |
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