Skip to content

Implement proper error message when no default creditor is set #643

@tobiberlin

Description

@tobiberlin

Follow up ticket for #638

When a new SEPA mandate is created but there is no default creditor set for the project there is no proper message what causes the process to fail.

For example:

    $sepaMandateData = [
      'contact_id' => $contactId,
      'type' => 'OOFF',
      'iban' => $iban,
      'amount' => $amount,
      'financial_type_id' => $financialTypeId,
      'creation_date' => $date),
    ];

    $result = civicrm_api3('SepaMandate', 'createfull', $sepaMandateData);

leads under these circumstances to a PHP warning in logs:

Warning: Undefined array key "creditor_id" in civicrm_api3_sepa_mandate_createfull() (line 81 of sites\default\files\civicrm\ext\org.project60.sepa\api\v3\SepaMandate.php).

and to an exception message:

FRST mandate for creditor ID [] disabled, i.e. no valid payment instrument set.

What solves the problem is to define a default creditor but these errors/warnings give not a proper hint for that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions