Download the PHP package rikudou/skqrpayment without Composer
On this page you can find all versions of the php package rikudou/skqrpayment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rikudou/skqrpayment
More information about rikudou/skqrpayment
Files in rikudou/skqrpayment
Package skqrpayment
Short Description QR payment library for Slovak accounts
License MIT
Homepage https://github.com/RikudouSage/QrPaymentSK
Informations about the package skqrpayment
QR code payment (SK) - Pay by Square standard
This library generates a string that can be embedded into QR code and is recognized by all Slovak banks.
The library requires the xz
binary to present on the underlying system.
See also QR code payment generator for Czech, Hungarian or European accounts.
Installation
composer require rikudou/skqrpayment
Usage
Create an instance with or without IBANs. All IBANs must be instance of \Rikudou\Iban\Iban\IbanInterface
.
There are three implementations of IbanInterface
present:
\Rikudou\Iban\Iban\IBAN
- generic IBAN class which accepts the IBAN as a string\rikudou\SkQrPayment\Iban\IbanBicPair
- allows you to supply your own BIC (Swift) code if the bank is not present in the maps\Rikudou\Iban\Iban\CzechIbanAdapter
- IBAN that can be constructed from the local Czech format (account number and bank code)
You can also construct new instance from string:
Changing IBANs after construction
If you want to add/remove IBANs after construction, use addIban()
, removeIban()
and setIbans()
methods.
Setting options
You can set all options using the method setOptions()
or using the respective setters.
You can use
\rikudou\SkQrPayment\Payment\QrPaymentOptions
constants for option names
Setting options via setOptions()
:
Setting using the fluent setters:
Defaults
Default values for some of the options are provided:
currency
- EURcountry
- SKdueDate
- current date and time
Additionally, these properties are not required:
variableSymbol
specificSymbol
constantSymbol
comment
internalId
payeeName
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.
The xz binary
Since the Pay by Square standard uses lzma1 which has no php binding, the xz binary needs to be called.
If you have it in the standard PATH, this library should find it on its own, if not you have to set the path manually
using setXzBinary()
.
If you want to implement custom logic for getting the binary path, you can create a custom class implementing
\rikudou\SkQrPayment\Xz\XzBinaryLocatorInterface
and set the object via setXzBinaryLocator()
in the payment object.
Getting the result
Once you configured all your options, simply call getQrString()
and process it using your favorite qr code library.
Alternatively, if you use endroid/qr-code
, you can call getQrImage()
to get an instance of \Endroid\QrCode\QrCode
.
Exceptions
All exceptions extend the base \rikudou\SkQrPayment\Exception\QrPaymentException
.
\rikudou\SkQrPayment\Exception\DictionaryNotFoundException
- when you don't provide a BIC and there is no map for given country code (currently onlyCZ
andSK
)- extends
\rikudou\SkQrPayment\Exception\BicNotFoundException
- extends
\rikudou\SkQrPayment\Exception\BicNotFoundException
- when you don't provide a BIC and the bank is not found in the provided maps\rikudou\SkQrPayment\Exception\InvalidTypeException
- when you try to create an instance usingfromIBAN()
and the IBAN is not an instance ofQrPaymentInterface
or a string\rikudou\SkQrPayment\Exception\QrPaymentException
- the base exception- when you call
getQrImage()
and don't have theendroid/qr-code
library installed - when you call
getQrString()
without providing any IBANs - when you call
getQrString()
orgetXzBinary()
and thexz
binary is not present on filesystem - when you create instance of
IbanBicPair
with an argument that is not instance ofIbanInterface
nor string - when you create instance of
IbanBicPair
or callgetQrString()
and any of the IBANs is not valid
- when you call
All versions of skqrpayment with dependencies
rikudou/iban Version ^1.0
rikudou/qr-payment-interface Version ^1.0
rikudou/qr-payment-qr-code-provider Version ^1.0