[#24] merged issue/24
This commit is contained in:
commit
fe34d09714
6 changed files with 38 additions and 5 deletions
|
@ -28,6 +28,7 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
|
|||
public static $SETTINGS_LIST = [
|
||||
'twingle_prefix',
|
||||
'twingle_use_sepa',
|
||||
'twingle_dont_use_reference',
|
||||
'twingle_protect_recurring',
|
||||
'twingle_protect_recurring_activity_type',
|
||||
'twingle_protect_recurring_activity_subject',
|
||||
|
@ -54,6 +55,12 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
|
|||
E::ts("Use CiviSEPA")
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'checkbox',
|
||||
'twingle_dont_use_reference',
|
||||
E::ts("Use CiviSEPA generated reference")
|
||||
);
|
||||
|
||||
$this->add(
|
||||
'select',
|
||||
'twingle_protect_recurring',
|
||||
|
|
|
@ -150,7 +150,7 @@ function civicrm_api3_twingle_donation_Cancel($params) {
|
|||
|
||||
$result = civicrm_api3_create_success($contribution);
|
||||
}
|
||||
catch (CiviCRM_API3_Exception $exception) {
|
||||
catch (Exception $exception) {
|
||||
$result = civicrm_api3_create_error($exception->getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ function civicrm_api3_twingle_donation_endrecurring($params) {
|
|||
|
||||
$result = civicrm_api3_create_success($contribution);
|
||||
}
|
||||
catch (CiviCRM_API3_Exception $exception) {
|
||||
catch (Exception $exception) {
|
||||
$result = civicrm_api3_create_error($exception->getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -604,6 +604,12 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
|||
// mandate type.
|
||||
unset($mandate_data['payment_instrument_id']);
|
||||
|
||||
// If requested, let CiviSEPA generate the mandate reference
|
||||
$use_own_mandate_reference = Civi::settings()->get('twingle_dont_use_reference');
|
||||
if (!empty($use_own_mandate_reference)) {
|
||||
unset($mandate_data['reference']);
|
||||
}
|
||||
|
||||
// Create the mandate.
|
||||
$mandate = civicrm_api3('SepaMandate', 'createfull', $mandate_data);
|
||||
|
||||
|
@ -707,13 +713,15 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
|||
$recurring_contribution_id = $contribution_id = '';
|
||||
if (isset($contribution_recur['id'])) {
|
||||
$recurring_contribution_id = $contribution_recur['id'];
|
||||
} elseif (!empty($mandate['entity_id']) && $mandate['type'] == 'RCUR') {
|
||||
$recurring_contribution_id = $mandate['entity_id'];
|
||||
}
|
||||
if (isset($contribution['id'])) {
|
||||
$contribution_id = $contribution['id'];
|
||||
}
|
||||
|
||||
// run the call
|
||||
civicrm_api3($pp_entity, $pp_action, [
|
||||
civicrm_api3(trim($pp_entity), trim($pp_action), [
|
||||
'membership_id' => $membership['id'],
|
||||
'contact_id' => $contact_id,
|
||||
'organization_id' => isset($organisation_id) ? $organisation_id : '',
|
||||
|
@ -727,14 +735,16 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
|||
} catch (Exception $ex) {
|
||||
// TODO: more error handling?
|
||||
Civi::log()->debug("Twingle membership postprocessing call {$pp_entity}.{$pp_action} has failed: " . $ex->getMessage());
|
||||
throw new Exception(
|
||||
E::ts("Twingle membership postprocessing call has failed, see log for more information")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$result = civicrm_api3_create_success($result_values);
|
||||
}
|
||||
catch (CiviCRM_API3_Exception $exception) {
|
||||
catch (Exception $exception) {
|
||||
$result = civicrm_api3_create_error($exception->getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
{ts domain="de.systopia.twingle" 1="<a href=\"https://github.com/project60/org.project60.sepa\" target=\"_blank\">CiviSEPA (<kbd>org.project60.sepa</kbd>) extension</a>"}When the %1 is enabled and one of its payment instruments is assigned to a Twingle payment method (practically the <em>debit_manual</em> payment method), submitting a Twingle donation through the API will create a SEPA mandate with the given data.{/ts}
|
||||
{/htxt}
|
||||
|
||||
{htxt id='id-twingle_dont_use_reference'}
|
||||
{ts domain="de.systopia.twingle" 1="<a href=\"https://github.com/project60/org.project60.sepa\" target=\"_blank\">CiviSEPA (<kbd>org.project60.sepa</kbd>) extension</a>"}When the %1 is enabled, you can activate this to use your own references instead of the ones submitted by Twingle.{/ts}
|
||||
{/htxt}
|
||||
|
||||
{htxt id='id-twingle_protect_recurring'}
|
||||
{ts domain="de.systopia.twingle"}Will protect all recurring contributions created by Twingle from termination, since this does NOT terminate the Twingle collection process{/ts}
|
||||
{/htxt}
|
||||
|
|
|
@ -28,6 +28,18 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="crm-twingle-form-block-use-sepa-reference">
|
||||
<td class="label">{$form.twingle_dont_use_reference.label} <a onclick='CRM.help("{$form.twingle_dont_use_reference.label}", {literal}{"id":"id-{/literal}{$form.twingle_dont_use_reference.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
|
||||
<td>
|
||||
{$form.twingle_dont_use_reference.html}
|
||||
<br />
|
||||
<span class="description">
|
||||
{$formElements.twingle_dont_use_reference.description}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr class="crm-twingle-form-block-prefix">
|
||||
<td class="label">{$form.twingle_prefix.label} <a onclick='CRM.help("{$form.twingle_prefix.label}", {literal}{"id":"id-{/literal}{$form.twingle_prefix.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
|
||||
<td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue