mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Added PayPal buttonsource
This commit is contained in:
parent
392c1facc0
commit
7150a148af
@ -419,7 +419,7 @@ class PaymentController extends BaseController
|
||||
}
|
||||
|
||||
$gateway = $this->paymentService->createGateway($accountGateway);
|
||||
$details = $this->paymentService->getPaymentDetails($invitation, $data);
|
||||
$details = $this->paymentService->getPaymentDetails($invitation, $accountGateway, $data);
|
||||
|
||||
// check if we're creating/using a billing token
|
||||
if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
|
||||
@ -437,7 +437,7 @@ class PaymentController extends BaseController
|
||||
}
|
||||
|
||||
$response = $gateway->purchase($details)->send();
|
||||
|
||||
|
||||
if ($accountGateway->gateway_id == GATEWAY_EWAY) {
|
||||
$ref = $response->getData()['AccessCode'];
|
||||
} elseif ($accountGateway->gateway_id == GATEWAY_TWO_CHECKOUT) {
|
||||
@ -515,7 +515,7 @@ class PaymentController extends BaseController
|
||||
|
||||
try {
|
||||
if (method_exists($gateway, 'completePurchase') && !$accountGateway->isGateway(GATEWAY_TWO_CHECKOUT)) {
|
||||
$details = $this->paymentService->getPaymentDetails($invitation);
|
||||
$details = $this->paymentService->getPaymentDetails($invitation, $accountGateway);
|
||||
$response = $gateway->completePurchase($details)->send();
|
||||
$ref = $response->getTransactionReference();
|
||||
|
||||
|
@ -36,7 +36,7 @@ class PaymentService {
|
||||
$gateway->$function($val);
|
||||
}
|
||||
|
||||
if ($accountGateway->gateway->id == GATEWAY_DWOLLA) {
|
||||
if ($accountGateway->isGateway(GATEWAY_DWOLLA)) {
|
||||
if ($gateway->getSandbox() && isset($_ENV['DWOLLA_SANDBOX_KEY']) && isset($_ENV['DWOLLA_SANSBOX_SECRET'])) {
|
||||
$gateway->setKey($_ENV['DWOLLA_SANDBOX_KEY']);
|
||||
$gateway->setSecret($_ENV['DWOLLA_SANSBOX_SECRET']);
|
||||
@ -49,7 +49,7 @@ class PaymentService {
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
public function getPaymentDetails($invitation, $input = null)
|
||||
public function getPaymentDetails($invitation, $accountGateway, $input = null)
|
||||
{
|
||||
$invoice = $invitation->invoice;
|
||||
$account = $invoice->account;
|
||||
@ -66,8 +66,7 @@ class PaymentService {
|
||||
}
|
||||
|
||||
$card = new CreditCard($data);
|
||||
|
||||
return [
|
||||
$data = [
|
||||
'amount' => $invoice->getRequestedAmount(),
|
||||
'card' => $card,
|
||||
'currency' => $currencyCode,
|
||||
@ -77,6 +76,12 @@ class PaymentService {
|
||||
'transactionId' => $invoice->invoice_number,
|
||||
'transactionType' => 'Purchase',
|
||||
];
|
||||
|
||||
if ($accountGateway->isGateway(GATEWAY_PAYPAL_EXPRESS) || $accountGateway->isGateway(GATEWAY_PAYPAL_PRO)) {
|
||||
$data['ButtonSource'] = 'InvoiceNinja_SP';
|
||||
};
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function convertInputForOmnipay($input)
|
||||
|
Loading…
Reference in New Issue
Block a user