Skip to content

Commit

Permalink
Support EBICS TS mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-svirin committed Jan 17, 2024
1 parent 234b3fa commit 46f62b6
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Factories/RequestFactoryV24.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ protected function addOrderType(
$orderAttribute = OrderDetailsBuilder::ORDER_ATTRIBUTE_DZNNN;
break;
case 'FUL':
$orderAttribute = OrderDetailsBuilder::ORDER_ATTRIBUTE_OZHNN;
$orderAttribute = $this->bank->usesUploadWithES() ?
OrderDetailsBuilder::ORDER_ATTRIBUTE_OZHNN : OrderDetailsBuilder::ORDER_ATTRIBUTE_DZHNN;
break;
default:
$orderAttribute = OrderDetailsBuilder::ORDER_ATTRIBUTE_DZHNN;
Expand Down
3 changes: 2 additions & 1 deletion src/Factories/RequestFactoryV25.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ protected function addOrderType(OrderDetailsBuilder $orderDetailsBuilder, string
case 'XE2':
case 'XE3':
case 'CIP':
$orderAttribute = OrderDetailsBuilder::ORDER_ATTRIBUTE_OZHNN;
$orderAttribute = $this->bank->usesUploadWithES() ?
OrderDetailsBuilder::ORDER_ATTRIBUTE_OZHNN : OrderDetailsBuilder::ORDER_ATTRIBUTE_DZHNN;
break;
case 'HVE':
$orderAttribute = OrderDetailsBuilder::ORDER_ATTRIBUTE_UZHNN;
Expand Down
36 changes: 33 additions & 3 deletions src/Models/Bank.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,19 @@ final class Bank
*/
private string $url;

private ?bool $isCertified;
/**
* Uses certificate.
*
* @var bool
*/
private bool $isCertified = false;

/**
* Uses upload orders with ES.
*
* @var bool
*/
private bool $usesUploadWithES = true;

/**
* The Server Name of the bank.
Expand All @@ -34,7 +46,7 @@ final class Bank
/**
* The Server Version of the bank.
*/
private ?string $version;
private string $version;

/**
* Constructor.
Expand Down Expand Up @@ -83,7 +95,25 @@ public function setIsCertified(bool $isCertified): void
*/
public function isCertified(): bool
{
return (bool)$this->isCertified;
return $this->isCertified;
}

/**
* @param bool $usesUploadWithES
*
* @return void
*/
public function setUsesUploadWithES(bool $usesUploadWithES): void
{
$this->usesUploadWithES = $usesUploadWithES;
}

/**
* @return bool
*/
public function usesUploadWithES(): bool
{
return $this->usesUploadWithES;
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/AbstractEbicsTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private function setupClient(
$credentials = $this->credentialsDataProvider($credentialsId);

$bank = new Bank($credentials['hostId'], $credentials['hostURL'], $version);
$bank->setUsesUploadWithES(true);
$bank->setIsCertified($credentials['hostIsCertified']);
$bank->setServerName(sprintf('Server %d', $credentialsId));
$user = new User($credentials['partnerId'], $credentials['userId']);
Expand Down

0 comments on commit 46f62b6

Please sign in to comment.