give
/
src
/
DonorDashboards
/
resources
/
js
/
app
/
components
/
subscription-manager
/
payment-method-control
/
index.js
give
/
src
/
DonorDashboards
/
resources
/
js
/
app
/
components
/
subscription-manager
/
payment-method-control
Last commit date
authorize-control
1 year ago
card-control
1 year ago
square-control
1 year ago
stripe-control
4 years ago
index.js
1 year ago
style.scss
4 years ago
index.js
43 lines
| 1 | import React from 'react'; |
| 2 | |
| 3 | import AuthorizeControl from './authorize-control'; |
| 4 | import SquareControl from './square-control'; |
| 5 | import StripeControl from './stripe-control'; |
| 6 | import CardControl from './card-control'; |
| 7 | |
| 8 | import './style.scss'; |
| 9 | |
| 10 | /** |
| 11 | * @since 3.19.0 Add controller for Blink payment method. |
| 12 | */ |
| 13 | const PaymentMethodControl = (props) => { |
| 14 | switch (props.gateway.id) { |
| 15 | case 'stripe': |
| 16 | case 'stripe_apple_pay': |
| 17 | case 'stripe_becs': |
| 18 | case 'stripe_checkout': |
| 19 | case 'stripe_google_pay': { |
| 20 | return <StripeControl {...props} />; |
| 21 | } |
| 22 | case 'authorize': { |
| 23 | return <AuthorizeControl {...props} />; |
| 24 | } |
| 25 | case 'square': { |
| 26 | return <SquareControl {...props} />; |
| 27 | } |
| 28 | case 'paypalpro': { |
| 29 | return <CardControl {...props} />; |
| 30 | } |
| 31 | case 'blink': { |
| 32 | // Donor Dashboard currently loads its own version of React so we need to pass it to the component |
| 33 | const Element = wp.hooks.applyFilters('give_donor_dashboard_blink_payment_method_control', null, props); |
| 34 | return Element && <Element {...props} React={React} />; |
| 35 | } |
| 36 | default: { |
| 37 | return null; |
| 38 | } |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | export default PaymentMethodControl; |
| 43 |