Download the PHP package rikudou/czqrpayment without Composer
On this page you can find all versions of the php package rikudou/czqrpayment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rikudou/czqrpayment
More information about rikudou/czqrpayment
Files in rikudou/czqrpayment
Package czqrpayment
Short Description QR payment library for Czech accounts
License MIT
Homepage https://github.com/RikudouSage/QrPaymentCZ
Informations about the package czqrpayment
QR code payment (CZ)
A simple library to generate QR payment code for Czech Republic. All methods are documented in source code.
See also QR code payment generator for Slovak, Hungarian or European Union accounts.
Using Symfony? See the QR Payment Bundle.
Installation
Via composer: composer require rikudou/czqrpayment
Usage
You can create the QR payment for an object implementing \Rikudou\Iban\Iban\IbanInterface
or from account number
and bank account (which is then converted to \Rikudou\Iban\Iban\CzechIbanAdapter
object).
See rikudou/iban for description of the interface and classes which let you for example validate the iban and/or the bank account number and bank code.
From IbanInterface implementing classes:
From account number and bank code directly:
Setting payment details
There are two approaches to setting payment details. You can set them in an associative array or using the methods provided in the class.
Using associative array
Using methods
Exceptions
Description of exceptions thrown:
__construct()
InvalidArgumentException
- if you provide options in constructor and any of those options does not exist\Rikudou\CzQrPayment\Exception\InvalidValueException
- if any of the options contains an asteriskTypeError
- if any of the values is not assignable to the properties after standard php conversions
setOptions()
- same as constructorgetQrString()
\Rikudou\CzQrPayment\Exception\InvalidValueException
- if any of the options contains an asterisk or if the iban is not valid
getQrImage()
\Rikudou\CzQrPayment\Exception\MissingLibraryException
- if the endroid/qr-code library is missing
All of these exceptions (except InvalidArgumentException
and TypeError
) extend the base
\Rikudou\CzQrPayment\Exception\QrPaymentException
.
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
\Rikudou\Iban\Iban\IbanInterface $iban
required - the IBAN for the paymentarray|null $options
- the array with options. The helper classQrPaymentOptions
can be used for options names.
Example
setOptions()
Sets the options, useful if you don't want to set them in constructor.
Params
array $options
required - the same as the constructor param$options
Returns
Returns itself, you can use this method for chaining.
Example
getIban()
Returns the iban.
Returns
\Rikudou\Iban\Iban\IbanInterface
Example
getQrString()
Returns the string that should be encoded in QR image.
Returns
string
Example
static fromAccountAndBankCode()
Returns a new instance of the payment object created from the account and bank code.
Is pretty much an alias to new QrPayment(new CzechIbanAdapter())
.
Params
string $accountNumber
required - The account numberstring $bankCode
required - The bank code
Returns
Returns itself, you can use this method for chaining.
Example
getQrImage()
Returns a Qr code via suggested third-party library.
Returns
\Endroid\QrCode\QrCode
Example
Options
This is a list of options you can set.
int $variableSymbol
- the variable symbol, has no defaultint $specificSymbol
- the specific symbol, has no defaultint $constantSymbol
- the constant symbol, has no defaultstring $currency
- ISO 4217 code for currency, defaults toCZK
string $comment
- the payment comment, has no defaultint $repeat
- the number of days that the payment should be repeated if it fails, defaults to7
string $internalId
- internal id of the payment, has no defaultDateTimeInterface dueDate
- the due date for payment, has no defaultfloat $amount
- the amount for the payment, shouldn't have more than 2 decimal places, has no defaultstring $country
- ISO 3166-1 alpha-2 code for country, defaults toCZ
bool $instantPayment
- whether the payment should be made as instant instead of standard payment (depends on bank support)
All of these options can be set using the QrPaymentOptions
helper class as constants for the constructor or
setOptions()
or as methods.
For example, the amount
can be set in an array using the constant QrPaymentOptions::AMOUNT
or using the
method setAmount()
.
All versions of czqrpayment with dependencies
rikudou/qr-payment-interface Version ^1.0
rikudou/iban Version ^1.1.1
rikudou/qr-payment-qr-code-provider Version ^1.0