Updates for paypal rest

This commit is contained in:
David Bomba 2023-07-23 09:32:05 +10:00
parent 7853257234
commit 8aa8d6521c
3 changed files with 41 additions and 44 deletions

View File

@ -195,13 +195,13 @@ class Gateway extends StaticModel
GatewayType::PAYPAL => ['refund' => false, 'token_billing' => false],
GatewayType::CREDIT_CARD => ['refund' => false, 'token_billing' => false],
GatewayType::VENMO => ['refund' => false, 'token_billing' => false],
GatewayType::SEPA => ['refund' => false, 'token_billing' => false],
GatewayType::BANCONTACT => ['refund' => false, 'token_billing' => false],
GatewayType::EPS => ['refund' => false, 'token_billing' => false],
GatewayType::MYBANK => ['refund' => false, 'token_billing' => false],
GatewayType::PAYLATER => ['refund' => false, 'token_billing' => false],
GatewayType::PRZELEWY24 => ['refund' => false, 'token_billing' => false],
GatewayType::SOFORT => ['refund' => false, 'token_billing' => false],
// GatewayType::SEPA => ['refund' => false, 'token_billing' => false],
// GatewayType::BANCONTACT => ['refund' => false, 'token_billing' => false],
// GatewayType::EPS => ['refund' => false, 'token_billing' => false],
// GatewayType::MYBANK => ['refund' => false, 'token_billing' => false],
// GatewayType::PAYLATER => ['refund' => false, 'token_billing' => false],
// GatewayType::PRZELEWY24 => ['refund' => false, 'token_billing' => false],
// GatewayType::SOFORT => ['refund' => false, 'token_billing' => false],
]; //Paypal
default:

View File

@ -38,25 +38,28 @@ class PayPalRestPaymentDriver extends BaseDriver
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()
{
$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 = [];
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()
@ -88,6 +87,8 @@ class PayPalRestPaymentDriver extends BaseDriver
public function setPaymentMethod($payment_method_id)
{
$this->paypal_payment_method = $this->funding_options[$payment_method_id];
return $this;
}
@ -117,7 +118,7 @@ class PayPalRestPaymentDriver extends BaseDriver
$data['client_id'] = $this->company_gateway->getConfigField('clientId');
$data['token'] = $this->getClientToken();
$data['order_id'] = $this->createOrder($data);
$data['funding_options'] = $this->getFundingOptions();
$data['funding_options'] = $this->paypal_payment_method;
return render('gateways.paypal.pay', $data);
@ -130,16 +131,16 @@ class PayPalRestPaymentDriver extends BaseDriver
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'
// 9 => 'sepa',
// 12 => 'bancontact',
// 17 => 'eps',
// 15 => 'giropay',
// 13 => 'ideal',
// 26 => 'mercadopago',
// 27 => 'mybank',
// 28 => 'paylater',
// 16 => 'p24',
// 7 => 'sofort'
];
$funding_options = '';
@ -231,10 +232,6 @@ class PayPalRestPaymentDriver extends BaseDriver
[
"description" =>ctrans('texts.invoice_number').'# '.$invoice->number,
"invoice_id" => $invoice->number,
// 'reference_id' => 'PUHF',
// 'description' => 'Sporting Goods',
// 'custom_id' => 'CUST-HighFashions',
// 'soft_descriptor' => 'HighFashions',
"amount" => [
"value" => (string)$data['amount_with_fee'],
"currency_code"=> $this->client->currency()->code,

View File

@ -28,7 +28,7 @@
@endsection
@push('footer')
<script src="https://www.paypal.com/sdk/js?buyer-country=DE&currency=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&currency=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>