Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
49
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/BalanceCheckProvider.php
vendored
Normal file
49
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/BalanceCheckProvider.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Anand\LaravelPaytmWallet\Providers;
|
||||
use Illuminate\Http\Request;
|
||||
// require __DIR__.'/../../lib/encdec_paytm.php';
|
||||
|
||||
class BalanceCheckProvider extends PaytmWalletProvider{
|
||||
|
||||
|
||||
private $parameters = null;
|
||||
|
||||
|
||||
|
||||
public function prepare($params = array()){
|
||||
$defaults = [
|
||||
'token' => NULL,
|
||||
];
|
||||
|
||||
$_p = array_merge($defaults, $params);
|
||||
foreach ($_p as $key => $value) {
|
||||
|
||||
if ($value == NULL) {
|
||||
|
||||
throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->parameters = $_p;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function check(){
|
||||
if ($this->parameters == null) {
|
||||
throw new \Exception("prepare() method not called");
|
||||
}
|
||||
return $this->beginTransaction();
|
||||
}
|
||||
|
||||
private function beginTransaction(){
|
||||
|
||||
$params = [
|
||||
'MID' => $this->merchant_id,
|
||||
'TOKEN' => $this->parameters['token']
|
||||
];
|
||||
return $this->api_call($this->paytm_balance_check_url, $params);
|
||||
}
|
||||
|
||||
}
|
||||
38
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/PaytmAppProvider.php
vendored
Normal file
38
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/PaytmAppProvider.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Anand\LaravelPaytmWallet\Providers;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PaytmAppProvider extends PaytmWalletProvider{
|
||||
|
||||
public function generate(Request $request){
|
||||
$checksum = getChecksumFromArray($request->all(), $this->merchant_key);
|
||||
return response()->json([ 'CHECKSUMHASH' => $checksum, 'ORDER_ID' => $request->get('ORDER_ID'), 'payt_STATUS' => '1' ]);
|
||||
}
|
||||
|
||||
public function verify(Request $request, $success = null, $error = null){
|
||||
$paramList = $request->all();
|
||||
$return_array = $request->all();
|
||||
$paytmChecksum = $request->get('CHECKSUMHASH');
|
||||
|
||||
$isValidChecksum = verifychecksum_e($paramList, $this->merchant_key, $paytmChecksum);
|
||||
|
||||
if ($isValidChecksum) {
|
||||
if ($success != null && is_callable($success)) {
|
||||
$success();
|
||||
}
|
||||
}else{
|
||||
if ($error != null && is_callable($error)) {
|
||||
$error();
|
||||
}
|
||||
}
|
||||
|
||||
$return_array["IS_CHECKSUM_VALID"] = $isValidChecksum ? "Y" : "N";
|
||||
unset($return_array["CHECKSUMHASH"]);
|
||||
$encoded_json = htmlentities(json_encode($return_array));
|
||||
|
||||
return view('paytmwallet::app_redirect')->with('json', $encoded_json);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
65
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/PaytmWalletProvider.php
vendored
Normal file
65
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/PaytmWalletProvider.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Anand\LaravelPaytmWallet\Providers;
|
||||
use Anand\LaravelPaytmWallet\Contracts\Provider as ProviderContract;
|
||||
use Illuminate\Http\Request;
|
||||
require __DIR__.'/../../lib/encdec_paytm.php';
|
||||
|
||||
class PaytmWalletProvider implements ProviderContract {
|
||||
|
||||
protected $request;
|
||||
protected $response;
|
||||
protected $paytm_txn_url;
|
||||
protected $paytm_txn_status_url;
|
||||
protected $paytm_refund_url;
|
||||
protected $paytm_refund_status_url;
|
||||
protected $paytm_balance_check_url;
|
||||
|
||||
protected $merchant_key;
|
||||
protected $merchant_id;
|
||||
protected $merchant_website;
|
||||
protected $industry_type;
|
||||
protected $channel;
|
||||
|
||||
|
||||
public function __construct(Request $request, $config){
|
||||
$this->request = $request;
|
||||
|
||||
if ($config['env'] == 'production') {
|
||||
$domain = 'securegw.paytm.in';
|
||||
}else{
|
||||
$domain = 'securegw-stage.paytm.in';
|
||||
}
|
||||
$this->paytm_txn_url = 'https://'.$domain.'/theia/processTransaction';
|
||||
$this->paytm_txn_status_url = 'https://'.$domain.'/merchant-status/getTxnStatus';
|
||||
$this->paytm_refund_url = 'https://'.$domain.'/refund/HANDLER_INTERNAL/REFUND';
|
||||
$this->paytm_refund_status_url = 'https://'.$domain.'/refund/HANDLER_INTERNAL/getRefundStatus';
|
||||
$this->paytm_balance_check_url = 'https://'.$domain.'/refund/HANDLER_INTERNAL/getRefundStatus';
|
||||
|
||||
$this->merchant_key = $config['merchant_key'];
|
||||
$this->merchant_id = $config['merchant_id'];
|
||||
$this->merchant_website = $config['merchant_website'];
|
||||
$this->industry_type = $config['industry_type'];
|
||||
$this->channel = $config['channel'];
|
||||
}
|
||||
|
||||
public function response(){
|
||||
$checksum = $this->request->get('CHECKSUMHASH');
|
||||
if(verifychecksum_e($this->request->post(), $this->merchant_key, $checksum) == "TRUE"){
|
||||
return $this->response = $this->request->post();
|
||||
}
|
||||
throw new \Exception('Invalid checksum');
|
||||
}
|
||||
|
||||
public function getResponseMessage() {
|
||||
return $this->response()['RESPMSG'];
|
||||
}
|
||||
|
||||
public function api_call($url, $params){
|
||||
return callAPI($url, $params);
|
||||
}
|
||||
|
||||
public function api_call_new($url, $params){
|
||||
return callAPI($url, $params);
|
||||
}
|
||||
}
|
||||
76
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/ReceivePaymentProvider.php
vendored
Normal file
76
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/ReceivePaymentProvider.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Anand\LaravelPaytmWallet\Providers;
|
||||
use Anand\LaravelPaytmWallet\Facades\PaytmWallet;
|
||||
use Anand\LaravelPaytmWallet\Traits\HasTransactionStatus;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ReceivePaymentProvider extends PaytmWalletProvider{
|
||||
use HasTransactionStatus;
|
||||
|
||||
private $parameters = null;
|
||||
private $view = 'paytmwallet::transact';
|
||||
|
||||
public function prepare($params = array()){
|
||||
$defaults = [
|
||||
'order' => NULL,
|
||||
'user' => NULL,
|
||||
'amount' => NULL,
|
||||
'callback_url' => NULL,
|
||||
'email' => NULL,
|
||||
'mobile_number' => NULL,
|
||||
];
|
||||
|
||||
$_p = array_merge($defaults, $params);
|
||||
foreach ($_p as $key => $value) {
|
||||
|
||||
if ($value == NULL) {
|
||||
|
||||
throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->parameters = $_p;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function receive(){
|
||||
if ($this->parameters == null) {
|
||||
throw new \Exception("prepare() method not called");
|
||||
}
|
||||
return $this->beginTransaction();
|
||||
}
|
||||
|
||||
public function view($view) {
|
||||
if($view) {
|
||||
$this->view = $view;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function beginTransaction(){
|
||||
$params = [
|
||||
'REQUEST_TYPE' => 'DEFAULT',
|
||||
'MID' => $this->merchant_id,
|
||||
'ORDER_ID' => $this->parameters['order'],
|
||||
'CUST_ID' => $this->parameters['user'],
|
||||
'INDUSTRY_TYPE_ID' => $this->industry_type,
|
||||
'CHANNEL_ID' => $this->channel,
|
||||
'TXN_AMOUNT' => $this->parameters['amount'],
|
||||
'WEBSITE' => $this->merchant_website,
|
||||
'CALLBACK_URL' => $this->parameters['callback_url'],
|
||||
'MOBILE_NO' => $this->parameters['mobile_number'],
|
||||
'EMAIL' => $this->parameters['email'],
|
||||
];
|
||||
return view('paytmwallet::form')->with('view', $this->view)->with('params', $params)->with('txn_url', $this->paytm_txn_url)->with('checkSum', getChecksumFromArray($params, $this->merchant_key));
|
||||
}
|
||||
|
||||
public function getOrderId(){
|
||||
return $this->response()['ORDERID'];
|
||||
}
|
||||
public function getTransactionId(){
|
||||
return $this->response()['TXNID'];
|
||||
}
|
||||
|
||||
}
|
||||
70
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/RefundPaymentProvider.php
vendored
Normal file
70
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/RefundPaymentProvider.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Anand\LaravelPaytmWallet\Providers;
|
||||
use Anand\LaravelPaytmWallet\Facades\PaytmWallet;
|
||||
use Anand\LaravelPaytmWallet\Traits\HasTransactionStatus;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class RefundPaymentProvider extends PaytmWalletProvider{
|
||||
use HasTransactionStatus;
|
||||
|
||||
private $parameters = null;
|
||||
protected $response;
|
||||
|
||||
public function prepare($params = array()){
|
||||
$defaults = [
|
||||
'order' => NULL,
|
||||
'reference' => NULL,
|
||||
'amount' => NULL,
|
||||
'transaction' => NULL
|
||||
];
|
||||
|
||||
$_p = array_merge($defaults, $params);
|
||||
foreach ($_p as $key => $value) {
|
||||
|
||||
if ($value == NULL) {
|
||||
|
||||
throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->parameters = $_p;
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function beginTransaction(){
|
||||
$params = array();
|
||||
$params["MID"] = $this->merchant_id;
|
||||
$params["ORDERID"] = $this->parameters['order'];
|
||||
$params["REFID"] = $this->parameters['reference'];
|
||||
$params["TXNTYPE"] = 'REFUND';
|
||||
$params["REFUNDAMOUNT"] = $this->parameters['amount'];
|
||||
$params["TXNID"] = $this->parameters['transaction'];
|
||||
$chk = getChecksumFromArray($params, $this->merchant_key);
|
||||
$params['CHECKSUM'] = $chk;
|
||||
$this->response = $this->api_call_new($this->paytm_refund_url, $params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function initiate(){
|
||||
if ($this->parameters == null) {
|
||||
throw new \Exception("prepare() method not called");
|
||||
}
|
||||
$this->beginTransaction();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function response(){
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function isRefundAlreadyRaised() {
|
||||
if ($this->isFailed() && $this->response()['RESPCODE'] == PaytmWallet::REPSONSE_REFUND_ALREADY_RAISED) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
66
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/RefundStatusCheckProvider.php
vendored
Normal file
66
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/RefundStatusCheckProvider.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace Anand\LaravelPaytmWallet\Providers;
|
||||
use Anand\LaravelPaytmWallet\Traits\HasTransactionStatus;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class RefundStatusCheckProvider extends PaytmWalletProvider{
|
||||
use HasTransactionStatus;
|
||||
|
||||
private $parameters = null;
|
||||
protected $response;
|
||||
|
||||
public function prepare($params = array()){
|
||||
$defaults = [
|
||||
'order' => NULL,
|
||||
'reference' => NULL,
|
||||
];
|
||||
|
||||
$_p = array_merge($defaults, $params);
|
||||
foreach ($_p as $key => $value) {
|
||||
|
||||
if ($value == NULL) {
|
||||
|
||||
throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->parameters = $_p;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function check(){
|
||||
if ($this->parameters == null) {
|
||||
throw new \Exception("prepare() method not called");
|
||||
}
|
||||
return $this->beginTransaction();
|
||||
}
|
||||
|
||||
|
||||
private function beginTransaction(){
|
||||
$params = array(
|
||||
'MID' => $this->merchant_id,
|
||||
'ORDERID' => $this->parameters['order'],
|
||||
'REFID' => $this->parameters['reference']
|
||||
);
|
||||
$chk = getChecksumFromArray($params, $this->merchant_key);
|
||||
$params['CHECKSUM'] = $chk;
|
||||
$this->response = $this->api_call_new($this->paytm_txn_status_url, $params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function response(){
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function getOrderId(){
|
||||
return $this->response()['ORDERID'];
|
||||
}
|
||||
public function getTransactionId(){
|
||||
return $this->response()['TXNID'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
63
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/StatusCheckProvider.php
vendored
Normal file
63
vendor/anandsiddharth/laravel-paytm-wallet/src/Providers/StatusCheckProvider.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace Anand\LaravelPaytmWallet\Providers;
|
||||
use Anand\LaravelPaytmWallet\Traits\HasTransactionStatus;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class StatusCheckProvider extends PaytmWalletProvider{
|
||||
use HasTransactionStatus;
|
||||
|
||||
private $parameters = null;
|
||||
protected $response;
|
||||
|
||||
public function prepare($params = array()){
|
||||
$defaults = [
|
||||
'order' => NULL,
|
||||
];
|
||||
|
||||
$_p = array_merge($defaults, $params);
|
||||
foreach ($_p as $key => $value) {
|
||||
|
||||
if ($value == NULL) {
|
||||
|
||||
throw new \Exception(' \''.$key.'\' parameter not specified in array passed in prepare() method');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->parameters = $_p;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function check(){
|
||||
if ($this->parameters == null) {
|
||||
throw new \Exception("prepare() method not called");
|
||||
}
|
||||
return $this->beginTransaction();
|
||||
}
|
||||
|
||||
|
||||
private function beginTransaction(){
|
||||
$params = array(
|
||||
'MID' => $this->merchant_id,
|
||||
'ORDERID' => $this->parameters['order']
|
||||
);
|
||||
$chk = getChecksumFromArray($params, $this->merchant_key);
|
||||
$params['CHECKSUMHASH'] = $chk;
|
||||
$this->response = $this->api_call_new($this->paytm_txn_status_url, $params);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function response(){
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function getOrderId(){
|
||||
return $this->response()['ORDERID'];
|
||||
}
|
||||
public function getTransactionId(){
|
||||
return $this->response()['TXNID'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user