-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from andrew-svirin/dev
Release 1.2.0
- Loading branch information
Showing
122 changed files
with
5,848 additions
and
4,248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ vendor | |
|
||
# Testing env variables. | ||
envs.local.php | ||
|
||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__.'/src') | ||
->in(__DIR__.'/tests'); | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'@DoctrineAnnotation' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'phpdoc_summary' => false, | ||
'no_superfluous_phpdoc_tags' => true, | ||
'concat_space' => ['spacing' => 'one'], | ||
'native_constant_invocation' => true, | ||
'native_function_invocation' => ['include' => ['@compiler_optimized']], | ||
'ordered_imports' => ['sort_algorithm' => 'alpha'], | ||
]) | ||
->setRiskyAllowed(true) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
11000;EBICS_DOWNLOAD_POSTPROCESS_DONE;The positive acknowledgment of the EBICS response that is sent to the client from the server. | ||
11001;EBICS_DOWNLOAD_POSTPROCESS_SKIPPED;The negative acknowledgment of the EBICS response that is sent to the client from the server. | ||
11101;EBICS_TX_SEGMENT_NUMBER_UNDERRUN;The server terminates the transaction if the client, in an upload transaction, has specified a very high (when compared to the number specified in the initialization phase) number of segments that are to be transmitted to the server. | ||
31001;EBICS_ORDER_PARAMS_IGNORED;The supplied order parameters that are not supported by the bank are ignored. | ||
61001;EBICS_AUTHENTICATION_FAILED;The bank is unable to verify the identification and authentication signature of an EBICS request. | ||
61002;EBICS_INVALID_REQUEST;The received EBICS XML message does not conform to the EBICS specifications. | ||
61099;EBICS_INTERNAL_ERROR;An internal error occurred when processing an EBICS request. | ||
61101;EBICS_TX_RECOVERY_SYNC;If the bank supports transaction recovery, the bank verifies whether an upload transaction can be recovered. The server synchronizes with the client to recover the transaction. | ||
91002;EBICS_INVALID_USER_OR_USER_STATE;Error that results from an invalid combination of user ID or an invalid subscriber state. | ||
91003;EBICS_USER_UNKNOWN;The identification and authentication signature of the technical user is successfully verified but the non-technical subscriber is not known to the bank. | ||
91004;EBICS_INVALID_USER_STATE;The identification and authentication signature of the technical user is successfully verified and the non-technical subscriber is known to the bank, but the user is not in a ’Ready’ state. | ||
91005;EBICS_INVALID_ORDER_TYPE;Upon verification, the bank finds that the order type specified in invalid. | ||
91006;EBICS_UNSUPPORTED_ORDER_TYPE;Upon verification, the bank finds that the order type specified in valid but not supported by the bank. | ||
91007;EBICS_DISTRIBUTED_SIGNATURE_AUTHORISATION_FAILED;Subscriber possesses no authorization of signature for the referenced order in the VEU administration. | ||
91008;EBICS_BANK_PUBKEY_UPDATE_REQUIRED;The bank verifies the hash value sent by the user. If the hash value does not match the current public keys, the bank terminates the transaction initialization. | ||
91009;EBICS_SEGMENT_SIZE_EXCEEDED;If the size of the transmitted order data segment exceeds 1 MB, the transaction is terminated. | ||
91010;EBICS_INVALID_XML;The XML schema does not conform to the EBICS specifications. | ||
91011;EBICS_INVALID_HOST_ID;The transmitted host ID is not known to the bank. | ||
91101;EBICS_TX_UNKNOWN_TXID;The supplied transaction ID is invalid. | ||
91102;EBICS_TX_ABORT;If the bank supports transaction recovery, the bank verifies whether an upload transaction can be recovered. If the transaction cannot be recovered, the bank terminates the transaction. | ||
91103;EBICS_TX_MESSAGE_REPLAY;To avoid replay, the bank compares the received Nonce with the list of nonce values that were received previously and stored locally. If the nonce received is greater than the tolerance period specified by the bank, the response EBICS_TX_MESSAGE_REPLAY is returned. | ||
91104;EBICS_TX_SEGMENT_NUMBER_EXCEEDED;The serial number of the transmitted order data segment must be less than or equal to the total number of data segments that are to be transmitted. The transaction is terminated if the number of transmitted order data segments exceeds the total number of data segments. | ||
91112;EBICS_INVALID_ORDER_PARAMS;In an HVT request, the subscriber specifies the order for which they want to retrieve the VEU transaction details. The HVT request also specifies an offset position in the original order file that marks the starting point of the transaction details to be transmitted. The order details after the specified offset position are returned. If the value specified for offset is higher than the total number of order details, the error EBICS_INVALID_ORDER_PARAMS is returned. | ||
91113;EBICS_INVALID_REQUEST_CONTENT;The EBICS request does not conform to the XML schema definition specified for individual requests. | ||
91117;EBICS_MAX_ORDER_DATA_SIZE_EXCEEDED;The bank does not support the requested order size. | ||
91118;EBICS_MAX_SEGMENTS_EXCEEDED;The submitted number of segments for upload is very high. | ||
91119;EBICS_MAX_TRANSACTIONS_EXCEEDED;The maximum number of parallel transactions per customer is exceeded. | ||
91120;EBICS_PARTNER_ID_MISMATCH;The partner ID of the electronic signature file differs from the partner ID of the submitter. | ||
91121;EBICS_INCOMPATIBLE_ORDER_ATTRIBUTE;The specified order attribute is not compatible with the order in the bank system. If the bank has a file with the attribute DZHNN or other electronic signature files (for example, with the attribute UZHNN) for the same order, then the use of the order attributes DZHNN is not allowed. Also, if the bank already has the same order and the order was transmitted with the order attributes DZHNN, then again the use of the order attributes DZHNN is not allowed. | ||
91219;EBICS_CERTIFICATES_VALIDATION_ERROR;The server is unable to match the certificate with the previously declared information automatically. | ||
11301;EBICS_NO_ONLINE_CHECKS;The bank does not principally support preliminary verification of orders but the EBICS request contains data for preliminary verification of the order. | ||
91001;EBICS_DOWNLOAD_SIGNED_ONLY;The bank system only supports bank-technically signed download order data for the order request. If the subscriber sets the order attributes to DZHNN and requests the download data without the electronic signature of the bank, the transaction initialization is terminated. | ||
90003;EBICS_AUTHORISATION_ORDER_TYPE_FAILED;The subscriber is not entitled to submit orders of the selected order type. If the authorization is missing when the bank verifies whether the subscriber has a bank-technical authorization of signature for the order, the transaction is cancelled. | ||
90004;EBICS_INVALID_ORDER_DATA_FORMAT;The order data does not correspond with the designated format. | ||
90005;EBICS_NO_DOWNLOAD_DATA_AVAILABLE;If the requested download data is not available, the EBICS transaction is terminated. | ||
90006;EBICS_UNSUPPORTED_REQUEST_FOR_ORDER_INSTANCE;In the case of some business transactions, it is not possible to retrieve detailed information of the order data. | ||
91105;EBICS_RECOVERY_NOT_SUPPORTED;If the bank does not support transaction recovery, the upload transaction is terminated. | ||
91111;EBICS_INVALID_SIGNATURE_FILE_FORMAT;The submitted electronic signature file does not conform to the defined format. | ||
91114;EBICS_ORDERID_UNKNOWN;Upon verification, the bank finds that the order is not located in the VEU processing system. | ||
91115;EBICS_ORDERID_ALREADY_EXISTS;The submitted order number already exists. | ||
91116;EBICS_PROCESSING_ERROR;When processing an EBICS request, other business-related errors occurred. | ||
91201;EBICS_KEYMGMT_UNSUPPORTED_VERSION_SIGNATURE;When processing an INI request, the order data contains an inadmissible version of the bank-technical signature process. | ||
91202;EBICS_KEYMGMT_UNSUPPORTED_VERSION_AUTHENTICATION;When processing an HIA request, the order data contains an inadmissible version of the identification and authentication signature process. | ||
91203;EBICS_KEYMGMT_UNSUPPORTED_VERSION_ENCRYPTION;When processing an HIA request, the order data contains an inadmissible version of the encryption process. | ||
91204;EBICS_KEYMGMT_KEYLENGTH_ERROR_SIGNATURE;When processing an INI request, the order data contains an bank-technical key of inadmissible length. | ||
91205;EBICS_KEYMGMT_KEYLENGTH_ERROR_AUTHENTICATION;When processing an HIA request, the order data contains an identification and authentication key of inadmissible length. | ||
91206;EBICS_KEYMGMT_KEYLENGTH_ERROR_ENCRYPTION;When processing an HIA request, the order data contains an encryption key of inadmissible length. | ||
91207;EBICS_KEYMGMT_NO_X509_SUPPORT;A public key of type X509 is sent to the bank but the bank supports only public key value type. | ||
91208;EBICS_X509_CERTIFICATE_EXPIRED;The certificate is not valid because it has expired. | ||
91209;EBICS_X509_CERTIFICATE_NOT_VALID_YET;The certificate is not valid because it is not yet in effect. | ||
91210;EBICS_X509_WRONG_KEY_USAGE;When verifying the certificate key usage, the bank detects that the certificate is not issued for current use. | ||
91211;EBICS_X509_WRONG_ALGORITHM;When verifying the certificate algorithm, the bank detects that the certificate is not issued for current use. | ||
91212;EBICS_X509_INVALID_THUMBPRINT;The thumb print does not correspond to the certificate. | ||
91213;EBICS_X509_CTL_INVALID;When verifying the certificate, the bank detects that the certificate trust list (CTL) is not valid. | ||
91214;EBICS_X509_UNKNOWN_CERTIFICATE_AUTHORITY;The chain cannot be verified because of an unknown certificate authority (CA). | ||
91215;EBICS_X509_INVALID_POLICY;The certificate has invalid policy when determining certificate verification. | ||
91216;EBICS_X509_INVALID_BASIC_CONSTRAINTS;The basic constraints are not valid when determining certificate verification. | ||
91217;EBICS_ONLY_X509_SUPPORT;The bank supports evaluation of X.509 data only. | ||
91218;EBICS_KEYMGMT_DUPLICATE_KEY;The key sent for authentication or encryption is the same as the signature key. | ||
91301;EBICS_SIGNATURE_VERIFICATION_FAILED;Verification of the electronic signature has failed. | ||
91302;EBICS_ACCOUNT_AUTHORISATION_FAILED;Preliminary verification of the account authorization has failed. | ||
91303;EBICS_AMOUNT_CHECK_FAILED;Preliminary verification of the account amount limit has failed. | ||
91304;EBICS_SIGNER_UNKNOWN;The signatory of the order is not a valid subscriber. | ||
91305;EBICS_INVALID_SIGNER_STATE;The state of the signatory is not admissible. | ||
91306;EBICS_DUPLICATE_SIGNATURE;The signatory has already signed the order. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
$exceptionTemplate = <<<EOF | ||
<?php | ||
namespace AndrewSvirin\Ebics\Exceptions; | ||
/** | ||
* %exceptionClassName% used for %errorCode% EBICS error | ||
* | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Guillaume Sainthillier | ||
*/ | ||
class %exceptionClassName% extends EbicsResponseException | ||
{ | ||
public function __construct(?string \$responseMessage = null) | ||
{ | ||
parent::__construct('%errorCode%', \$responseMessage, '%errorMeaning%'); | ||
} | ||
} | ||
EOF; | ||
|
||
$exceptionsDestinationDirectory = __DIR__ . '/../src/Exceptions'; | ||
$errorCodesFile = fopen(__DIR__ . '/datas/error_codes.csv', 'r'); | ||
$exceptionMapping = []; | ||
while (false !== ($datas = fgetcsv($errorCodesFile, 4096, ";"))) { | ||
$exceptionClassName = sprintf('%sException', camelize(str_replace('EBICS_', '', $datas[1]))); | ||
$exceptionCode = str_pad($datas[0], 6, STR_PAD_LEFT, '0'); | ||
$exceptionTemplateContent = str_replace('%exceptionClassName%', $exceptionClassName, $exceptionTemplate); | ||
$exceptionTemplateContent = str_replace('%errorCode%', $exceptionCode, $exceptionTemplateContent); | ||
$exceptionTemplateContent = str_replace('%errorMeaning%', escapeArgument($datas[2]), $exceptionTemplateContent); | ||
|
||
file_put_contents(sprintf('%s/%s.php', $exceptionsDestinationDirectory, $exceptionClassName), $exceptionTemplateContent); | ||
$exceptionMapping[] = sprintf("'%s' => %s::class", $exceptionCode, $exceptionClassName); | ||
} | ||
|
||
fclose($errorCodesFile); | ||
|
||
|
||
$exceptionMappingTemplate = <<<EOF | ||
<?php | ||
namespace AndrewSvirin\Ebics\Exceptions; | ||
/** | ||
* Mapping class between error code and exception classes. @see \AndrewSvirin\Ebics\Factories\EbicsExceptionFactory | ||
* | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Guillaume Sainthillier | ||
*/ | ||
abstract class EbicsErrorCodeMapping | ||
{ | ||
public static \$mapping = [ | ||
%exceptionMapping% | ||
]; | ||
} | ||
EOF; | ||
|
||
$exceptionMappingContent = str_replace('%exceptionMapping%', implode(",\n\t\t", $exceptionMapping), $exceptionMappingTemplate); | ||
file_put_contents(sprintf('%s/EbicsErrorCodeMapping.php', $exceptionsDestinationDirectory), $exceptionMappingContent); | ||
|
||
function camelize($input, $separator = '_') | ||
{ | ||
return str_replace($separator, '', ucwords(strtolower($input), $separator)); | ||
} | ||
|
||
function escapeArgument($input) | ||
{ | ||
return str_replace("'", "\'", $input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
<?php | ||
|
||
namespace AndrewSvirin\Ebics\Contracts; | ||
|
||
/** | ||
* EBICS CertificateInterface representation. | ||
* | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Andrew Svirin | ||
*/ | ||
interface CertificateInterface | ||
{ | ||
|
||
const TYPE_A = 'A'; | ||
const TYPE_X = 'X'; | ||
const TYPE_E = 'E'; | ||
|
||
} | ||
<?php | ||
|
||
namespace AndrewSvirin\Ebics\Contracts; | ||
|
||
/** | ||
* EBICS CertificateInterface representation. | ||
* | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Andrew Svirin | ||
*/ | ||
interface CertificateInterface | ||
{ | ||
const TYPE_A = 'A'; | ||
const TYPE_X = 'X'; | ||
const TYPE_E = 'E'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,86 @@ | ||
<?php | ||
|
||
namespace AndrewSvirin\Ebics\Contracts; | ||
|
||
use AndrewSvirin\Ebics\Models\Response; | ||
use DateTime; | ||
|
||
/** | ||
* EBICS client representation. | ||
* | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Andrew Svirin | ||
*/ | ||
interface EbicsClientInterface | ||
{ | ||
|
||
/** | ||
* Supported protocol version for the Bank. | ||
* @return Response | ||
*/ | ||
function HEV(): Response; | ||
|
||
/** | ||
* Make INI request. | ||
* Send to the bank public certificate of signature A006. | ||
* Prepare A006 certificates for KeyRing. | ||
* @param DateTime|null $dateTime Current date. | ||
* @return Response | ||
*/ | ||
function INI(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Make HIA request. | ||
* Send to the bank public certificates of authentication (X002) and encryption (E002). | ||
* Prepare E002 and X002 user certificates for KeyRing. | ||
* @param DateTime|null $dateTime Current date. | ||
* @return Response | ||
*/ | ||
function HIA(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve the Bank public certificates authentication (X002) and encryption (E002). | ||
* Decrypt OrderData. | ||
* Prepare E002 and X002 bank certificates for KeyRing. | ||
* @param DateTime|null $dateTime Current date. | ||
* @return Response | ||
*/ | ||
function HPB(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve the bank server parameters. | ||
* @param DateTime|null $dateTime | ||
* @return Response | ||
*/ | ||
public function HPD(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve Bank available order types. | ||
* @param DateTime|null $dateTime Current date. | ||
* @return Response | ||
*/ | ||
function HAA(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Downloads the interim transaction report in SWIFT format (MT942). | ||
* @param DateTime|null $dateTime Current date. | ||
* @param DateTime|null $startDateTime The start date of requested transactions. | ||
* @param DateTime|null $endDateTime The end date of requested transactions. | ||
* @return Response | ||
*/ | ||
function VMK(DateTime $dateTime = null, DateTime $startDateTime = null, DateTime $endDateTime = null): Response; | ||
|
||
/** | ||
* Retrieve the bank account statement. | ||
* @param DateTime|null $dateTime | ||
* @param DateTime|null $startDateTime The start date of requested transactions. | ||
* @param DateTime|null $endDateTime The end date of requested transactions. | ||
* @return Response | ||
*/ | ||
function STA(DateTime $dateTime = null, DateTime $startDateTime = null, DateTime $endDateTime = null): Response; | ||
|
||
} | ||
<?php | ||
|
||
namespace AndrewSvirin\Ebics\Contracts; | ||
|
||
use AndrewSvirin\Ebics\Models\Response; | ||
use DateTime; | ||
|
||
/** | ||
* EBICS client representation. | ||
* | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @author Andrew Svirin | ||
*/ | ||
interface EbicsClientInterface | ||
{ | ||
/** | ||
* Supported protocol version for the Bank. | ||
*/ | ||
public function HEV(): Response; | ||
|
||
/** | ||
* Make INI request. | ||
* Send to the bank public certificate of signature A006. | ||
* Prepare A006 certificates for KeyRing. | ||
* | ||
* @param DateTime|null $dateTime current date | ||
*/ | ||
public function INI(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Make HIA request. | ||
* Send to the bank public certificates of authentication (X002) and encryption (E002). | ||
* Prepare E002 and X002 user certificates for KeyRing. | ||
* | ||
* @param DateTime|null $dateTime current date | ||
*/ | ||
public function HIA(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve the Bank public certificates authentication (X002) and encryption (E002). | ||
* Decrypt OrderData. | ||
* Prepare E002 and X002 bank certificates for KeyRing. | ||
* | ||
* @param DateTime|null $dateTime current date | ||
*/ | ||
public function HPB(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve the bank server parameters. | ||
*/ | ||
public function HPD(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve customer's customer and subscriber information. | ||
*/ | ||
public function HKD(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve subscriber's customer and subscriber information. | ||
*/ | ||
public function HTD(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Retrieve Bank available order types. | ||
* | ||
* @param DateTime|null $dateTime current date | ||
*/ | ||
public function HAA(DateTime $dateTime = null): Response; | ||
|
||
/** | ||
* Downloads the interim transaction report in SWIFT format (MT942). | ||
* | ||
* @param DateTime|null $dateTime current date | ||
* @param DateTime|null $startDateTime the start date of requested transactions | ||
* @param DateTime|null $endDateTime the end date of requested transactions | ||
*/ | ||
public function VMK(DateTime $dateTime = null, DateTime $startDateTime = null, DateTime $endDateTime = null): Response; | ||
|
||
/** | ||
* Retrieve the bank account statement. | ||
* | ||
* @param DateTime|null $startDateTime the start date of requested transactions | ||
* @param DateTime|null $endDateTime the end date of requested transactions | ||
*/ | ||
public function STA(DateTime $dateTime = null, DateTime $startDateTime = null, DateTime $endDateTime = null): Response; | ||
} |
Oops, something went wrong.