Download the PHP package rikudou/euqrpayment without Composer
On this page you can find all versions of the php package rikudou/euqrpayment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rikudou/euqrpayment
More information about rikudou/euqrpayment
Files in rikudou/euqrpayment
Package euqrpayment
Short Description QR payment library for European Union according to EPC standard version 2
License MIT
Homepage https://github.com/RikudouSage/QrPaymentEU
Informations about the package euqrpayment
QR code payment (EU)
Library to generate QR payment codes for European Union (EPC standard, also called GiroCode in Germany). Currently used in Germany, Austria, Netherlands, Finland and Belgium.
See also QR code payment generator for Czech, Slovak or Hungarian accounts
Installation
Via composer: composer require rikudou/euqrpayment
Usage
In the constructor you must supply IBAN which may be a string
or an instance of rikudou\EuQrPayment\Iban\IbanInterface
.
Example with string:
Example with base IBAN class:
The IbanInterface
is useful in case you want to create an
adapter that transforms your local format (BBAN) to IBAN.
This package contains one such class for Czech accounts:
Setting payment details
All payment details can be set via setters:
Exceptions
This library throws LogicException
and InvalidArgumentException
, here is a list of methods
that throw exceptions and the reason for that:
__construct()
-InvalidArgumentException
- if the$iban
parameter is not a string or instance ofrikudou\EuQrPayment\Iban\IbanInterface
setBic()
andsetSwift()
-InvalidArgumentException
- if the BIC is shorter than 8 characters or longer than 11 characterssetCharacterSet()
-InvalidArgumentException
- if the character set is not a valid character setsetBeneficiaryName()
-InvalidArgumentException
- if the beneficiary name is longer than 70 characterssetAmount()
-InvalidArgumentException
- if the amount is lower than zero or more than 999,999,999.99setPurpose()
-InvalidArgumentException
- if the purpose is longer than 4 characterssetRemittanceText()
-InvalidArgumentException
- if the remittance text is longer than 140 characterssetCreditorReference()
-InvalidArgumentException
- if the creditor reference is longer than 35 characterssetInformation()
andsetComment()
-InvalidArgumentException
- if the comment is longer than 70 characterssetCurrency()
-InvalidArgumentException
- if the currency is not exactly 3 characters longgetQrString()
-LogicException
- if the beneficiary name is missing or if the resulting string is bigger than 331 bytes or if both remittance text and creditor reference are setgetQrImage()
-LogicException
- if theendroid/qr-code
library is not installed
QR Code image
This library provides many implementations of QR code image using its sister library
rikudou/qr-payment-qr-code-provider. If any supported
QR code generating library is installed, the method getQrCode()
will return an instance of
\Rikudou\QrPaymentQrCodeProvider\QrCode
which can be used to get an image containing the generated QR payment data.
List of public methods
Constructor
Params
string|IbanInterface $iban
- The IBAN
Example
getIban()
Returns instance of IbanInterface
, you can get the string
representation of IBAN via method asString()
of IbanInterface
or by casting
the object to string.
Returns
rikudou\EuQrPayment\Iban\IbanInterface
Example
getCharacterSet()
Returns the character set as integer from specification.
You can check it against rikudou\EuQrPayment\Sepa\CharacterSet
constants. Defaults to 1 (utf-8).
Returns
int
Example
getBic() or getSwift()
Returns the BIC (SWIFT) of the payment. getSwift()
is alias
to getBic()
. Defaults to empty string.
Returns
string
Example
getBeneficiaryName()
Returns the name of the beneficiary. Defaults to empty string.
Returns
string
Example
getAmount()
Returns the amount of the payment. Defaults to 0.0
.
Returns
float
Example
getPurpose()
Returns the purpose text, you can check it against the
rikudou\EuQrPayment\Sepa\Purpose
constants. Defaults to
empty string.
Returns
string
Example
getRemittanceText()
Returns the remittance text, e.g. payment reference. Defaults to empty string.
Returns
string
Example
getCreditorReference()
Returns the structured creditor reference. Defaults to empty string.
Returns
string
Example
getInformation() or getComment()
Returns the information (comment) of the payment.
getComment()
is alias to getInformation()
. Defaults to
empty string.
Returns
string
Example
getCurrency()
Returns the currency of the payment. Defaults to EUR
.
Returns
string
Example
setCharacterSet()
Sets the character set.
Params
int $characterSet
- one of the supported character sets fromrikudou\EuQrPayment\Sepa\CharacterSet
Returns
$this
Example
setBic() or setSwift()
Sets the BIC (SWIFT) for the payment. setSwift()
is alias to setBic()
.
Params
string $bic
- your bank's BIC (SWIFT)
Returns
$this
Example
setBeneficiaryName()
Sets the name of the beneficiary, this parameter is required.
Params
string $beneficiaryName
- the name of the beneficiary
Returns
$this
Example
setAmount()
Sets the payment amount.
Params
float $amount
- The amount
Returns
$this
Example
setPurpose()
Sets the purpose according to SEPA specification, use class rikudou\EuQrPayment\Sepa\Purpose
.
Params
string $purpose
- The purpose
Returns
$this
Example
setRemittanceText()
The payment reference, up to 140 characters.
Note: You cannot set both remittance text and creditor reference
Params
string $remittanceText
- the remittance text
Returns
$this
Example
setCreditorReference()
The structured creditor reference (ISO 11649), up to 35 characters.
Note: You cannot set both remittance text and creditor reference
Params
string $creditorReference
- the remittance text
Returns
$this
Example
setInformation() or setComment()
Comment for the payment, up to 70 characters. setComment()
is alias to setInformation()
.
Params
string $information
- the information text
Returns
$this
Example
setCurrency()
Sets the currency of the payment, must be an ISO 4217 string.
Params
string $currency
- the currency according to ISO 4217
Returns
$this
Example
getQrString()
Returns the string that should be encoded in QR image.
Returns
string
Example
getQrImage()
Returns a Qr code via third-party library.
Returns
\Endroid\QrCode\QrCode
Example
The Purpose class
The class is generated via script createLists.php
as it downloads the XLS file that
documents all the purpose strings. The class is committed to git so that there doesn't
have to be any remote file downloading etc. when using this package in production.
After generating the class you should check that there are no errors as the code that generates it is most likely not bullet-proof.
All versions of euqrpayment with dependencies
ext-mbstring Version *
rikudou/qr-payment-interface Version ^1.0
rikudou/qr-payment-qr-code-provider Version ^1.0