Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation for schema namespace definition like SDD #188

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function __construct()
* least for 15 days. Used for rejecting duplicated transactions (max length: 35 characters)
* @param string|null $paymentReference Overwrite default payment reference -
* visible on creditors bank statement (max length: 35 characters)
* @param string $schema default namespace schema urn:iso:std:iso:20022:tech:xsd:pain.001.001.03
* @return $this
*/
public function createInstance(
Expand All @@ -46,13 +47,14 @@ public function createInstance(
DateTime $executionDate = null,
bool $batchBooking = true,
string $msgId = null,
string $paymentReference = null
string $paymentReference = null,
string $schema = 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03'
): CustomerCreditTransferBuilder {
$this->instance = new CustomerCreditTransfer();
$now = new DateTime();

$xmDocument = $this->instance->createElementNS(
'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03',
$schema,
'Document'
);
$xmDocument->setAttributeNS(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct()
* you request your credit institution to book each transaction within this order separately.
* @param string|null $msgId
* @param string|null $paymentReference
* @param string $schema default namespace schema urn:iso:std:iso:20022:tech:xsd:pain.001.001.03
* @return CustomerInstantCreditTransferBuilder
*/
public function createInstance(
Expand All @@ -43,13 +44,14 @@ public function createInstance(
string $debitorName,
bool $batchBooking = true,
string $msgId = null,
string $paymentReference = null
string $paymentReference = null,
string $schema = 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03'
): CustomerInstantCreditTransferBuilder {
$this->instance = new CustomerCreditTransfer();
$now = new DateTime();

$xmDocument = $this->instance->createElementNS(
'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03',
$schema,
'Document'
);
$xmDocument->setAttributeNS(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ public function __construct()
}

/**
* @param string $schema has next formula urn:iso:std:iso:20022:tech:xsd:msgName.001.msgNameVersion
* @param string $debitorFinInstBIC
* @param string $debitorIBAN
* @param string $debitorName
* @param string $schema default namespace schema urn:iso:std:iso:20022:tech:xsd:pain.001.001.03
*
* @return $this
* @throws \DOMException
*/
public function createInstance(
string $schema,
string $debitorFinInstBIC,
string $debitorIBAN,
string $debitorName
string $debitorName,
string $schema = 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03'
): CustomerSwissCreditTransferBuilder {
$this->instance = new CustomerCreditTransfer();
$now = new DateTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function __construct()
}

/**
* @param string $schema has next formula urn:iso:std:iso:20022:tech:xsd:msgName.001.msgNameVersion
* @param string $creditorFinInstBic
* @param string $creditorIban
* @param string $creditorName
Expand All @@ -40,12 +39,12 @@ public function __construct()
* least for 15 days. Used for rejecting duplicated transactions (max length: 35 characters)
* @param string|null $paymentReference Overwrite default payment reference -
* visible on creditors bank statement (max length: 35 characters)
* @param string $schema default namespace schema urn:iso:std:iso:20022:tech:xsd:pain.008.001.02
*
* @return $this
* @throws \DOMException
*/
public function createInstance(
string $schema,
string $creditorFinInstBic,
string $creditorIban,
string $creditorName,
Expand All @@ -54,7 +53,8 @@ public function createInstance(
DateTime $collectionDate = null,
bool $batchBooking = true,
string $msgId = null,
string $paymentReference = null
string $paymentReference = null,
string $schema = 'urn:iso:std:iso:20022:tech:xsd:pain.008.001.02'
): CustomerDirectDebitBuilder {
$this->instance = new CustomerDirectDebit();
$now = new DateTime();
Expand Down
6 changes: 5 additions & 1 deletion src/Factories/DocumentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
*/
final class DocumentFactory
{
/**
* @param string $content requires already UTF-8 encoded content
* @return Document
*/
public function create(string $content): Document
{
$document = new Document();
$document->loadXML(utf8_encode($content));
$document->loadXML($content);

return $document;
}
Expand Down
Loading