AfterbuyOrderPaymentInfoReader
in package
Class AfterbuyOrderPaymentInfoReader
Table of Contents
- CONFIG_ALIAS_SCAFFOLD = 'configuration/MODULE_PAYMENT_%s_ALIAS'
- STORAGE_AFTERBUY_NAMESPACE = 'modules/gambio/afterbuy'
- $configurationFinder : ConfigurationFinder
- $connection : Connection
- $logger : AfterbuyLogger
- $orderTotalReader : AfterbuyOrderTotalReader
- $storage : ConfigurationStorageRepository
- __construct() : mixed
- AfterbuyOrderPaymentInfoReader constructor.
- getAlreadyPaid() : float|null
- Checks if the order was already paid. If so, the order total value is returned as float.
- getPaymentDate() : DateTimeImmutable|null
- Fetches the payment date of the given order and returns null if the order is not marked as paid.
- getPaymentMethod() : string
- Tries to return the payment method of the given payment class.
- getFirstPaidDate() : string|null
- Fetches the first date on which the order is marked as paid and returns null if nothing was found.
- getOrderTotalPaid() : float|null
- Fetches the order total value from the `orders_total` table for the order.
Constants
CONFIG_ALIAS_SCAFFOLD
private
mixed
CONFIG_ALIAS_SCAFFOLD
= 'configuration/MODULE_PAYMENT_%s_ALIAS'
STORAGE_AFTERBUY_NAMESPACE
private
mixed
STORAGE_AFTERBUY_NAMESPACE
= 'modules/gambio/afterbuy'
Properties
$configurationFinder
private
ConfigurationFinder
$configurationFinder
$connection
private
Connection
$connection
$logger
private
AfterbuyLogger
$logger
$orderTotalReader
private
AfterbuyOrderTotalReader
$orderTotalReader
$storage
private
ConfigurationStorageRepository
$storage
Methods
__construct()
AfterbuyOrderPaymentInfoReader constructor.
public
__construct(ConfigurationFinder $configurationFinder, ConfigurationStorageRepositoryBuilder $storageBuilder, AfterbuyOrderTotalReader $orderTotalReader, Connection $connection, AfterbuyLogger $logger) : mixed
Parameters
- $configurationFinder : ConfigurationFinder
- $storageBuilder : ConfigurationStorageRepositoryBuilder
- $orderTotalReader : AfterbuyOrderTotalReader
- $connection : Connection
- $logger : AfterbuyLogger
Return values
mixed —getAlreadyPaid()
Checks if the order was already paid. If so, the order total value is returned as float.
public
getAlreadyPaid(array<string|int, mixed> $data) : float|null
If not, the method returns null.
Parameters
- $data : array<string|int, mixed>
Return values
float|null —getPaymentDate()
Fetches the payment date of the given order and returns null if the order is not marked as paid.
public
getPaymentDate(array<string|int, mixed> $data) : DateTimeImmutable|null
Parameters
- $data : array<string|int, mixed>
Return values
DateTimeImmutable|null —getPaymentMethod()
Tries to return the payment method of the given payment class.
public
getPaymentMethod(string $paymentClass) : string
Returns $paymentClass if nothing was found.
Parameters
- $paymentClass : string
Return values
string —getFirstPaidDate()
Fetches the first date on which the order is marked as paid and returns null if nothing was found.
private
getFirstPaidDate(int $orderId) : string|null
To determine if the order is marked as paid, we take the Afterbuy configuration 'order_status_paid' and
search in the orders_status_history
table for the first record with a matching order id containing one of
the 'paid' order status, sorted by the first date_added
field (asc).
Parameters
- $orderId : int
Return values
string|null —getOrderTotalPaid()
Fetches the order total value from the `orders_total` table for the order.
private
getOrderTotalPaid(array<string|int, mixed> $data) : float|null
The order is identified by $data's element "orders_id".
Parameters
- $data : array<string|int, mixed>