Format transaction CreditorFees
@return array|string
196986
private function prepareCreditorFees()
    {
        $creditorFees = "";
        if(!empty($this->_detailsTransactionByCode->getCreditorFees()))
        {
            $creditorFees = array(
                'intermediationRateAmount'  => $this->_detailsTransactionByCode->getCreditorFees()->getIntermediationRateAmount(),
                'intermediationFeeAmount'   => $this->_detailsTransactionByCode->getCreditorFees()->getIntermediationFeeAmount(),
                'installmentFeeAmount'      => $this->_detailsTransactionByCode->getCreditorFees()->getInstallmentFeeAmount(),
                'operationalFeeAmount'      => $this->_detailsTransactionByCode->getCreditorFees()->getOperationalFeeAmount(),
                'commissionFeeAmount'       => $this->_detailsTransactionByCode->getCreditorFees()->getCommissionFeeAmount()
            );
        }
        return $creditorFees;
    }
100617
public function generateForms(Transaction $transaction)
    {
        $paymentForms = array();

        foreach ($this->paymentAdapters as $bankId => $paymentAdapter) {
            if ($paymentAdapter->enabled) {
                $form = new Form([], $paymentAdapter);

                $paymentAdapter->fillPaymentFormDataset($form, $transaction);
                $this->paymentHandler->finalizeForm($form, $paymentAdapter);

                $paymentForms[$bankId] = $form;
            }
        }

        return $paymentForms;
    }
295989
protected function getListTransaction()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        return (array) $this->transaction->getList($conditions);
    }
76439
public function format()
    {
        if ($this->groupEvent) {
            // ugly fix for misunderstanding of this...
            $this->version = 2;
        }

        $result = [
            'Url' => $this->url,
            'EventType' => $this->eventType,
            'IsBackup'  => $this->isBackup,
            'Status'    => $this->status,
            'Version'   => $this->version
        ];

        if($this->apikeyId){
            $result['APIKeyID'] = $this->apikeyId;
        }

        return $result;
    }
199907
protected function getNextTransactionSequenceNumber()
    {
        $query = "SELECT MAX(sequence_number) AS max_sequence_number
                    FROM `pkg_shop_payment_transaction`
                   WHERE `pkg_shop_payment_transaction`.`shop_order_id` = '".MySqlLegacySupport::getInstance(
            )->real_escape_string(
                $this->order->id
            )."'
                GROUP BY `pkg_shop_payment_transaction`.`shop_order_id`
                 ";
        if ($aSum = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
            $iSequenceNumber = $aSum['max_sequence_number'] + 1;
        } else {
            $iSequenceNumber = 1;
        }

        return $iSequenceNumber;
    }
1119098
protected function getPaymentTransactionStructure()
    {
        return [
            'usage'        => $this->usage,
            'remote_ip'    => $this->remote_ip,
            'amount'       => $this->transformAmount($this->amount, $this->currency),
            'currency'     => $this->currency,
            'reference_id' => $this->reference_id
        ];
    }
1070583
public function transaction()
    {
        $options = array(
            'order' => 'desc',
            'sort' => 'created',
            'limit' => array(0, $this->config->get('dashboard_limit', 10)));

        $items = $this->transaction->getList($options);

        array_walk($items, function (&$item) {
            $this->setItemTotalFormatted($item, $this->price);
        });

        return $items;
    }
979149
protected function getPaymentTransactionStructure()
    {
        return [
            'gaming'                    => $this->gaming,
            'moto'                      => $this->moto,
            'notification_url'          => $this->notification_url,
            'return_success_url'        => $this->return_success_url,
            'return_failure_url'        => $this->return_failure_url,
            'amount'                    => $this->transformAmount($this->amount, $this->currency),
            'currency'                  => $this->currency,
            'card_holder'               => $this->card_holder,
            'card_number'               => $this->card_number,
            'cvv'                       => $this->cvv,
            'expiration_month'          => $this->expiration_month,
            'expiration_year'           => $this->expiration_year,
            'customer_email'            => $this->customer_email,
            'customer_phone'            => $this->customer_phone,
            'document_id'               => $this->document_id,
            'birth_date'                => $this->birth_date,
            'billing_address'           => $this->getBillingAddressParamsStructure(),
            'shipping_address'          => $this->getShippingAddressParamsStructure(),
            'mpi_params'                => $this->getMpiParamsStructure(),
            'risk_params'               => $this->getRiskParamsStructure(),
            'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
        ];
    }
892459
protected function rules() {
        return [
            new Rule('Transaction ID', function(array $subject) {
                $response = SubjectReader::readResponse($subject);

                return array_key_exists('id', $response);
            }, __('Checkout.com response does not have transaction ID.') ),

            new Rule('Associated Track ID', function(array $subject) {
                $paymentDO  = SubjectReader::readPayment($subject);
                $response   = SubjectReader::readResponse($subject);

                return $paymentDO->getOrder()->getOrderIncrementId() === $response['trackId'];
            }, __('Checkout.com track ID is not the same.') ),
        ];
    }
956815
protected function getDiscountLinesCreditNote()
    {
        $result = array();

        // Get total amount credited.
        /** @noinspection PhpUndefinedFieldInspection */
        $creditSlipAmountInc = $this->creditSlip->total_products_tax_incl;

        // Get sum of product lines.
        $lines = $this->creditSlip->getOrdersSlipProducts($this->invoiceSource->getId(), $this->order);
        $detailsAmountInc = array_reduce($lines, function ($sum, $item) {
            $sum += $item['total_price_tax_incl'];
            return $sum;
        }, 0.0);

        // We assume that if total < sum(details), a discount given on the
        // original order has now been subtracted from the amount credited.
        if (!Number::floatsAreEqual($creditSlipAmountInc, $detailsAmountInc, 0.05)
            && $creditSlipAmountInc < $detailsAmountInc
        ) {
            // PS Error: total_products_tax_excl is not adjusted (whereas
            // total_products_tax_incl is) when a discount is subtracted from
            // the amount to be credited.
            // So we cannot calculate the discount ex VAT ourselves.
            // What we can try is the following: Get the order cart rules to see
            // if 1 or all of those match the discount amount here.
            $discountAmountInc = $detailsAmountInc - $creditSlipAmountInc;
            $totalOrderDiscountInc = 0.0;
            // Note: The sign of the entries in $orderDiscounts will be correct.
            $orderDiscounts = $this->getDiscountLinesOrder();

            foreach ($orderDiscounts as $key => $orderDiscount) {
                if (Number::floatsAreEqual($orderDiscount[Meta::UnitPriceInc], $discountAmountInc)) {
                    // Return this single line.
                    $from = $to = $key;
                    break;
                }
                $totalOrderDiscountInc += $orderDiscount[Meta::UnitPriceInc];
                if (Number::floatsAreEqual($totalOrderDiscountInc, $discountAmountInc)) {
                    // Return all lines up to here.
                    $from = 0;
                    $to = $key;
                    break;
                }
            }

            if (isset($from) && isset($to)) {
                $result = array_slice($orderDiscounts, $from, $to - $from + 1);
                // Correct meta-invoice-amount.
                $totalOrderDiscountEx = array_reduce($result, function ($sum, $item) {
                    $sum += $item[Tag::Quantity] * $item[Tag::UnitPrice];
                    return $sum;
                }, 0.0);
                $this->invoice[Tag::Customer][Tag::Invoice][Meta::InvoiceAmount] += $totalOrderDiscountEx;
            } //else {
                // We could not match a discount with the difference between the
                // total amount credited and the sum of the products returned. A
                // manual line will correct the invoice.
            //}
        }
        return $result;
    }
774364
public function getAllRDFaPayments()
    {
        $aRDFaPayments = [];
        $aAssignedRDFaPayments = $this->getAssignedRDFaPayments();
        foreach ($this->_aRDFaPayments as $sName => $iType) {
            $oPayment = new stdClass();
            $oPayment->name = $sName;
            $oPayment->type = $iType;
            $oPayment->checked = in_array($sName, $aAssignedRDFaPayments);
            $aRDFaPayments[] = $oPayment;
        }

        return $aRDFaPayments;
    }
944803
protected function getPaymentTransactionStructure()
    {
        return [
            'amount'             => $this->transformAmount($this->amount, $this->currency),
            'currency'           => $this->currency,
            'bank_code'          => $this->bank_code,
            'return_success_url' => $this->return_success_url,
            'return_failure_url' => $this->return_failure_url,
            'customer_email'     => $this->customer_email,
            'customer_phone'     => $this->customer_phone,
            'payment_type'       => $this->payment_type,
            'document_id'        => $this->document_id,
            'billing_address'    => $this->getBillingAddressParamsStructure(),
            'shipping_address'   => $this->getShippingAddressParamsStructure()
        ];
    }
27431
protected function getTransactionCode()
    {
        $transactionCode = $this->transactionCode;
        if($this->getRequireAvsCheck()) {
            $transactionCode += 1;
        }
        if($this->getCreateCard()) {
            $transactionCode += 128;
        }
        return $transactionCode;
    }
403972
protected function parseTransactionCode()
    {
        $results = [];
        if (preg_match('/^:61:.*?N(.{3}).*/', $this->getCurrentTransactionData(), $results)
            && !empty($results[1])
        ) {
            return trim($results[1]);
        }
        return '';
    }
601964
protected function getPaymentTransactionStructure()
    {
        return [
            'amount'              => $this->transformAmount($this->amount, $this->currency),
            'currency'            => $this->currency,
            'customer_email'      => $this->customer_email,
            'customer_phone'      => $this->customer_phone,
            'return_success_url'  => $this->return_success_url,
            'return_failure_url'  => $this->return_failure_url,
            'bank_code'           => $this->bank_code,
            'bank_name'           => $this->bank_name,
            'bank_branch'         => $this->bank_branch,
            'bank_account_name'   => $this->bank_account_name,
            'bank_account_number' => $this->bank_account_number,
            'billing_address'     => $this->getBillingAddressParamsStructure(),
            'shipping_address'    => $this->getShippingAddressParamsStructure()
        ];
    }
649357
public function getDataCredito()
    {
        $data = $this->data_credito ? \DateTime::createFromFormat('dmy', sprintf('%06d', $this->data_credito)) : false;
        if ($data) {
            $data->setTime(0, 0, 0);
        }

        return $data;
    }
228798
protected function parseTransactionAccount()
    {
        $results = parent::parseTransactionAccount();

        if (empty($results)) {
            $giroMatch = $ibanMatch = [];
            if (preg_match('/^:86:GIRO(.{9})/im', $this->getCurrentTransactionData(), $giroMatch)
                && !empty($giroMatch[1])
            ) {
                $results = $giroMatch[1];
            }

            if (preg_match('!^:86:/.*/IBAN/(.*?)/!m', $this->getCurrentTransactionData(), $ibanMatch)
                && !empty($ibanMatch[1])
            ) {
                $results = $ibanMatch[1];
            }
        }

        return $this->sanitizeAccount($results);
    }