为单一欧元支付区域(SEPA)信用转账创建XML文件。

0.11.0 2016-12-27 12:47 UTC

This package is not auto-updated.

Last update: 2020-11-09 07:41:45 UTC


README

##该项目已不再维护,请使用 https://github.com/php-sepa-xml/php-sepa-xml

php-sepa-xml

主分支: 构建状态

PHP的SEPA文件生成器。

为单一欧元支付区域(SEPA)信用转账和直接借记创建XML文件。

许可协议:GNU Lesser General Public License v3.0

遵循的规范版本是

  • pain.001.002.03(或pain.001.001.03)用于信用转账
  • pain.008.002.02(或pain.008.001.02)用于借记

应接受此格式的机构和协会

  • 德国信贷经济
  • 法国银行联合会

但是,在开始使用之前,请始终使用您的银行验证生成的文件!

##安装 ###Composer 该库在packagist.org上可用,您可以通过Composer将其添加到项目中。

在composer.json文件的"require"部分

始终是最新的(前沿,API 不保证 稳定)

"digitick/sepa-xml" : "dev-master"

没有命名空间,只有错误修复

"digitick/sepa-xml" : "dev-no_namespace"

特定的较小版本,API稳定性

"digitick/sepa-xml" : "0.10.*"

##示例用法 使用工厂的借记

//Set the initial information
$directDebit = TransferFileFacadeFactory::createDirectDebit('test123', 'Me');

// create a payment, it's possible to create multiple payments,
// "firstPayment" is the identifier for the transactions
$directDebit->addPaymentInfo('firstPayment', array(
	'id' 					=> 'firstPayment',
	'creditorName' 			=> 'My Company',
	'creditorAccountIBAN'	=> 'FI1350001540000056',
	'creditorAgentBIC' 		=> 'PSSTFRPPMON',
	'seqType'				=> PaymentInformation::S_ONEOFF,
	'creditorId'			=> 'DE21WVM1234567890'
));
// Add a Single Transaction to the named payment
$directDebit->addTransfer('firstPayment', array(
	'amount'				=> '500',
	'debtorIban'			=> 'FI1350001540000056',
	'debtorBic'				=> 'OKOYFIHH',
	'debtorName'			=> 'Their Company',
	'debtorMandate'			=>  'AB12345',
	'debtorMandateSignDate'	=> '13.10.2012',
	'remittanceInformation'	=> 'Purpose of this direct debit'
));
// Retrieve the resulting XML
$directDebit->asXML();

##扩展用法 信用转账

// Create the initiating information
$groupHeader = new GroupHeader('SEPA File Identifier', 'Your Company Name');
$sepaFile = new CustomerCreditTransferFile($groupHeader);

$transfer = new CustomerCreditTransferInformation(
    '0.02', // Amount
    'FI1350001540000056', //IBAN of creditor
    'Their Corp' //Name of Creditor
);
$transfer->setBic('OKOYFIHH'); // Set the BIC explicitly
$transfer->setRemittanceInformation('Transaction Description');

// Create a PaymentInformation the Transfer belongs to
$payment = new PaymentInformation(
    'Payment Info ID',
    'FR1420041010050500013M02606', // IBAN the money is transferred from
    'PSSTFRPPMON',  // BIC
    'My Corp' // Debitor Name
);
// It's possible to add multiple Transfers in one Payment
$payment->addTransfer($transfer);

// It's possible to add multiple payments to one SEPA File
$sepaFile->addPaymentInformation($payment);

// Attach a dombuilder to the sepaFile to create the XML output
$domBuilder = DomBuilderFactory::createDomBuilder($sepaFile);

// Or if you want to use the format 'pain.001.001.03' instead
// $domBuilder = DomBuilderFactory::createDomBuilder($sepaFile, 'pain.001.001.03');

$domBuilder->asXml();