Download the PHP package rikudou/pay-by-square-decoder without Composer
On this page you can find all versions of the php package rikudou/pay-by-square-decoder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rikudou/pay-by-square-decoder
More information about rikudou/pay-by-square-decoder
Files in rikudou/pay-by-square-decoder
Package pay-by-square-decoder
Short Description Decoder for the Pay By Square standard
License WTFPL
Informations about the package pay-by-square-decoder
Pay By Square decoder
This library decodes the string encoded according to the Slovakian Pay By Square standard.
This package can be used as a standalone library or a Symfony bundle
Installing
composer require rikudou/pay-by-square-decoder
Requirements
You must have the xz
binary from xz-utils
in your system.
Usage
The class \Rikudou\BySquare\Decoder\PayBySquareDecoder
has a
public method called decode
which accepts a string argument with
the encoded data.
Example:
If the xz
binary is not in your PATH
you must set the path
first:
Advanced configuration
The \Rikudou\BySquare\Decoder\PayBySquareDecoder
takes a configuration
object as a first argument, where some advanced configuration can take place.
If no configuration object is provided, one with default values is created.
Currently only partial data config is available.
Options
- allow partial data
- type:
bool
- default:
true
- methods:
setAllowPartialData(bool)
/isPartialDataAllowed()
- description: The xz binary can sometimes fail due to unexpected end of input because of numerous reasons which often are not an issue. When set to true, the decoder will accept the partial data even if xz thinks it's incomplete.
- type:
Usage in Symfony
If you use Symfony flex, the package should be configured
automatically, if not, just add \Rikudou\BySquare\RikudouPayBySquareDecoderBundle
to your config/bundles.php
.
You can now use Rikudou\BySquare\Decoder\PayBySquareDecoder
as
a service:
If your xz
binary is not in your path, you can create a config
file in config/packages/rikudou_pay_by_square_decoder.yaml
and change the path, here is the default config (generated using
config:dump
command):
Return values description
The decode
method returns an instance of \Rikudou\BySquare\VO\DecodedBySquareData
which is a value object. The method names are self-explanatory
in most cases.
getVersion(): int
- returns the Pay By Square version, currently only version 0 is supportedgetPaymentId(): ?string
- internal payment idgetPaymentsCount(): int
- the count of payments the encoded string containsisRegularPayment(): bool
- returns true if the payment is a standard one-off paymentgetAmount(): float
- the payment amountgetCurrency(): ?string
- the three-letter ISO currency codegetDueDate(): ?DateTime
- returns the due date, if no due date was given returns the date 1970-01-01getVariableSymbol(): ?int
- returns variable symbol if present, null otherwisegetConstantSymbol(): ?int
- returns constant symbol if present, null otherwisegetSpecificSymbol(): ?int
- returns specific symbol if present, null otherwisegetPayerReference(): ?string
- returns the payer reference, e.g. a variable, constant and specific symbol as a single stringNote: The payer reference and variable/constant/specific symbols are NOT constructed from each other but taken directly from the payment data, meaning you should check for both if you're looking for e.g. variable symbol
getNote(): ?string
- returns the note/commentgetIbanCount(): int
- returns the count of IBANs present in encoded stringgetIban(): IBAN
- returns the first IBAN - if no IBANs are present it throws an exceptiongetIbans(): iterable<IBAN>
- returns an iterable of all IBANs presentisStandingOrder(): bool
- whether the payment is a standing orderisDirectDebit(): bool
- whether the payment is a direct debitgetPayeeName(): ?string
- returns the name of the payeegetPayeeAddressLine1(): ?string
- returns the address line 1 of the payeegetPayeeAddressLine2(): ?string
- returns the address line 2 of the payee
The methods getIban
and getIbans
return \Rikudou\BySquare\VO\IBAN
(or iterable of it) which is a really simple value object with
two methods:
getIban(): ?string
- returns the IBANgetBic(): ?string
- returns the BIC/SWIFT code
Exception handling
The only exception thrown by this library is
\Rikudou\BySquare\Exception\PayBySquareException