PHP code example of codehouse / payment-invoice-mapper

1. Go to this page and download the library: Download codehouse/payment-invoice-mapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codehouse / payment-invoice-mapper example snippets


$invoices = new ArrayObject();
while ($item = $query->fetch(PDO::FETCH_ASSOC)) {
    $invoices->append(new YourInvoiceObject($item['amount'], $item['invoiceNo'], $item['orderNo'], $item['referenceNo']))
}

$mapper = new \Mappers\MapperImpl();
try {
    $paidInvoices = $mapper->map($invoices, $_FILE['import']['tmp_name'], 'ISO20022');
    updateInvoices($paidInvoices);
} catch (Exception $e) { .. }

function updateInvoices($invoices) {
    //update Your database here
}

$mapper = new \Mappers\MapperImpl('YourComparatorName', 'YourExtractorName');