Skip to content

Commit

Permalink
Add support for intermediary agents
Browse files Browse the repository at this point in the history
  • Loading branch information
z38 committed Apr 19, 2016
1 parent 6c66750 commit 0a5bebe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 0.X.X (2016-XX-XX)

* Added support for general account identifiers.
* Added support for intermediary transaction agents.

## 0.3.0 (2016-01-01)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class ForeignCreditTransfer extends CreditTransfer
*/
protected $creditorAgent;

/**
* @var BIC
*/
protected $intermediaryAgent;

/**
* {@inheritdoc}
*
Expand All @@ -44,13 +49,29 @@ public function __construct($instructionId, $endToEndId, Money $amount, $credito
$this->creditorAgent = $creditorAgent;
}

/**
* Set the intermediary agent of the transaction.
*
* @param BIC $intermediaryAgent BIC of the intmediary agent
*/
public function setIntermediaryAgent(BIC $intermediaryAgent)
{
$this->intermediaryAgent = $intermediaryAgent;
}

/**
* {@inheritdoc}
*/
public function asDom(DOMDocument $doc, PaymentInformation $paymentInformation)
{
$root = $this->buildHeader($doc, $paymentInformation);

if ($this->intermediaryAgent !== null) {
$intermediaryAgent = $doc->createElement('IntrmyAgt1');
$intermediaryAgent->appendChild($this->intermediaryAgent->asDom($doc));
$root->appendChild($intermediaryAgent);
}

$creditorAgent = $doc->createElement('CdtrAgt');
$creditorAgent->appendChild($this->creditorAgent->asDom($doc));
$root->appendChild($creditorAgent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ protected function buildMessage()
new GeneralAccount('123-4567890-78'),
new FinancialInstitutionAddress('Belfius Bank', new UnstructuredPostalAddress('Pachecolaan 44', '1000 Brussel', 'BE'))
);
$transaction8->setIntermediaryAgent(new BIC('SWHQBEBB'));

$transaction9 = new SEPACreditTransfer(
'instr-009',
Expand Down

0 comments on commit 0a5bebe

Please sign in to comment.