-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #2817: Add Payment Targets * #2816: Review changes * Prettier changes. Co-authored-by: Devagouda <40405790+dpatil-magento@users.noreply.github.com> Co-authored-by: Revanth Kumar <revanth0212@gmail.com>
- Loading branch information
1 parent
a196b5e
commit 7a60ec0
Showing
7 changed files
with
211 additions
and
16 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
22 changes: 22 additions & 0 deletions
22
packages/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentMethodCollection.js
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,22 @@ | ||
/** | ||
* This file is augmented at build time using the @magento/venia-ui build | ||
* target "payments", which allows third-party modules to add new payment component mappings. | ||
* | ||
* @see [Payment definition object]{@link PaymentDefinition} | ||
*/ | ||
export default {}; | ||
|
||
/** | ||
* A payment definition object that describes a payment in your storefront. | ||
* | ||
* @typedef {Object} PaymentDefinition | ||
* @property {string} paymentCode is use to map your payment | ||
* @property {string} importPath Resolvable path to the component the | ||
* Route component will render | ||
* | ||
* @example <caption>A custom payment method</caption> | ||
* const myCustomPayment = { | ||
* paymentCode: 'cc', | ||
* importPath: '@partner/module/path_to_your_component' | ||
* } | ||
*/ |
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,29 @@ | ||
/** | ||
* Implementation of our 'payments' target. This will gather | ||
* PaymentMethod declarations { paymentCode, importPath } from all | ||
* interceptors, and then tap `builtins.transformModules` to inject a module | ||
* transform into the build which is configured to generate an object of modules | ||
* to be imported and then exported. | ||
* | ||
* An instance of this class is made available when you use VeniaUI's | ||
* `payments` target. | ||
*/ | ||
class PaymentMethodList { | ||
/** @hideconstructor */ | ||
constructor(venia) { | ||
const registry = this; | ||
this._methods = venia.esModuleObject({ | ||
module: | ||
'@magento/venia-ui/lib/components/CheckoutPage/PaymentInformation/paymentMethodCollection.js', | ||
publish(targets) { | ||
targets.payments.call(registry); | ||
} | ||
}); | ||
} | ||
|
||
add({ paymentCode, importPath }) { | ||
this._methods.add(`import ${paymentCode} from '${importPath}'`); | ||
} | ||
} | ||
|
||
module.exports = PaymentMethodList; |
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