add paypal
This commit is contained in:
parent
fb398b2663
commit
c93b3cf643
|
|
@ -16,6 +16,7 @@
|
|||
"laravel/framework": "^9.0",
|
||||
"laravel/tinker": "^2.7",
|
||||
"spatie/laravel-permission": "^5.5",
|
||||
"srmklive/paypal": "^3.0",
|
||||
"stripe/stripe-php": "^8.8",
|
||||
"tormjens/eventy": "^0.8.0",
|
||||
"zanysoft/laravel-zip": "^1.0"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1d6f93c19127c046e4f6e1f02e446e1d",
|
||||
"content-hash": "baf9504253adfc5cc3fd0b9e881f26a1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
|
|
@ -3923,6 +3923,77 @@
|
|||
],
|
||||
"time": "2022-06-29T23:11:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "srmklive/paypal",
|
||||
"version": "3.0.16",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/srmklive/laravel-paypal.git",
|
||||
"reference": "7138c3b6665d270c40e0df603b8f0c07fc583ca3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/srmklive/laravel-paypal/zipball/7138c3b6665d270c40e0df603b8f0c07fc583ca3",
|
||||
"reference": "7138c3b6665d270c40e0df603b8f0c07fc583ca3",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"guzzlehttp/guzzle": "~7.0",
|
||||
"illuminate/support": "~6.0|~7.0|~8.0|~9.0",
|
||||
"nesbot/carbon": "~2.0",
|
||||
"php": ">=7.2|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.0|^9.0",
|
||||
"symfony/var-dumper": "~5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Srmklive\\PayPal\\Providers\\PayPalServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"PayPal": "Srmklive\\PayPal\\Facades\\PayPal"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Srmklive\\PayPal\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Raza Mehdi",
|
||||
"email": "srmk@outlook.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel plugin For Processing Payments Through Paypal Express Checkout. Can Be Used Independently With Other Applications.",
|
||||
"keywords": [
|
||||
"http",
|
||||
"laravel paypal",
|
||||
"paypal",
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/srmklive/laravel-paypal/issues",
|
||||
"source": "https://github.com/srmklive/laravel-paypal/tree/3.0.16"
|
||||
},
|
||||
"time": "2022-08-01T08:42:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "stripe/stripe-php",
|
||||
"version": "v8.12.0",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* PaypalController.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-08-10 18:57:56
|
||||
* @modified 2022-08-10 18:57:56
|
||||
*
|
||||
* https://www.zongscan.com/demo333/1311.html
|
||||
* https://clickysoft.com/how-to-integrate-paypal-payment-gateway-in-laravel/
|
||||
* https://www.positronx.io/how-to-integrate-paypal-payment-gateway-in-laravel/
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Plugin\Paypal\Controllers;
|
||||
|
||||
use Srmklive\PayPal\Services\PayPal;
|
||||
|
||||
class PaypalController
|
||||
{
|
||||
public function handlePayment()
|
||||
{
|
||||
$product = [];
|
||||
$product['items'] = [
|
||||
[
|
||||
'name' => 'Nike Joyride 2',
|
||||
'price' => 112,
|
||||
'desc' => 'Running shoes for Men',
|
||||
'qty' => 2
|
||||
]
|
||||
];
|
||||
|
||||
$product['invoice_id'] = 1;
|
||||
$product['invoice_description'] = "Order #{$product['invoice_id']} Bill";
|
||||
$product['return_url'] = route('success.payment');
|
||||
$product['cancel_url'] = route('cancel.payment');
|
||||
$product['total'] = 224;
|
||||
|
||||
$paypalModule = new PayPal();
|
||||
|
||||
$res = $paypalModule->setExpressCheckout($product);
|
||||
$res = $paypalModule->setExpressCheckout($product, true);
|
||||
|
||||
return redirect($res['paypal_link']);
|
||||
}
|
||||
|
||||
public function paymentCancel()
|
||||
{
|
||||
dd('Your payment has been declend. The payment cancelation page goes here!');
|
||||
}
|
||||
|
||||
public function paymentSuccess(Request $request)
|
||||
{
|
||||
$paypalModule = new ExpressCheckout;
|
||||
$response = $paypalModule->getExpressCheckoutDetails($request->token);
|
||||
|
||||
if (in_array(strtoupper($response['ACK']), ['SUCCESS', 'SUCCESSWITHWARNING'])) {
|
||||
dd('Payment was successfull. The payment success page goes here!');
|
||||
}
|
||||
|
||||
dd('Error occured!');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
PAYPAL
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* Stripe 字段
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-06-29 21:16:23
|
||||
* @modified 2022-06-29 21:16:23
|
||||
*/
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => 'sandbox_client_id',
|
||||
'label' => 'Sandbox Client ID',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'description' => '沙盒模式 Client ID',
|
||||
],
|
||||
[
|
||||
'name' => 'sandbox_Secret',
|
||||
'label' => 'Sandbox Secret',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'description' => '沙盒模式 Secret',
|
||||
],
|
||||
[
|
||||
'name' => 'live_client_id',
|
||||
'label' => 'Live Client ID',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'description' => '正式环境 Client ID',
|
||||
],
|
||||
[
|
||||
'name' => 'live_Secret',
|
||||
'label' => 'Live Secret',
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
'description' => '正式环境 Secret',
|
||||
],
|
||||
[
|
||||
'name' => 'sandbox_mode',
|
||||
'label' => '沙盒模式',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
['value' => '1', 'label' => '开启'],
|
||||
['value' => '0', 'label' => '关闭']
|
||||
],
|
||||
'required' => true,
|
||||
'description' => '',
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"code": "paypal",
|
||||
"name": "PayPal",
|
||||
"description": "PayPal 支付 <a href='https://developer.paypal.com/' target='_blank'>PayPal Developer</a>",
|
||||
"type": "payment",
|
||||
"version": "v1.0.0",
|
||||
"icon": "https://via.placeholder.com/100x100.png/99ee66?text=STRIPE",
|
||||
"author": {
|
||||
"name": "成都光大网络科技有限公司",
|
||||
"email": "yangjin@opencart.cn"
|
||||
}
|
||||
}
|
||||
|
|
@ -24,8 +24,8 @@ return [
|
|||
'plugin_description' => 'Description',
|
||||
'plugin_upload' => 'Upload(Only for zip file)',
|
||||
|
||||
'shipping' => 'Payment',
|
||||
'payment' => 'Shipping',
|
||||
'shipping' => 'Shipping',
|
||||
'payment' => 'Payment',
|
||||
'total' => 'Total',
|
||||
'view' => 'View',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue