Commit f926d56f authored by mattwire's avatar mattwire

Display self-service links in email receipts based on payment processor capabilities

parent f01f6ac0
......@@ -1465,6 +1465,9 @@ abstract class CRM_Core_Payment {
// Set URL
switch ($action) {
case 'cancel':
if (!$this->supports('cancelRecurring')) {
return NULL;
}
$url = 'civicrm/contribute/unsubscribe';
break;
......@@ -1477,6 +1480,9 @@ abstract class CRM_Core_Payment {
break;
case 'update':
if (!$this->supports('changeSubscriptionAmount') && !$this->supports('editRecurringContribution')) {
return NULL;
}
$url = 'civicrm/contribute/updaterecur';
break;
}
......
......@@ -198,4 +198,14 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment {
return array('amount', 'next_sched_contribution_date');
}
/**
* @param string $message
* @param array $params
*
* @return bool|object
*/
public function cancelSubscription(&$message = '', $params = array()) {
return TRUE;
}
}
......@@ -89,6 +89,19 @@ class CRM_Upgrade_Incremental_MessageTemplates {
'templates' => [
['name' => 'contribution_invoice_receipt', 'type' => 'html'],
]
],
[
'version' => '5.10.alpha1',
'upgrade_descriptor' => ts('Show recurring cancel/update URLs in receipt based on payment processor capabilities'),
'label' => ts('Receipts - cancel/update subscription URLs'),
'templates' => [
['name' => 'contribution_online_receipt', 'type' => 'text'],
['name' => 'contribution_online_receipt', 'type' => 'html'],
['name' => 'contribution_recurring_notify', 'type' => 'text'],
['name' => 'contribution_recurring_notify', 'type' => 'html'],
['name' => 'membership_online_receipt', 'type' => 'text'],
['name' => 'membership_online_receipt', 'type' => 'html'],
]
]
];
}
......
......@@ -189,27 +189,30 @@
</tr>
{/if}
{if $is_recur}
{if $contributeMode eq 'notify' or $contributeMode eq 'directIPN'}
<tr>
{if $is_recur}
<tr>
<td colspan="2" {$labelStyle}>
{ts 1=$cancelSubscriptionUrl}This is a recurring contribution. You can cancel future contributions by <a href="%1">visiting this web page</a>.{/ts}
</td>
{if $updateSubscriptionBillingUrl}
</tr>
<tr>
<td colspan="2" {$labelStyle}>
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
</td>
{/if}
</tr>
<tr>
<td colspan="2" {$labelStyle}>
{ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
{ts}This is a recurring contribution.{/ts}
{if $cancelSubscriptionUrl}
{ts 1=$cancelSubscriptionUrl}You can cancel future contributions by <a href="%1">visiting this web page</a>.{/ts}
{/if}
</td>
</tr>
</tr>
{if $updateSubscriptionBillingUrl}
<tr>
<td colspan="2" {$labelStyle}>
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
</td>
</tr>
{/if}
{/if}
{if $updateSubscriptionUrl}
<tr>
<td colspan="2" {$labelStyle}>
{ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
</td>
</tr>
{/if}
{/if}
{if $honor_block_is_active}
<tr>
......
......@@ -65,21 +65,29 @@
{ts}Transaction #{/ts}: {$trxn_id}
{/if}
{if $is_recur and ($contributeMode eq 'notify' or $contributeMode eq 'directIPN')}
{ts}This is a recurring contribution. You can cancel future contributions at:{/ts}
{if $is_recur}
{ts}This is a recurring contribution.{/ts}
{if $cancelSubscriptionUrl}
{ts}You can cancel future contributions at:{/ts}
{$cancelSubscriptionUrl}
{/if}
{if $updateSubscriptionBillingUrl}
{ts}You can update billing details for this recurring contribution at:{/ts}
{$updateSubscriptionBillingUrl}
{/if}
{if $updateSubscriptionUrl}
{ts}You can update recurring contribution amount or change the number of installments for this recurring contribution at:{/ts}
{$updateSubscriptionUrl}
{/if}
{/if}
{if $honor_block_is_active}
......
......@@ -37,11 +37,13 @@
<p>{ts 1=$recur_frequency_interval 2=$recur_frequency_unit}This membership will be automatically renewed every %1 %2(s). {/ts}</p>
</td>
</tr>
{if $cancelSubscriptionUrl}
<tr>
<td {$labelStyle}>
{ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
</td>
<td {$labelStyle}>
{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
</td>
</tr>
{/if}
{if $updateSubscriptionBillingUrl}
<tr>
<td {$labelStyle}>
......@@ -57,23 +59,27 @@
<p>{ts}Start Date{/ts}: {$recur_start_date|crmDate}</p>
</td>
</tr>
{if $cancelSubscriptionUrl}
<tr>
<td {$labelStyle}>
{ts 1=$cancelSubscriptionUrl} You can cancel the recurring contribution option by <a href="%1">visiting this web page</a>.{/ts}
{ts 1=$cancelSubscriptionUrl} You can cancel the recurring contribution option by <a href="%1">visiting this web page</a>.{/ts}
</td>
</tr>
{/if}
{if $updateSubscriptionBillingUrl}
<tr>
<td {$labelStyle}>
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
</td>
</tr>
{/if}
{if $updateSubscriptionUrl}
<tr>
<td {$labelStyle}>
{ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
{ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
</td>
</tr>
</tr>
{/if}
{/if}
{elseif $recur_txnType eq 'END'}
......
......@@ -7,7 +7,10 @@
{ts 1=$recur_frequency_interval 2=$recur_frequency_unit}This membership will be automatically renewed every %1 %2(s).{/ts}
{ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
{if $cancelSubscriptionUrl}
{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
{/if}
{if $updateSubscriptionBillingUrl}
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by <a href="%1">visiting this web page</a>.{/ts}
......@@ -21,13 +24,20 @@
{ts}Start Date{/ts}: {$recur_start_date|crmDate}
{if $cancelSubscriptionUrl}
{ts 1=$cancelSubscriptionUrl}You can cancel the recurring contribution option by <a href="%1">visiting this web page</a>.{/ts}
{/if}
{if $updateSubscriptionBillingUrl}
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
{/if}
{if $updateSubscriptionUrl}
{ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments for this recurring contribution by <a href="%1">visiting this web page</a>.{/ts}
{/if}
{/if}
{elseif $recur_txnType eq 'END'}
......
......@@ -305,10 +305,12 @@
</tr>
{/if}
{if $is_recur}
{if $contributeMode eq 'notify' or $contributeMode eq 'directIPN'}
<tr>
<td colspan="2" {$labelStyle}>
{ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
{ts}This membership will be renewed automatically.{/ts}
{if $cancelSubscriptionUrl}
{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
{/if}
</td>
</tr>
{if $updateSubscriptionBillingUrl}
......@@ -318,7 +320,6 @@
</td>
</tr>
{/if}
{/if}
{/if}
{if $honor_block_is_active}
......
......@@ -113,14 +113,18 @@
{/if}
{if $is_recur}
{if $contributeMode eq 'notify' or $contributeMode eq 'directIPN'}
{ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by visiting this web page: %1.{/ts}
{ts}This membership will be renewed automatically.{/ts}
{if $cancelSubscriptionUrl}
{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by visiting this web page: %1.{/ts}
{/if}
{if $updateSubscriptionBillingUrl}
{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by <a href="%1">visiting this web page</a>.{/ts}
{/if}
{/if}
{/if}
{if $honor_block_is_active }
===========================================================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment