I'm creating a XML file for SEPA Direct Debit.
I'm using https://github.com/dmitrirussu/php-sepa-xml-generator and have the example work ok BUT I don't seem to be able to use it INSIDE A MYSQL WHILE...
I have used composer to install throught composer.json.
EXAMPLE WORKING:
<?php
require 'vendor/autoload.php';
//When you start to generate a SEPA Xml File, need to choose PAIN
$directDebitTransaction = \SEPA\XMLGenerator::PAIN_008_001_02;// For Direct Debit transactions is By Defaut
$sepa = SEPA\Factory\XMLGeneratorFactory::createXmlGeneratorObject($directDebitTransaction)->addXmlMessage(
SEPA\Factory\XMLGeneratorFactory::createXMLMessage()
->setMessageGroupHeader(
SEPA\Factory\XMLGeneratorFactory::createXMLGroupHeader()
->setMessageIdentification(1)
->setInitiatingPartyName('Amazing SRL ???? ыаывпавпва '))
->addMessagePaymentInfo(
SEPA\Factory\XMLGeneratorFactory::createXMLPaymentInfo()
->setPaymentInformationIdentification(6222)
->setSequenceType('RCUR')
->setCreditorAccountIBAN('MD24 AG00 0225 1000 1310 4168')
->setCreditorAccountBIC('AABAFI42')
->setCreditorName('Amazing SRL')
->setCreditorSchemeIdentification('FR07ZZZ519993')
->setRequestedCollectionDate('2013-08-06')
->setAggregatePerMandate(true) //Default Transaction aggregation option = true
/* TRANSACCION - 1 */
->addDirectDebitTransaction( //First transaction
SEPA\Factory\XmlGeneratorFactory::createXMLDirectDebitTransaction()
->setInstructionIdentification(3)
->setEndToEndIdentification(3)
->setInstructedAmount(100.5)
->setDebtorName('Roy SRL')
->setDebitIBAN('FR14 2004 1010 0505 0001 3M02 606')
->setDebitBIC('AABAFI22') //Optional
->setMandateIdentification('SDD000000016PFX0713') //unique Identifier
->setDateOfSignature('2013-08-03')
->setCurrency('EUR')
->setDirectDebitInvoice(122)
)
/* TRANSACCION - 2 */
// ...
/* TRANSACCION - 3 */
// ...
/* TRANSACCION - N */
// ...
)
);
/* this is the part I need to use to REPLACE the transactions parts above */
$mysqli = new mysqli("localhost","root","","test");
if ($result = $mysqli->query("SELECT * FROM test"))
{
while ($data = $result->fetch_object())
{
/*
* here we get the data needed for the addDirectDebitTransaction()
*/
}
}
$result->free();
$mysqli->close();
/* save XML */
$sepa->view()->save(realpath(__DIR__) .'/test.xml');
/* EOF */
As I said, this works but I dont undertand well the namespaces and I'm not able to do such a simple thing...
Help, please...