App\Ninja\PaymentDrivers\BasePaymentDriver::paymentDetails PHP Method

paymentDetails() protected method

protected paymentDetails ( $paymentMethod = false )
    protected function paymentDetails($paymentMethod = false)
    {
        $invoice = $this->invoice();
        $gatewayTypeAlias = $this->gatewayType == GATEWAY_TYPE_TOKEN ? $this->gatewayType : GatewayType::getAliasFromId($this->gatewayType);
        $completeUrl = url('complete/' . $this->invitation->invitation_key . '/' . $gatewayTypeAlias);
        $data = ['amount' => $invoice->getRequestedAmount(), 'currency' => $invoice->getCurrencyCode(), 'returnUrl' => $completeUrl, 'cancelUrl' => $this->invitation->getLink(), 'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}", 'transactionId' => $invoice->invoice_number, 'transactionType' => 'Purchase', 'ip' => Request::ip()];
        if ($paymentMethod) {
            if ($this->customerReferenceParam) {
                $data[$this->customerReferenceParam] = $paymentMethod->account_gateway_token->token;
            }
            $data[$this->sourceReferenceParam] = $paymentMethod->source_reference;
        } elseif ($this->input) {
            $data['card'] = new CreditCard($this->paymentDetailsFromInput($this->input));
        } else {
            $data['card'] = new CreditCard($this->paymentDetailsFromClient());
        }
        return $data;
    }

Usage Example

 protected function paymentDetails($paymentMethod = false)
 {
     $data = parent::paymentDetails($paymentMethod);
     if ($transactionId = Session::get($this->invitation->id . 'payment_ref')) {
         $data['transaction_id'] = $transactionId;
     }
     $data['applicationFee'] = env('WEPAY_APP_FEE_MULTIPLIER') * $data['amount'] + env('WEPAY_APP_FEE_FIXED');
     $data['feePayer'] = env('WEPAY_FEE_PAYER');
     $data['callbackUri'] = $this->accountGateway->getWebhookUrl();
     if ($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER, $paymentMethod)) {
         $data['paymentMethodType'] = 'payment_bank';
     }
     return $data;
 }
All Usage Examples Of App\Ninja\PaymentDrivers\BasePaymentDriver::paymentDetails