<?php include_once "class.sepa.php"; if (isset($_GET['act'])) { if ($_GET['act'] == "start" && $_FILES['Datei']['name'] != "") { //var_dump($_FILES); if ($_FILES['Datei']['size'] <= "1500000") { $obj = new Sepa(); $obj->setFileArray($_FILES['Datei']['tmp_name'], $_FILES['Datei']['name']); $obj->setMessageID(); $obj->setFileCreationDate(); $obj->setCreditorID($_POST["CredId"]); $obj->setCreditorName($_POST["Creditor"]); if (isset($_POST['batch'])) { $obj->setBatchBooking("false"); } $obj->setUsage($_POST["vwz"]); $obj->setSequence($_POST["seq"]); $obj->setDueDate($_POST["exDate"]); $obj->setCreditorNmb($_POST["CreditorIban"]); $obj->setCreditorBic($_POST["CreditorBIC"]); $obj->setFirstRow("1"); $obj->setXMLHeader(); $obj->setXMLTransactions(); $obj->setXMLFooter(); $temp = $obj->getXMLHeader() . $obj->getXMLTransactions() . $obj->getXMLFooter(); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"SEPA-Lastschrift-Core1.xml\""); header("Content-Length: " . strlen($temp)); echo $obj->getXMLHeader() . $obj->getXMLTransactions() . $obj->getXMLFooter(); exit;
/** * Calls the correct XML reader function depending on its type * * @param \SimpleXMLElement $xml * @param BitScout\Sepa\Statement $statement * @param string $filename */ private static function readXML($xml, $statement, $filename = null) { // Check what type of CAMT file this is $xmlNamespace = $xml->getDocNamespaces()['']; if (strpos($xmlNamespace, 'camt.052') !== false) { Sepa::readC52($xml, $statement, $filename); } else { return null; } }
<?php require_once "/src/Bluemove/SepaDirectDebits/Sepa.php"; $config = array("name" => "Test", "IBAN" => "NL41BANK1234567890", "batch" => True, "creditor_id" => "00000", "currency" => "EUR", "version" => "3"); $payment = array("name" => "Test von Testenstein", "IBAN" => "NL41BANK1234567890", "amount" => "1000", "type" => "FRST", "collection_date" => date("Y-m-d"), "mandate_id" => "1234", "mandate_date" => date("2014-02-01"), "description" => "Test transaction"); try { $SEPASDD = new Sepa($config); $SEPASDD->addPayment($payment); $xml = $SEPASDD->save(); if ($SEPASDD->validate($xml)) { print_r($xml); } else { print_r($SEPASDD->validate($xml)); } print_r($SEPASDD->getDirectDebitInfo()); } catch (Exception $e) { echo $e->getMessage(); exit; }