| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?> |
| 2 |
<?php |
| 3 |
/** |
| 4 |
* @var \FluentCart\App\Models\Order $order |
| 5 |
* @var \FluentCart\App\Models\Subscription $subscription |
| 6 |
* @var string $error Gateway failure reason |
| 7 |
*/ |
| 8 |
|
| 9 |
$paymentMethodText = $subscription->getPaymentMethodText(); |
| 10 |
// getCustomerDashboardUrl() returns a broken relative path ("/subscription/{uuid}") |
| 11 |
// when no customer profile page is configured — only render the CTA when the |
| 12 |
// dashboard base actually exists. |
| 13 |
$updateMethodUrl = (new \FluentCart\Api\StoreSettings())->getCustomerProfilePage() |
| 14 |
? \FluentCart\App\Services\URL::getCustomerDashboardUrl('subscription/' . $subscription->uuid) |
| 15 |
: ''; |
| 16 |
?> |
| 17 |
|
| 18 |
<div class="space_bottom_30"> |
| 19 |
<p> |
| 20 |
<?php |
| 21 |
printf( |
| 22 |
/* translators: %1$s is the customer's full name */ |
| 23 |
esc_html__( 'Hello %1$s,', 'fluent-cart' ), |
| 24 |
esc_html($order->customer->full_name) |
| 25 |
); |
| 26 |
?> |
| 27 |
</p> |
| 28 |
|
| 29 |
<p> |
| 30 |
<?php |
| 31 |
if ($paymentMethodText) { |
| 32 |
printf( |
| 33 |
/* translators: %1$s is the subscription item name, %2$s is the saved payment method (e.g. visa ***4242) */ |
| 34 |
esc_html__( 'We were unable to charge your saved payment method (%2$s) for the renewal of %1$s.', 'fluent-cart' ), |
| 35 |
esc_html( $subscription->item_name ), |
| 36 |
esc_html( $paymentMethodText ) |
| 37 |
); |
| 38 |
} else { |
| 39 |
printf( |
| 40 |
/* translators: %1$s is the subscription item name */ |
| 41 |
esc_html__( 'We were unable to charge your saved payment method for the renewal of %1$s.', 'fluent-cart' ), |
| 42 |
esc_html( $subscription->item_name ) |
| 43 |
); |
| 44 |
} |
| 45 |
?> |
| 46 |
</p> |
| 47 |
|
| 48 |
<?php if (!empty($error)): ?> |
| 49 |
<p> |
| 50 |
<?php |
| 51 |
printf( |
| 52 |
/* translators: %1$s is the payment failure reason reported by the payment provider */ |
| 53 |
esc_html__( 'Reason: %1$s', 'fluent-cart' ), |
| 54 |
'<em>' . esc_html( $error ) . '</em>' |
| 55 |
); |
| 56 |
?> |
| 57 |
</p> |
| 58 |
<?php endif; ?> |
| 59 |
|
| 60 |
<p> |
| 61 |
<?php |
| 62 |
if ($updateMethodUrl) { |
| 63 |
esc_html_e( 'We will automatically retry the charge. You can update your payment method from your account if it has changed.', 'fluent-cart' ); |
| 64 |
} else { |
| 65 |
esc_html_e( 'We will automatically retry the charge.', 'fluent-cart' ); |
| 66 |
} |
| 67 |
?> |
| 68 |
</p> |
| 69 |
</div> |
| 70 |
|
| 71 |
<?php |
| 72 |
|
| 73 |
\FluentCart\App\App::make('view')->render('emails.parts.items_table', [ |
| 74 |
'order' => $order, |
| 75 |
'formattedItems' => $order->order_items, |
| 76 |
'heading' => __('Renewal Summary', 'fluent-cart'), |
| 77 |
]); |
| 78 |
|
| 79 |
if ($updateMethodUrl) : |
| 80 |
?> |
| 81 |
<p> |
| 82 |
<?php |
| 83 |
printf( |
| 84 |
/* translators: %1$s is an HTML link to the customer's subscription page */ |
| 85 |
esc_html__( 'Card expired or changed? %1$s to replace the payment method we charge automatically.', 'fluent-cart' ), |
| 86 |
'<a href="' . esc_url( $updateMethodUrl ) . '">' . esc_html__( 'Update your payment method', 'fluent-cart' ) . '</a>' |
| 87 |
); |
| 88 |
?> |
| 89 |
</p> |
| 90 |
<?php |
| 91 |
endif; |
| 92 |
|