Skip to content

Commit

Permalink
Using bundled IBAN library
Browse files Browse the repository at this point in the history
  • Loading branch information
hubipe committed Mar 30, 2022
1 parent d0f37e5 commit f792d27
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 178 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
"require": {
"php": "^7.3|^8.0",
"ext-mbstring": "*",
"rikudou/qr-payment-interface": "^1.0",
"rikudou/qr-payment-qr-code-provider": "^1.0"
"rikudou/iban": "^1.1",
"rikudou/qr-payment-interface": "^1.1",
"rikudou/qr-payment-qr-code-provider": "^1.1"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 4 additions & 3 deletions src/Iban/HungarianBbanAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
use hubipe\HuQrPayment\Exceptions\InvalidBbanException;
use hubipe\HuQrPayment\Helper\ToStringIban;
use hubipe\HuQrPayment\Helper\Utils;
use hubipe\HuQrPayment\Iban\Validator\CompoundValidator;
use hubipe\HuQrPayment\Iban\Validator\GenericIbanValidator;
use hubipe\HuQrPayment\Iban\Validator\HungarianIbanValidator;
use hubipe\HuQrPayment\Iban\Validator\ValidatorInterface;
use Rikudou\Iban\Iban\IbanInterface;
use Rikudou\Iban\Validator\CompoundValidator;
use Rikudou\Iban\Validator\GenericIbanValidator;
use Rikudou\Iban\Validator\ValidatorInterface;

class HungarianBbanAdapter implements IbanInterface
{
Expand Down
42 changes: 0 additions & 42 deletions src/Iban/IBAN.php

This file was deleted.

29 changes: 0 additions & 29 deletions src/Iban/IbanInterface.php

This file was deleted.

31 changes: 0 additions & 31 deletions src/Iban/Validator/CompoundValidator.php

This file was deleted.

56 changes: 0 additions & 56 deletions src/Iban/Validator/GenericIbanValidator.php

This file was deleted.

2 changes: 2 additions & 0 deletions src/Iban/Validator/HungarianIbanValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace hubipe\HuQrPayment\Iban\Validator;

use Rikudou\Iban\Validator\ValidatorInterface;

/**
* @see https://www.ecbs.org/Download/Tr201v3.9.pdf
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Iban/Validator/ValidatorInterface.php

This file was deleted.

14 changes: 7 additions & 7 deletions src/QrPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
use hubipe\HuQrPayment\Exceptions\InvalidIbanException;
use hubipe\HuQrPayment\Exceptions\InvalidOptionException;
use hubipe\HuQrPayment\Helper\Utils;
use hubipe\HuQrPayment\Iban\IBAN;
use hubipe\HuQrPayment\Iban\IbanInterface;
use InvalidArgumentException;
use LogicException;
use Rikudou\Iban\Iban\IBAN;
use Rikudou\Iban\Iban\IbanInterface;
use Rikudou\QrPayment\QrPaymentInterface;
use Rikudou\QrPaymentQrCodeProvider\GetQrCodeTrait;

Expand Down Expand Up @@ -126,7 +126,7 @@ public function __construct($iban, ?ConfigurationInterface $configuration = NULL
$configuration = new Configuration();
}
$this->iban = $iban;
$this->expiration = new \DateTimeImmutable('9999-12-31T23:59:59', new \DateTimeZone('Europe/Budapest'));
$this->dueDate = new \DateTimeImmutable('9999-12-31T23:59:59', new \DateTimeZone('Europe/Budapest'));
$this->configuration = $configuration;
}

Expand Down Expand Up @@ -247,7 +247,7 @@ public function setCurrency(string $currency)

public function getDueDate(): \DateTimeInterface
{
return $this->expiration;
return $this->dueDate;
}

/**
Expand All @@ -259,7 +259,7 @@ public function setDueDate(\DateTimeInterface $dueDate)
if ($dueDate instanceof \DateTime) {
$dueDate = \DateTimeImmutable::createFromMutable($dueDate);
}
$this->expiration = $dueDate;
$this->dueDate = $dueDate;
return $this;
}

Expand Down Expand Up @@ -427,8 +427,8 @@ public function getQrString(): string
$localTimeZone = new \DateTimeZone('Europe/Budapest');
$dueDate = sprintf(
'%s+%d',
$this->expiration->setTimezone($localTimeZone)->format('YmdHis'),
round($localTimeZone->getOffset($this->expiration) / 3600)
$this->dueDate->setTimezone($localTimeZone)->format('YmdHis'),
round($localTimeZone->getOffset($this->dueDate) / 3600)
);

$result = [];
Expand Down

0 comments on commit f792d27

Please sign in to comment.