27 lines
700 B
PHP
27 lines
700 B
PHP
<?php
|
|
|
|
namespace KupShop\GraphQLBundle\ApiAdmin\Util;
|
|
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Collection\PaymentCollection;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Order\DeliveryType\Payment;
|
|
use KupShop\GraphQLBundle\ApiShared\ApiUtil;
|
|
|
|
class PaymentUtil
|
|
{
|
|
public function getPayments($figure = false): PaymentCollection
|
|
{
|
|
$payments = \DeliveryType::getPayments($figure);
|
|
|
|
$payments = array_map(function ($payment) {
|
|
$payment['class']->paymentId = (int) $payment['id'];
|
|
|
|
return $payment['class'];
|
|
}, $payments);
|
|
|
|
return new PaymentCollection(ApiUtil::wrapItems(
|
|
$payments,
|
|
Payment::class
|
|
));
|
|
}
|
|
}
|