Skip to content

ING sanitizeDescription update #63

@MrMoronIV

Description

@MrMoronIV

The description of the ING transactions hold more information which is discarded by this parser. For example Direct Debet (automatische incasso) transactions have their desscription next to the PREF identifier. Below is a function that adds this information to the description. Feel free to implement/rewrite this or do nothing with it ;)

    /**
     * Overloaded: ING encapsulates the description with /REMI/ for SEPA.
     *
     * {@inheritdoc}
     */
    protected function sanitizeDescription($string)
    {
        $description = parent::sanitizeDescription($string);
        if (strpos($description, '/PREF/') !== false
                && preg_match('#/PREF/(.*?)/#s', $description, $results) && !empty($results[1])
        ) {
            $description_start = $results[1];
        }
        if (strpos($description, '/EREF/') !== false
                && preg_match('#/EREF/(.*?)/#s', $description, $results) && !empty($results[1])
        ) {
            $description_start = $results[1];
        }
        if (strpos($description, '/REMI/USTD//') !== false
                && preg_match('#/REMI/USTD//(.*?)/$#s', $description, $results) && !empty($results[1])
        ) {
            $description_end = $results[1];
        }
        if (strpos($description, '/REMI/STRD/CUR/') !== false
                && preg_match('#/REMI/STRD/CUR/(.*?)/#s', $description, $results) && !empty($results[1])
        ) {
            $description_end = $results[1];
        }

        return $description_start.' '.$description_end;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions