Skip to content

Commit b873734

Browse files
authored
Merge pull request josemmo#39 from txusms/develop
Añadir código SWIFT/BIC
2 parents fab05a7 + 1d5894b commit b873734

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/Controller/FacturaeExportable.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,11 @@ public function export($filePath=null) {
250250
'<PaymentMeans>' . $this->header['paymentMethod'] . '</PaymentMeans>';
251251
if ($this->header['paymentMethod'] == self::PAYMENT_TRANSFER) {
252252
$xml .= '<AccountToBeCredited>' .
253-
'<IBAN>' . $this->header['paymentIBAN'] . '</IBAN>' .
254-
'</AccountToBeCredited>';
253+
'<IBAN>' . $this->header['paymentIBAN'] . '</IBAN>';
254+
if (!is_null($this->header['paymentBIC'])) {
255+
$xml .= '<BIC>' . $this->header['paymentBIC'] . '</BIC>';
256+
}
257+
$xml .= '</AccountToBeCredited>';
255258
}
256259
$xml .= '</Installment>' .
257260
'</PaymentDetails>';

src/Controller/FacturaeProperties.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ abstract class FacturaeProperties extends FacturaeConstants {
2525
"endDate" => null,
2626
"paymentMethod" => null,
2727
"paymentIBAN" => null,
28+
"paymentBIC" => null,
2829
"description" => null,
2930
"receiverTransactionReference" => null,
3031
"fileReference" => null,
@@ -219,12 +220,15 @@ public function setDates($issueDate, $dueDate=null) {
219220
* Set payment method
220221
* @param string $method Payment method
221222
* @param string|null $iban Bank account in case of bank transfer
223+
* @param string|null $bic SWIFT/BIC code of bank account
222224
* @return Facturae Invoice instance
223225
*/
224-
public function setPaymentMethod($method=self::PAYMENT_CASH, $iban=null) {
226+
public function setPaymentMethod($method=self::PAYMENT_CASH, $iban=null, $bic=null) {
225227
$this->header['paymentMethod'] = $method;
226228
if (!is_null($iban)) $iban = str_replace(" ", "", $iban);
227229
$this->header['paymentIBAN'] = $iban;
230+
if (!is_null($bic)) $bic = str_replace(" ", "", $bic);
231+
$this->header['paymentBIC'] = $bic;
228232
return $this;
229233
}
230234

@@ -246,6 +250,13 @@ public function getPaymentIBAN() {
246250
return $this->header['paymentIBAN'];
247251
}
248252

253+
/**
254+
* Get payment BIC
255+
* @return string|null Payment bank account BIC
256+
*/
257+
public function getPaymentBIC() {
258+
return $this->header['paymentBIC'];
259+
}
249260

250261
/**
251262
* Set description

0 commit comments

Comments
 (0)