2016-07-18
2017-11-12 It returns all the payment's transactions except the first one, wrapped by event instances.
@used-by response()
@return Ev[]
9823
private function responses() {return dfc($this, function() {return array_map(function(T $t) {return
		F::s($this->_m, df_trd($t))->e()
	;}, $this->tResponses());});}
688164
protected TransactionImpl[] getRecoveringTransactions() {
        TransactionImpl[] recoveredTransactions = new TransactionImpl[_recoveringTransactions.size()];
        _recoveringTransactions.toArray(recoveredTransactions);
        return recoveredTransactions;
    }
402131
protected function getDiscountForSwitchToYearly()
    {
        $amount = 0;

        foreach ($this->asBraintreeSubscription()->discounts as $discount) {
            if ($discount->id == 'plan-credit') {
                $amount += (float) $discount->amount * $discount->numberOfBillingCycles;
            }
        }

        return (object) [
            'amount' => $amount,
            'numberOfBillingCycles' => 1,
        ];
    }
344845
public function getPaymentTypes()
    {
        if ($this->_oPaymentTypes == null) {
            // all paymenttypes
            $this->_oPaymentTypes = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $this->_oPaymentTypes->init("oxpayment");
            $oListObject = $this->_oPaymentTypes->getBaseObject();
            $oListObject->setLanguage(\OxidEsales\Eshop\Core\Registry::getLang()->getObjectTplLanguage());
            $this->_oPaymentTypes->getList();
        }

        return $this->_oPaymentTypes;
    }
1023875
protected function getPaymentData()
    {
        $data = array(
            'cancel_url'   => $this->getCancelUrl(),
            'close_window' => $this->getCloseWindow(),
            'notification_url' => $this->getNotifyUrl(),
            'redirect_url'   => $this->getReturnUrl(),
        );

        return array_filter($data);
    }
119779
protected function getPaymentTransactionStructure()
    {
        return [
            'usage'              => $this->usage,
            'remote_ip'          => $this->remote_ip,
            'return_success_url' => $this->return_success_url,
            'return_failure_url' => $this->return_failure_url,
            'amount'             => $this->transformAmount($this->amount, $this->currency),
            'currency'           => $this->currency,
            'consumer_reference' => $this->consumer_reference,
            'national_id'        => $this->national_id,
            'birth_date'         => $this->birth_date,
            'customer_email'     => $this->customer_email,
            'billing_address'    => $this->getBillingAddressParamsStructure(),
            'shipping_address'   => $this->getShippingAddressParamsStructure()
        ];
    }
1042430
public function getData()
    {
        if ($this->getTransactionReference() || $this->getCardReference()) {
            $this->txnMode = $this->getStoredDataMode();
            $this->validate('amount');
        } else {
            $this->txnMode = $this->getBasicMode();
            $this->validate('amount', 'card');
            $this->getCard()->validate();
        }

        $data = $this->getBaseData();
        $data['txnRequest'] = $this->getXmlString();

        return $data;
    }
982136
public function retrieveAllPaymentmethods()
    {
        if (isset($this->_paymentMethodsArray))
            return $this;

        $obj = new stdClass();
        // Must be in specific order for checksum ---------
        $obj->MerchantID = $this->_merchantID;
        $obj->SecretCode = $this->_secretCode;
        $obj->Timestamp = $this->getTimeStamp();
        // ------------------------------------------------
        $obj->Checksum = $this->generateChecksum($obj);
        $obj->SecretCode = null;

        $this->_paymentMethods = $this->client->GetMyPaymentMethods(array('request' => $obj));

        if (isset($this->_paymentMethods->GetMyPaymentMethodsResult->PaymentMethods->PaymentMethod)) {
            $this->_paymentMethodsArray = $this->clean($this->_paymentMethods);
        }

        return $this;
    }
801441
public function extend() 
    {
        return [
            "amount"    => $this->amount()->toMicro(),
            "recipient" => $this->recipient()->address()->toClean(),
            "message"   => $this->message()->toDTO(),
            // transaction type specialization
            "type"      => TransactionType::TRANSFER,
        ];
    }
195152
public function getData()
    {
        $this->validate('amount', 'transactionReference');

        $data = $this->getBaseData();
        $data['txnRequest'] = $this->getXmlString();

        return $data;
    }
806042
public function getVatAmounts()
    {
        $amounts = [];

        foreach ($this->getOrderElements() as $orderElement) {
            $rate = $orderElement->getVatRate();
            $amount = (string) $orderElement->getVatAmount();

            if (isset($amounts[$rate])) {
                $amounts[$rate]['amount'] = bcadd($amounts[$rate]['amount'], $amount);
            } else {
                $amounts[$rate] = [
                    'rate' => $rate,
                    'amount' => $amount,
                ];
            }
        }

        return $amounts;
    }
398906
protected function getAllowedPaymentFrequencies()
    {
        return array(
            static::DAILY,
            static::WEEKLY,
            static::SEMIMONTHLY,
            static::MONTHLY,
            static::BIMONTHLY,
            static::QUATERLY,
            static::EVERY_4_MONTHS,
            static::SEMIANNUAL,
            static::ANNUAL,
        );
    }
329661
@Nullable
    public List<Transaction> getTransactions() {
        return transactions == null ? null : ImmutableList.copyOf(transactions);
    }
948854
public function getPaymentMethods()
    {
        if (isset($this->data['_embedded']["methods"]) === false) {
            return [];
        }

        $paymentMethods = [];
        foreach ($this->data['_embedded']["methods"] as $method) {
            $paymentMethods[] = new PaymentMethod($method['id'], $method['description']);
        }

        return $paymentMethods;
    }
719389
protected function getPaymentTransactionStructure()
    {
        return [
            'return_success_url'  => $this->return_success_url,
            'return_failure_url'  => $this->return_failure_url,
            'amount'              => $this->transformAmount($this->amount, $this->currency),
            'currency'            => $this->currency,
            'is_payout'           => var_export($this->is_payout, true),
            'customer_account_id' => $this->customer_account_id,
            'customer_email'      => $this->customer_email,
            'customer_phone'      => $this->customer_phone,
            'billing_address'     => $this->getBillingAddressParamsStructure(),
            'shipping_address'    => $this->getShippingAddressParamsStructure()
        ];
    }
1279239
protected function getPaymentTransactionStructure()
    {
        return array_merge(
            [
                'amount'   => \Genesis\Utils\Currency::amountToExponent($this->amount, $this->currency),
                'currency' => $this->currency,
            ],
            $this->items instanceof Items ? $this->items->toArray() : []
        );
    }
1334934
public function getPaymentMethods()
    {
        $obj = new stdClass();

        // Must be in specific order for checksum --
        $obj->Timestamp = $this->getTimeStamp();
        $obj->SessionID = $this->getSessionID();
        $obj->PinCode = $this->getPinCode();
        $obj->UserAgent = $this->getUserAgent();
        // -----------------------------------------
        // Generate Checksum
        $obj->Checksum = $this->generateChecksum($obj);

        // Ask for GetPaymentMethods and get response
        $result = $this->client->GetPaymentMethods($obj);
        $result = $result->GetPaymentMethodsResult;
        $methods = isset($result->PaymentMethods->PaymentMethod) ? $result->PaymentMethods->PaymentMethod : null;

        $obj->Timestamp = $result->Timestamp;

        if (!is_null($methods)) {
            // Assign all properties of the PaymentMethods object as property of mainObject
            $obj = $this->parseForChecksum($obj, $methods);
        }

        // Unset properties for new Checksum
        unset($obj->Checksum);

        // Verify response data by making a new Checksum
        $CheckSum = $this->generateChecksum($obj);

        // Compare Checksums
        if ($result->Checksum != $CheckSum)
            throw new Exception('Data could not be verified');

        return (array) $methods;
    }