Converts HpsShippingInfo into expected format for Cardinal

@param HpsPaymentData $payment payment information

@return array<string, string>
190333
protected function hydratePaymentData(HpsPaymentData $payment)
    {
        return array(
            'TaxAmount'      => $this->formatAmount($payment->taxAmount),
            'ShippingAmount' => $this->formatAmount($payment->shippingAmount),
        );
    }
1110924
def to_array(self):
        
        array = super(SuccessfulPayment, self).to_array()
        array['currency'] = u(self.currency)  # py2: type unicode, py3: type str
        array['total_amount'] = int(self.total_amount)  # type int
        array['invoice_payload'] = u(self.invoice_payload)  # py2: type unicode, py3: type str
        array['telegram_payment_charge_id'] = u(self.telegram_payment_charge_id)  # py2: type unicode, py3: type str
        array['provider_payment_charge_id'] = u(self.provider_payment_charge_id)  # py2: type unicode, py3: type str
        if self.shipping_option_id is not None:
            array['shipping_option_id'] = u(self.shipping_option_id)  # py2: type unicode, py3: type str
        if self.order_info is not None:
            array['order_info'] = self.order_info.to_array()  # type OrderInfo
        return array
946597
public function showPaymentInstructions(Payment $payment): string
	{
		if (empty($_REQUEST['tp_radio_value']) || empty($_REQUEST['tp_radio_is_offline'])) {
			return '';
		}

		$this->clearCookies();

		$href = "{$this->config->gateUrl}radiobuttons/style/radiobuttons.css?v=" . time();
		$href = Escaper::htmlEntityEncode($href);
		$out = "<link href=\"{$href}\" type=\"text/css\" rel=\"stylesheet\" />\n";

		$out .= "<script type=\"text/javascript\">\n";

		$payment->setMethodId(intval($_REQUEST['tp_radio_value']));
		$queryArgs = $payment->getArgs();
		$queryArgs['signature'] = $payment->getSignature();
		$thepayGateUrl = "{$this->config->gateUrl}?" . http_build_query($queryArgs);
		$thepayGateUrl = Escaper::jsonEncode($thepayGateUrl);
		$out .= "\tvar thepayGateUrl = {$thepayGateUrl},\n";

		$thepayDisablePopupCss = Escaper::jsonEncode($this->disablePopupCss);
		$out .= "\tthepayDisablePopupCss = {$thepayDisablePopupCss};\n";

		$out .= "</script>\n";

		$src = "{$this->config->gateUrl}radiobuttons/js/jquery.js?v=" . time();
		$src = Escaper::htmlEntityEncode($src);
		$out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>";

		$src = "{$this->config->gateUrl}radiobuttons/js/radiobuttons.js?v=" . time();
		$src = Escaper::htmlEntityEncode($src);
		$out .= "<script type=\"text/javascript\" src=\"{$src}\" async=\"async\"></script>";

		$out .= '<div id="thepay-method-result"></div>';

		return $out;
	}
1330869
protected function getAvailablePaymentListAsString()
    {
        static $sPaymentMethods = null;

        if (null === $sPaymentMethods) {
            $sPaymentMethods = '';
            $oPaymentList = $this->getAvailablePaymentList();
            if (null !== $oPaymentList) {
                if ($oPaymentList->Length() > 0) {
                    while ($oPaymentMethod = $oPaymentList->Next()) {
                        if ('' != $sPaymentMethods) {
                            $sPaymentMethods .= ', ';
                        }
                        $sPaymentMethods .= $oPaymentMethod->GetName();
                    }
                }
            }
        }

        if (!is_string($sPaymentMethods)) {
            $sPaymentMethods = '';
        }

        return $sPaymentMethods;
    }
993170
public function createPaymentUrl(PaymentRequestInterface $payment)
    {
        $params = $payment->toArray();
        $params = array_merge($params, array(
            'alias' => $this->alias,
            'mac'   => $this->calculateMac($payment)
        ));

        return sprintf('%s?%s', $this->endpoint, http_build_query($params));
    }
1053757
public function findBestPayment($payments, $invoice)
    {
        $value = $invoice->getDataValue('sumCelkem');
        foreach ($payments as $paymentID => $payment) {
            if ($payment['sumCelkem'] == $value) {
                return new \FlexiPeeHP\Banka(\FlexiPeeHP\FlexiBeeRO::code($payments[$paymentID]['kod']),
                    $this->config);
            }
        }

        $symbol = $invoice->getDataValue('specSym');

        $this->addStatusMessage(sprintf(_('Platba pro fakturu %s nebyla dohledána'),
                self::apiUrlToLink($invoice->apiURL)), 'warning');

        return null;
    }
1074284
public function create($amount, $payment, $options = [])
    {
        $payload = [
            'intent'              => 'sale',
            'application_context' => [],
            'payer'               => [
                'payment_method' => 'paypal',
                'payer_info'     => [],
            ],
            'transactions' => [
                [
                    'amount' => [
                        'currency' => Arr::get($options, 'currency', $this->gateway->getCurrency()),
                        'total'    => $this->gateway->amount($amount),
                        'details'  => [],
                    ],
                    'description'     => Arr::get($options, 'description', 'PayMe Purchase'),
                    'payment_options' => ['allowed_payment_method' => 'IMMEDIATE_PAY'],
                    'invoice_number'  => Arr::get($options, 'reference', ''),
                    'item_list'       => [],
                ],
            ],
            'redirect_urls' => [
                'cancel_url' => Arr::get($options, 'cancel_url', ''),
                'return_url' => Arr::get($options, 'return_url', ''),
            ],
        ];

        $payload = $this->addLineItems($payload, $options);
        $payload = $this->addBilling($payload, $options);
        $payload = $this->addShipping($payload, $options);
        $payload = $this->addDiscount($payload, $options);

        return $this->gateway->commit(
            'post',
            $this->gateway->buildUrlFromString('payments/payment'),
            $payload, $options
        );
    }
393791
public function create_preapproval_payment($preapproval_payment) {
        $request = array(
            "uri" => "/preapproval",
            "params" => array(
                "access_token" => $this->get_access_token()
            ),
            "data" => $preapproval_payment
        );

        $preapproval_payment_result = MPRestClient::post($request);
        return $preapproval_payment_result;
    }
1239995
private function addACH(HpsPayPlanPaymentMethod $paymentMethod)
    {
        $data = $paymentMethod->getEditableFieldsWithValues();
        $data['customerKey'] = $paymentMethod->customerKey;
        $data['accountNumber'] = $paymentMethod->accountNumber;
        $data['accountType'] = $paymentMethod->accountType;
        $data['achType'] = $paymentMethod->achType;
        $data['routingNumber'] = $paymentMethod->routingNumber;
        $result = $this->doRequest($data, array(
            'verb'     => 'POST',
            'endpoint' => 'paymentMethodsACH',
        ));
        return $this->hydrateObject($result, 'HpsPayPlanPaymentMethod');
    }
996972
public function toString()
    {

        $request = array();
        $request['Reference'] = $this->reference;
        $request['PagSeguroPreApprovalCode'] = $this->preApprovalCode;

        return "PagSeguroPaymentCharge: " . var_export($request, true);
    }
112495
public function getHppPaymentMethodFee($paymentMethod)
    {
        $paymentMethod = str_replace('adyen_hpp_', '', $paymentMethod);

        $paymentFees = $this->getHppPaymentMethodFees();

        if ($paymentFees && is_array($paymentFees) && !empty($paymentFees)) {
            foreach ($paymentFees as $paymentFee) {
                if (isset($paymentFee['code']) && $paymentFee['code'] == $paymentMethod) {
                    if (isset($paymentFee['amount'])) {
                        return $paymentFee['amount'];
                    }
                }
            }
        }

        return null;
    }
80452
protected function build($payment, $order)
    {
        return  [
            'date'             => $this->formatDate($order),
            'magento_id'       => $this->formatMagentoId($order),
            'magento_status'   => $this->formatMagentoStatus($order),
            'pagseguro_id'     => $payment->getCode(),
            'pagseguro_status' => $this->formatPagSeguroStatus($payment),
            'order_id'         => $order->getId(),
            'details'          => $this->details($order, $payment)
        ];
    }
37066
private function toArray($payment, $order, $conciliate = false)
    {
        return  [
            'date'             => $this->formatDate($order),
            'magento_id'       => $this->formatMagentoId($order),
            'magento_status'   => $this->formatMagentoStatus($order),
            'pagseguro_id'     => $payment->getCode(),
            'order_id'         => $order->getId(),
            'details'          => $this->details($order, $payment, ['conciliate' => $conciliate])
        ];
    }
29263
public function getPaymentAmountInfo($index = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('paymentAmountInfo', $orderStatuses[$index])
            ? $orderStatuses[$index]['paymentAmountInfo'] : [];
    }
7216
public function getBulkPayments($payment_ids, $height)
    {
        $params = [
            'payment_ids' => $payment_ids,
            'min_block_height' => $height
        ];
        $body = [
            'method' => 'get_bulk_payments',
            'params' => $params
        ];
        return $this->_request($body);
    }
1096086
public static function getData($payment)
    {

        $data = null;

        $data = parent::getData($payment);

        // paymentMode
        if ($payment->getPaymentMode() != null) {
            $data["paymentMode"] = $payment->getPaymentMode()->getValue();
        }

        // paymentMethod
        if ($payment->getPaymentMethod()->getPaymentMethod() != null) {
            $data["paymentMethod"] = $payment->getPaymentMethod()->getPaymentMethod();
        }

        // senderHash
        if ($payment->getSenderHash() != null) {
            $data["senderHash"] = $payment->getSenderHash();
        }

         // receiverEmail
        if ($payment->getReceiverEmail() != null) {
            $data["receiverEmail"] = $payment->getReceiverEmail();
        }

        // Bank name
        if ($payment->getOnlineDebit() != null) {
            $data["bankName"] = $payment->getOnlineDebit()->getBankName();
        }

        //Credit Card
        if ($payment->getCreditCard() != null) {
            //Token
            if ($payment->getCreditCard()->getToken() != null) {
                $data['creditCardToken'] = $payment->getCreditCard()->getToken();
            }

            //Installments
            if ($payment->getCreditCard()->getInstallment() != null) {
                $installment = $payment->getCreditCard()->getInstallment();
                if ($installment->getQuantity() != null && $installment->getValue()) {
                    $data['installmentQuantity'] = $installment->getQuantity();
                    $data['installmentValue']    = PagSeguroHelper::decimalFormat($installment->getValue());
                    if ($installment->getNoInterestInstallmentQuantity() != null ) {
                        $data['noInterestInstallmentQuantity'] = $installment->getNoInterestInstallmentQuantity();
                    }
                }
            }

            //Holder
            if ($payment->getCreditCard()->getHolder() != null) {
                $holder = $payment->getCreditCard()->getHolder();
                if ($holder->getName() != null) {
                    $data['creditCardHolderName'] = $holder->getName();
                }
                 // documents
                /*** @var $document PagSeguroDocument */
                if ($payment->getCreditCard()->getHolder()->getDocuments() != null) {
                    $documents = $payment->getCreditCard()->getHolder()->getDocuments();
                        $data['creditCardHolderCPF'] = $documents->getValue();
                }
                if ($holder->getBirthDate() != null) {
                    $data['creditCardHolderBirthDate'] = $holder->getBirthDate();
                }
                // phone
                if ($holder->getPhone() != null) {
                    if ($holder->getPhone()->getAreaCode() != null) {
                        $data['creditCardHolderAreaCode'] = $holder->getPhone()->getAreaCode();
                    }
                    if ($holder->getPhone()->getNumber() != null) {
                        $data['creditCardHolderPhone'] = $holder->getPhone()->getNumber();
                    }
                }
            }

            //Billing Address
            if ($payment->getCreditCard()->getBilling() != null) {
                $billingAddress = $payment->getCreditCard()->getBilling()->getAddress();
                if ($billingAddress->getStreet() != null) {
                    $data['billingAddressStreet'] = $billingAddress->getStreet();
                }
                if ($billingAddress->getNumber() != null) {
                    $data['billingAddressNumber'] = $billingAddress->getNumber();
                }
                if ($billingAddress->getComplement() != null) {
                    $data['billingAddressComplement'] = $billingAddress->getComplement();
                }
                if ($billingAddress->getCity() != null) {
                    $data['billingAddressCity'] = $billingAddress->getCity();
                }
                if ($billingAddress->getState() != null) {
                    $data['billingAddressState'] = $billingAddress->getState();
                }
                if ($billingAddress->getDistrict() != null) {
                    $data['billingAddressDistrict'] = $billingAddress->getDistrict();
                }
                if ($billingAddress->getPostalCode() != null) {
                    $data['billingAddressPostalCode'] = $billingAddress->getPostalCode();
                }
                if ($billingAddress->getCountry() != null) {
                    $data['billingAddressCountry'] = $billingAddress->getCountry();
                }
            }

        }

        return $data;
    }
5614
protected function hydrateShippingInfo(HpsShippingInfo $shipping)
    {
        return array(
            'ShippingAddress1'    => $shipping->address->address,
            'ShippingCity'        => $shipping->address->city,
            'ShippingCountryCode' => $shipping->countryCode,
            'ShippingFirstName'   => $shipping->firstName,
            'ShippingLastName'    => $shipping->lastName,
            'ShippingMiddleName'  => $shipping->middleName,
            'ShippingPhone'       => $shipping->phoneNumber,
            'ShippingPostalCode'  => $shipping->address->zip,
            'ShippingState'       => $shipping->address->state,
        );
    }