Get all transactions and return formatted data

@return array
@throws \Exception
180571
public function request()
    {
        $transactions = $this->searchTransactions();

        if(count($transactions) > 0) {
            foreach ($transactions as $transaction) {
                $this->_arrayTransactions[] = array(
                    'date'           => $this->formatDate($transaction['created_at']),
                    'magento_id'     => $transaction['increment_id'],
                    'pagseguro_id'   => $transaction['transaction_code'],
                    'environment'    => $transaction['environment'],
                    'magento_status' => $this->formatMagentoStatus($transaction['status'], $transaction['partially_refunded']),
                    'order_id'       => $transaction['entity_id']
                );
            }
        }
        return $this->_arrayTransactions;
    }
876819
protected function getPaymentTransactionStructure()
    {
        return [
            'amount'                => $this->transformAmount($this->amount, $this->currency),
            'currency'              => $this->currency,
            'customer_email'        => $this->customer_email,
            'customer_phone'        => $this->customer_phone,
            'account_name'          => $this->account_name,
            'bank_name'             => $this->bank_name,
            'iban'                  => $this->iban,
            'bic'                   => $this->bic,
            'account_number'        => $this->account_number,
            'bank_code'             => $this->bank_code,
            'branch_code'           => $this->branch_code,
            'account_number_suffix' => $this->account_number_suffix,
            'sort_code'             => $this->sort_code,
            'aba_routing_number'    => $this->aba_routing_number,
            'billing_address'       => $this->getBillingAddressParamsStructure(),
        ];
    }
470603
public function getCurrencies()
    {
        if (!isset($this->_issuerData))
            throw new Exception("Issuer must be selected first");
        if (!isset($this->_country))
            throw new Exception("Country must be selected first");
        foreach ($this->_issuerData["Countries"] as $country) {
            if ($this->_country == $country["CountryCode"]) {
                return $country["Currencies"];
            }
        }
        return array();
    }
308931
public function get(): array
    {
        try {
            $query = $this->apply($this->database->getTablePrefixer());
            $compiled = $this->database->getGrammar()->compileSelect($query);
            return $this->database->select($compiled->getSQL(), $compiled->getBindings());
        } catch (\Throwable $exception) {
            return $this->handleException($exception);
        }
    }
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;
    }
347291
public function getTransaction( $transaction = self::TRANSACTION_LAST_USED, $throwExceptionIfNotFound = true )
    {

        if( $transaction === self::TRANSACTIONS_ALL ) {
            return array_keys( $this->queue );
        }

        if( $transaction === self::TRANSACTION_LAST_CREATED ) {
            if( !$this->queue) {
                $this->newTransaction();
            }
            $queue = array_keys( $this->queue );
            return array_pop( $queue );
        }

        if( $transaction === self::TRANSACTION_LAST_USED ) {
            if( !$this->queue) {
                $this->newTransaction();
            }
            return $this->lastTransaction;
        }

        if( $transaction === self::TRANSACTION_NEW ) {
            return $this->newTransaction();
        }

        if( !array_key_exists( $transaction, $this->queue ) ) {
            if( $throwExceptionIfNotFound ) {
                throw new TransactionDoesNotExistException(
                    "Transaction with this name `{$transaction}` doesn't exist. Sorry."
                );
            }
            return null;
        }

        return $transaction;

    }
994151
public function allTransactions($page)
    {
        $transactions = [];
        $transactionData = $this->getTransactionResource()->getAll($page);

        if ($transactionData instanceof \Exception) {
            throw $transactionData;
        }

        foreach ($transactionData as $transaction) {
            $transactions[] = TransactionObject::make($transaction);
        }

        return $transactions;
    }
112219
public function getData()
    {
        $this->validate('merchantId', 'merchantPassword', 'acquirerId', 'transactionId', 'amount', 'currency', 'card');

        // Check for AVS and require billingAddress1 and billingPostcode
        if ( $this->getRequireAvsCheck() )
        {
            $this->getCard()->validate('billingAddress1', 'billingPostcode');
        }

        // Tokenized cards require the CVV and nothing else, token replaces the card number
        if ( $this->getCardReference() )
        {
            $this->validate('cardReference');
            $this->getCard()->validate('cvv', 'expiryMonth', 'expiryYear');

            $cardDetails = [
                'CardCVV2'       => $this->getCard()->getCvv(),
                'CardExpiryDate' => $this->getCard()->getExpiryDate('my'),
                'CardNumber'     => $this->getCardReference()
            ];
        }
        else
        {
            $this->getCard()->validate();

            $cardDetails = [
                'CardCVV2'       => $this->getCard()->getCvv(),
                'CardExpiryDate' => $this->getCard()->getExpiryDate('my'),
                'CardNumber'     => $this->getCard()->getNumber(),
                'IssueNumber'    => $this->getCard()->getIssueNumber()
            ];
        }

        // Only pass the StartDate if year/month are set otherwise it returns 1299
        if ( $this->getCard()->getStartYear() && $this->getCard()->getStartMonth() )
        {
            $cardDetails['StartDate'] = $this->getCard()->getStartDate('my');
        }

        $transactionDetails = [
            'AcquirerId'       => $this->getAcquirerId(),
            'Amount'           => $this->formatAmount(),
            'Currency'         => $this->getCurrencyNumeric(),
            'CurrencyExponent' => $this->getCurrencyDecimalPlaces(),
            'IPAddress'        => $this->getClientIp(),
            'MerchantId'       => $this->getMerchantId(),
            'OrderNumber'      => $this->getTransactionId(),
            'Signature'        => $this->generateSignature(),
            'SignatureMethod'  => 'SHA1',
            'TransactionCode'  => $this->getTransactionCode()
        ];

        $billingDetails = [
            'BillToAddress'     => $this->getCard()->getAddress1(),
            'BillToZipPostCode' => $this->getCard()->formatPostcode(),
            'BillToFirstName'   => $this->getCard()->getFirstName(),
            'BillToLastName'    => $this->getCard()->getLastName(),
            'BillToCity'        => $this->getCard()->getCity(),
            'BillToCountry'     => $this->getCard()->getNumericCountry(),
            'BillToEmail'       => $this->getCard()->getEmail(),
            'BillToTelephone'   => $this->getCard()->getPhone(),
            'BillToFax'         => $this->getCard()->getFax()
        ];

        // FAC only accepts two digit state abbreviations from the USA
        if ( $billingDetails['BillToCountry'] == 840 )
        {
            $billingDetails['BillToState'] = $this->getCard()->validateState();
        }

        $data = [
            'TransactionDetails' => $transactionDetails,
            'CardDetails'        => $cardDetails,
            'BillingDetails'     => $billingDetails
        ];

        return $data;
    }
246567
public function getSuccessful()
    {
        $results = [];
        foreach ($this->hash as $key) {
            if (!($this->hash[$key] instanceof \Exception)) {
                $results[] = $this->hash[$key];
            }
        }

        return $results;
    }
231121
public function fetchAll(): array
    {
        $st = $this->run();
        try {
            return $st->fetchAll(\PDO::FETCH_ASSOC);
        } finally {
            $st->close();
        }
    }
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()
        ];
    }
853067
public function jsonSerialize() : array
    {
        return [
          'id'        => $this->getId(),
          'timestamp' => $this->getTimestamp(),
          'name'      => $this->getTransactionName(),
          'duration'  => $this->summary['duration'],
          'type'      => $this->getMetaType(),
          'result'    => $this->getMetaResult(),
          'context'   => $this->getContext(),
          'spans'     => $this->getSpans(),
          'processor' => [
              'event' => 'transaction',
              'name'  => 'transaction',
          ]
      ];
    }
25824
public function getData() : array
    {
        $data = [];
        $request = $this->getRequest();
        $method = $request->getMethod();

        switch ($method) {

            //GET
            case Request::METHOD_GET:
                $data = $_GET ?: [];
            break;

            //POST
            case Request::METHOD_POST:
                $data = $_POST ?: [];
            break;

            //Other supported
            case Request::METHOD_DELETE:
            case Request::METHOD_PUT:
            case Request::METHOD_PATCH:
                parse_str($request->getRequestBody(), $data);
            break;

        }

        return $data;
    }
454033
public function getData()
    {
        $this->validate('accountNumber', 'privateKey', 'token', 'amount', 'transactionId');

        $data = array();
        $data['sellerId'] = $this->getAccountNumber();
        $data['privateKey'] = $this->getPrivateKey();
        $data['merchantOrderId'] = $this->getTransactionId();
        $data['token'] = $this->getToken();
        $data['currency'] = $this->getCurrency();
        $data['total'] = $this->getAmount();

        if ($this->getCard()) {
            $data['billingAddr']['name'] = $this->getCard()->getName();
            $data['billingAddr']['addrLine1'] = $this->getCard()->getAddress1();
            $data['billingAddr']['addrLine2'] = $this->getCard()->getAddress2();
            $data['billingAddr']['city'] = $this->getCard()->getCity();
            $data['billingAddr']['state'] = $this->getCard()->getState();
            $data['billingAddr']['zipCode'] = $this->getCard()->getPostcode();
            $data['billingAddr']['email'] = $this->getCard()->getEmail();
            $data['billingAddr']['country'] = $this->getCard()->getCountry();
            $data['billingAddr']['phoneNumber'] = $this->getCard()->getPhone();
            $data['billingAddr']['phoneExt'] = $this->getCard()->getPhoneExtension();
        }

        if ($this->getCart()) {
            // remove amount parameter if lineItem attributes / cart is set
            unset($data['total']);

            $data['lineItems'] = $this->getCart();
        }

        // remove null values item from $data['billingAddr']
        $data['billingAddr'] = array_filter($data['billingAddr'], array($this, 'isNotNull'));

        // remove null values item from $data.
        $data = array_filter($data, array($this, 'isNotNull'));

        return $data;
    }
839635
protected function transactionSucceed()
	{
		return $this->getTable()->whereId($this->transactionId)->update([
			'status' => Enum::TRANSACTION_SUCCEED,
			'tracking_code' => $this->trackingCode,
			'card_number' => $this->cardNumber,
			'payment_date' => Carbon::now(),
			'updated_at' => Carbon::now(),
		]);
	}
90888
public function exportTransactions()
    {
        $data = [
            "from" => request()->from,
            "to" => request()->to,
            'settled' => request()->settled
        ];

        $this->setRequestOptions();
        return $this->setHttpResponse('/transaction/export', 'GET', $data)->getResponse();
    }
688164
protected TransactionImpl[] getRecoveringTransactions() {
        TransactionImpl[] recoveredTransactions = new TransactionImpl[_recoveringTransactions.size()];
        _recoveringTransactions.toArray(recoveredTransactions);
        return recoveredTransactions;
    }