mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Updates for paypal rest
This commit is contained in:
parent
7853257234
commit
8aa8d6521c
@ -195,13 +195,13 @@ class Gateway extends StaticModel
|
|||||||
GatewayType::PAYPAL => ['refund' => false, 'token_billing' => false],
|
GatewayType::PAYPAL => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::CREDIT_CARD => ['refund' => false, 'token_billing' => false],
|
GatewayType::CREDIT_CARD => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::VENMO => ['refund' => false, 'token_billing' => false],
|
GatewayType::VENMO => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::SEPA => ['refund' => false, 'token_billing' => false],
|
// GatewayType::SEPA => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::BANCONTACT => ['refund' => false, 'token_billing' => false],
|
// GatewayType::BANCONTACT => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::EPS => ['refund' => false, 'token_billing' => false],
|
// GatewayType::EPS => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::MYBANK => ['refund' => false, 'token_billing' => false],
|
// GatewayType::MYBANK => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::PAYLATER => ['refund' => false, 'token_billing' => false],
|
// GatewayType::PAYLATER => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::PRZELEWY24 => ['refund' => false, 'token_billing' => false],
|
// GatewayType::PRZELEWY24 => ['refund' => false, 'token_billing' => false],
|
||||||
GatewayType::SOFORT => ['refund' => false, 'token_billing' => false],
|
// GatewayType::SOFORT => ['refund' => false, 'token_billing' => false],
|
||||||
]; //Paypal
|
]; //Paypal
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -38,25 +38,28 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
private string $api_endpoint_url = '';
|
private string $api_endpoint_url = '';
|
||||||
|
|
||||||
|
private string $paypal_payment_method = '';
|
||||||
|
|
||||||
|
private array $funding_options = [
|
||||||
|
3 => 'paypal',
|
||||||
|
1 => 'card',
|
||||||
|
25 => 'venmo',
|
||||||
|
9 => 'sepa',
|
||||||
|
12 => 'bancontact',
|
||||||
|
17 => 'eps',
|
||||||
|
15 => 'giropay',
|
||||||
|
13 => 'ideal',
|
||||||
|
26 => 'mercadopago',
|
||||||
|
27 => 'mybank',
|
||||||
|
28 => 'paylater',
|
||||||
|
16 => 'p24',
|
||||||
|
7 => 'sofort'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
public function gatewayTypes()
|
public function gatewayTypes()
|
||||||
{
|
{
|
||||||
|
|
||||||
$enums = [
|
|
||||||
3 => 'paypal',
|
|
||||||
1 => 'card',
|
|
||||||
25 => 'venmo',
|
|
||||||
9 => 'sepa',
|
|
||||||
12 => 'bancontact',
|
|
||||||
17 => 'eps',
|
|
||||||
15 => 'giropay',
|
|
||||||
13 => 'ideal',
|
|
||||||
26 => 'mercadopago',
|
|
||||||
27 => 'mybank',
|
|
||||||
28 => 'paylater',
|
|
||||||
16 => 'p24',
|
|
||||||
7 => 'sofort'
|
|
||||||
];
|
|
||||||
|
|
||||||
$funding_options = [];
|
$funding_options = [];
|
||||||
|
|
||||||
foreach ($this->company_gateway->fees_and_limits as $key => $value) {
|
foreach ($this->company_gateway->fees_and_limits as $key => $value) {
|
||||||
@ -65,12 +68,8 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $funding_options;
|
return $funding_options;
|
||||||
|
|
||||||
|
|
||||||
// return [
|
|
||||||
// GatewayType::PAYPAL,
|
|
||||||
// ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
@ -88,6 +87,8 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function setPaymentMethod($payment_method_id)
|
public function setPaymentMethod($payment_method_id)
|
||||||
{
|
{
|
||||||
|
$this->paypal_payment_method = $this->funding_options[$payment_method_id];
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
$data['client_id'] = $this->company_gateway->getConfigField('clientId');
|
$data['client_id'] = $this->company_gateway->getConfigField('clientId');
|
||||||
$data['token'] = $this->getClientToken();
|
$data['token'] = $this->getClientToken();
|
||||||
$data['order_id'] = $this->createOrder($data);
|
$data['order_id'] = $this->createOrder($data);
|
||||||
$data['funding_options'] = $this->getFundingOptions();
|
$data['funding_options'] = $this->paypal_payment_method;
|
||||||
|
|
||||||
return render('gateways.paypal.pay', $data);
|
return render('gateways.paypal.pay', $data);
|
||||||
|
|
||||||
@ -130,16 +131,16 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
3 => 'paypal',
|
3 => 'paypal',
|
||||||
1 => 'card',
|
1 => 'card',
|
||||||
25 => 'venmo',
|
25 => 'venmo',
|
||||||
9 => 'sepa',
|
// 9 => 'sepa',
|
||||||
12 => 'bancontact',
|
// 12 => 'bancontact',
|
||||||
17 => 'eps',
|
// 17 => 'eps',
|
||||||
15 => 'giropay',
|
// 15 => 'giropay',
|
||||||
13 => 'ideal',
|
// 13 => 'ideal',
|
||||||
26 => 'mercadopago',
|
// 26 => 'mercadopago',
|
||||||
27 => 'mybank',
|
// 27 => 'mybank',
|
||||||
28 => 'paylater',
|
// 28 => 'paylater',
|
||||||
16 => 'p24',
|
// 16 => 'p24',
|
||||||
7 => 'sofort'
|
// 7 => 'sofort'
|
||||||
];
|
];
|
||||||
|
|
||||||
$funding_options = '';
|
$funding_options = '';
|
||||||
@ -231,10 +232,6 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
[
|
[
|
||||||
"description" =>ctrans('texts.invoice_number').'# '.$invoice->number,
|
"description" =>ctrans('texts.invoice_number').'# '.$invoice->number,
|
||||||
"invoice_id" => $invoice->number,
|
"invoice_id" => $invoice->number,
|
||||||
// 'reference_id' => 'PUHF',
|
|
||||||
// 'description' => 'Sporting Goods',
|
|
||||||
// 'custom_id' => 'CUST-HighFashions',
|
|
||||||
// 'soft_descriptor' => 'HighFashions',
|
|
||||||
"amount" => [
|
"amount" => [
|
||||||
"value" => (string)$data['amount_with_fee'],
|
"value" => (string)$data['amount_with_fee'],
|
||||||
"currency_code"=> $this->client->currency()->code,
|
"currency_code"=> $this->client->currency()->code,
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('footer')
|
@push('footer')
|
||||||
<script src="https://www.paypal.com/sdk/js?buyer-country=DE¤cy=EUR&enable-funding={$funding_options}&components=buttons,hosted-fields,funding-eligibility&intent=capture&client-id={!! $client_id !!}" data-client-token="{!! $token !!}">
|
<script src="https://www.paypal.com/sdk/js?buyer-country=US¤cy=USD&enable-funding={!! $funding_options !!}&disable-funding=credit&components=buttons,hosted-fields,funding-eligibility&intent=capture&client-id={!! $client_id !!}" data-client-token="{!! $token !!}">
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user