| 1 |
<?php |
| 2 |
/** |
| 3 |
* Payment Gateways Admin Page |
| 4 |
* |
| 5 |
* Displays available payment gateway options as cards. |
| 6 |
* |
| 7 |
* @package SpringDevs\Subscription |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly. |
| 11 |
defined( 'ABSPATH' ) || exit; |
| 12 |
?> |
| 13 |
|
| 14 |
|
| 15 |
<div class="wrap"> |
| 16 |
|
| 17 |
<div class="wp-subscription-admin-content" style="max-width:1240px;margin:32px auto 0 auto"> |
| 18 |
<h2><?php esc_html_e( 'Payment Gateways', 'subscription' ); ?></h2> |
| 19 |
|
| 20 |
<p style="font-size:14px;line-height:1.7;margin:0 0 24px 0;"> |
| 21 |
<?php esc_html_e( 'Configure your store\'s payment gateways for subscription products. Enable, disable, and manage available payment methods that support recurring billing.', 'subscription' ); ?> |
| 22 |
</p> |
| 23 |
|
| 24 |
<!-- Payment Gateway Cards --> |
| 25 |
<div class="wp-subscription-payment-gateways" style="display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:24px;margin-bottom:32px;"> |
| 26 |
<?php |
| 27 |
foreach ( $integrations as $integration ) : |
| 28 |
?> |
| 29 |
<div style="background-color:white;border-radius:8px;padding:18px;box-shadow:0 2px 8px #e0e7ef;"> |
| 30 |
<div style="display: flex; gap: 14px;"> |
| 31 |
<div> |
| 32 |
<img |
| 33 |
style="width: 40px; height: 40px; border-radius: 8px;" |
| 34 |
src=<?php echo esc_url( $integration['icon_url'] ?? '' ); ?> |
| 35 |
alt="" |
| 36 |
/> |
| 37 |
</div> |
| 38 |
<div style="width: 100%;"> |
| 39 |
<div style="display: flex; align-items: center; gap: 4px;"> |
| 40 |
<span style="font-size:1.2em;font-weight:600;"> |
| 41 |
<?php echo esc_html( $integration['title'] ?? '' ); ?> |
| 42 |
</span> |
| 43 |
|
| 44 |
<div style="margin-left: auto; display: flex; gap: 6px; align-items: center;"> |
| 45 |
<!-- Integration Status Badge --> |
| 46 |
<?php if ( ! empty( $integration['is_installed'] ) && ! empty( $integration['is_active'] ) ) : ?> |
| 47 |
<span style="font-size:0.85em;padding:4px 8px;border-radius:12px;white-space:nowrap;text-transform: uppercase;background:#e8f5e9;color:#1b5e20;"> |
| 48 |
<?php esc_html_e( 'Active', 'subscription' ); ?> |
| 49 |
</span> |
| 50 |
<?php elseif ( ! empty( $integration['is_installed'] ) && empty( $integration['is_active'] ) ) : ?> |
| 51 |
<span style="font-size:0.85em;padding:4px 8px;border-radius:12px;white-space:nowrap;text-transform: uppercase;background:#e3f2fd;color:#0d47a1;"> |
| 52 |
<?php esc_html_e( 'Inactive', 'subscription' ); ?> |
| 53 |
</span> |
| 54 |
<?php else : ?> |
| 55 |
<span style="font-size:0.85em;padding:4px 8px;border-radius:12px;white-space:nowrap;text-transform: uppercase;background:#ffebee;color:#b71c1c;"> |
| 56 |
<?php esc_html_e( 'Not Available', 'subscription' ); ?> |
| 57 |
</span> |
| 58 |
<?php endif; ?> |
| 59 |
|
| 60 |
<!-- Beta Badge --> |
| 61 |
<?php if ( ! empty( $integration['is_beta'] ) && $integration['is_beta'] ) : ?> |
| 62 |
<span style="font-size:0.85em;padding:4px 8px;border-radius:12px;white-space:nowrap;text-transform: uppercase;background:#ffebee;color:#b71c1c;font-weight: 500;"> |
| 63 |
<?php esc_html_e( 'Beta', 'subscription' ); ?> |
| 64 |
</span> |
| 65 |
<?php endif; ?> |
| 66 |
</div> |
| 67 |
</div> |
| 68 |
<p style="font-size:12px;line-height:1.5;margin:8px 0 0 0;color:#555;"> |
| 69 |
<?php echo esc_html( $integration['description'] ?? '' ); ?> |
| 70 |
</p> |
| 71 |
</div> |
| 72 |
</div> |
| 73 |
|
| 74 |
<!-- Recurring Support --> |
| 75 |
<?php if ( ! empty( $integration['supports_recurring'] ) ) : ?> |
| 76 |
<div style="background:#e8f5e9;color:#1b5e20;padding:6px 10px;margin:20px 0;border-radius:4px;font-size:13px;margin-bottom:16px;"> |
| 77 |
<span style="display:flex;align-items:center;gap:6px;"> |
| 78 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 79 |
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" fill="#1b5e20"/> |
| 80 |
</svg> |
| 81 |
<?php esc_html_e( 'Supports automatic recurring payments.', 'subscription' ); ?> |
| 82 |
</span> |
| 83 |
</div> |
| 84 |
<?php else : ?> |
| 85 |
<div style="background:#fff3e0;color:#e65100;padding:6px 10px;margin:20px 0;border-radius:4px;font-size:13px;margin-bottom:16px;"> |
| 86 |
<span style="display:flex;align-items:center;gap:6px;"> |
| 87 |
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 88 |
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" fill="#e65100"/> |
| 89 |
</svg> |
| 90 |
<?php esc_html_e( 'Manual renewals only.', 'subscription' ); ?> |
| 91 |
</span> |
| 92 |
</div> |
| 93 |
<?php endif; ?> |
| 94 |
|
| 95 |
<!-- Actions --> |
| 96 |
<div style="width: 100%; display: flex; gap: 8px; flex-wrap: wrap; align-items: end;"> |
| 97 |
<?php foreach ( $integration['actions'] as $integration_action ) : ?> |
| 98 |
<?php if ( 'link' === $integration_action['type'] ) : ?> |
| 99 |
<a href="<?php echo esc_url( $integration_action['url'] ); ?>" class="button button-primary" style="flex:1;text-align:center;"> |
| 100 |
<?php echo esc_html( $integration_action['label'] ); ?> |
| 101 |
</a> |
| 102 |
<?php elseif ( 'external_link' === $integration_action['type'] ) : ?> |
| 103 |
<a href="<?php echo esc_url( $integration_action['url'] ); ?>" target="_blank" class="button button-primary" style="flex:1;text-align:center;"> |
| 104 |
<?php echo esc_html( $integration_action['label'] ); ?> |
| 105 |
</a> |
| 106 |
<?php elseif ( 'function' === $integration_action['type'] ) : ?> |
| 107 |
<button |
| 108 |
class="<?php echo esc_attr( $integration_action['class'] ?? 'button button-primary' ); ?>" |
| 109 |
style="flex:1;text-align:center;" |
| 110 |
onclick="<?php echo esc_attr( $integration_action['function'] ); ?>" |
| 111 |
> |
| 112 |
<?php echo esc_html( $integration_action['label'] ); ?> |
| 113 |
</button> |
| 114 |
<?php endif; ?> |
| 115 |
<?php endforeach; ?> |
| 116 |
</div> |
| 117 |
</div> |
| 118 |
<?php |
| 119 |
endforeach; |
| 120 |
?> |
| 121 |
</div> |
| 122 |
|
| 123 |
<!-- Information box --> |
| 124 |
<div class="wp-subscription-admin-box" style="margin-bottom:24px;"> |
| 125 |
<h3><?php esc_html_e( 'About Payment Gateways', 'subscription' ); ?></h3> |
| 126 |
<p style="font-size:14px;line-height:1.7;margin:0 0 10px 0;"> |
| 127 |
<?php esc_html_e( 'For subscription products to work properly, you need to use payment gateways that support recurring payments. Some payment methods only support manual renewals, which requires customers to manually pay for each renewal period.', 'subscription' ); ?> |
| 128 |
</p> |
| 129 |
<ul style="font-size:14px;line-height:1.6;margin:0 0 0 18px;padding:0;list-style:disc;"> |
| 130 |
<li><?php esc_html_e( 'Automatic recurring billing requires a compatible payment gateway', 'subscription' ); ?></li> |
| 131 |
<li><?php esc_html_e( 'Manual renewal methods work with any payment gateway', 'subscription' ); ?></li> |
| 132 |
<li><?php esc_html_e( 'Some gateways may require additional configuration for subscriptions', 'subscription' ); ?></li> |
| 133 |
</ul> |
| 134 |
</div> |
| 135 |
|
| 136 |
<!-- Documentation box --> |
| 137 |
<div class="wp-subscription-support-resources" style="display:grid;grid-template-columns:repeat(2,1fr);gap:24px;margin-bottom:24px;"> |
| 138 |
<div class="wp-subscription-admin-box"> |
| 139 |
<h3><?php esc_html_e( 'Payment Gateway Documentation', 'subscription' ); ?></h3> |
| 140 |
<p style="font-size:14px;margin:0 0 8px 0;"> |
| 141 |
<?php esc_html_e( 'Learn how to set up and configure payment gateways for subscription products.', 'subscription' ); ?> |
| 142 |
</p> |
| 143 |
<a href="https://docs.converslabs.com/en" target="_blank" class="button button-small" style="font-size:13px;padding:5px 14px;"> |
| 144 |
<?php esc_html_e( 'View Documentation', 'subscription' ); ?> |
| 145 |
</a> |
| 146 |
</div> |
| 147 |
<div class="wp-subscription-admin-box"> |
| 148 |
<h3><?php esc_html_e( 'Need Help?', 'subscription' ); ?></h3> |
| 149 |
<p style="font-size:14px;margin:0 0 8px 0;"> |
| 150 |
<?php esc_html_e( 'If you\'re having trouble with a payment gateway, our support team can help.', 'subscription' ); ?> |
| 151 |
</p> |
| 152 |
<a href="https://wpsubscription.co/contact" target="_blank" class="button button-small" style="font-size:13px;padding:5px 14px;"> |
| 153 |
<?php esc_html_e( 'Get Support', 'subscription' ); ?> |
| 154 |
</a> |
| 155 |
</div> |
| 156 |
</div> |
| 157 |
</div> |
| 158 |
|
| 159 |
</div> |
| 160 |
|