Commit 8ba0434a by Tobin

dc

parent 32a21538
...@@ -298,18 +298,18 @@ class Api extends CI_Controller { ...@@ -298,18 +298,18 @@ class Api extends CI_Controller {
} }
} }
public function paymentGateway(){ public function paymentGateway(){
BayanPayPayment(); BayanPayPayment();
$networkOnlineArray =
// Please read the documentation and readme.txt file before implementing the code array('Network_Online_setting' =>
array(
$BayanPayArray = array('BayanPay_Online_setting' => array( 'merchantKey' => "+Hu4bL6iVk943JmFAvGtWEYMODFry4fad2I+iM0X2m0=",
'merchantKey' => "+Hu4bL6iVk943JmFAvGtWEYMODFry4fad2I+iM0X2m0=", // Your key provided by BayanPay 'merchantId' => '201901291000002',
'merchantId' => '201901291000002', // Your merchant ID ex: 201408191000001 'collaboratorId' => 'NI',
'collaboratorId' => 'BAYANPAY', // Constant used by BayanPay 'iv' => '0123456789abcdef',
'iv' => '0123456789abcdef', // Used for initializing CBC encryption mode 'url' => false
'url' => false // Set to false if you are using testing environment , set to true if you are using live environment
), ),
'Block_Existence_Indicator' => array( 'Block_Existence_Indicator' => array(
'transactionDataBlock' => true, 'transactionDataBlock' => true,
...@@ -328,15 +328,15 @@ $BayanPayArray = array('BayanPay_Online_setting' => array( ...@@ -328,15 +328,15 @@ $BayanPayArray = array('BayanPay_Online_setting' => array(
'transactionMode' => 'INTERNET', 'transactionMode' => 'INTERNET',
'payModeType' => 'CC', 'payModeType' => 'CC',
'transactionType' => '01', 'transactionType' => '01',
'currency' => 'SAR' 'currency' => 'AED'
), ),
'Field_Existence_Indicator_Billing' => array( 'Field_Existence_Indicator_Billing' => array(
'billToFirstName' => 'Soloman', 'billToFirstName' => 'Soloman',
'billToLastName' => 'Vandy', 'billToLastName' => 'Vandy',
'billToStreet1' => '123,ParkStreet', 'billToStreet1' => '123,ParkStreet',
'billToStreet2' => 'Park Street', 'billToStreet2' => 'Park Street',
'billToCity' => 'Riyadh', 'billToCity' => 'Mumbai',
'billToState' => 'Riyadh', 'billToState' => 'Maharashtra',
'billtoPostalCode' => '400081', 'billtoPostalCode' => '400081',
'billToCountry' => 'IN', 'billToCountry' => 'IN',
'billToEmail' => '[email protected]', 'billToEmail' => '[email protected]',
...@@ -350,8 +350,8 @@ $BayanPayArray = array('BayanPay_Online_setting' => array( ...@@ -350,8 +350,8 @@ $BayanPayArray = array('BayanPay_Online_setting' => array(
'shipToLastName' => 'Vandy', 'shipToLastName' => 'Vandy',
'shipToStreet1' => '123ParkStreet', 'shipToStreet1' => '123ParkStreet',
'shipToStreet2' => 'parkstreet', 'shipToStreet2' => 'parkstreet',
'shipToCity' => 'Riyadh', 'shipToCity' => 'Mumbai',
'shipToState' => 'Riyadh', 'shipToState' => 'Maharashtra',
'shipToPostalCode' => '400081', 'shipToPostalCode' => '400081',
'shipToCountry' => 'IN', 'shipToCountry' => 'IN',
'shipToPhoneNumber1' => '', 'shipToPhoneNumber1' => '',
...@@ -372,7 +372,8 @@ $BayanPayArray = array('BayanPay_Online_setting' => array( ...@@ -372,7 +372,8 @@ $BayanPayArray = array('BayanPay_Online_setting' => array(
'gatewayID' => '1026', // 10.Gateway ID 'gatewayID' => '1026', // 10.Gateway ID
'cardToken' => '1202' // 11.Card Token 'cardToken' => '1202' // 11.Card Token
), ),
'Field_Existence_Indicator_Merchant' => array( 'Field_Existence_Indicator_Merchant' =>
array(
'UDF1' => '115.121.181.112', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. 'UDF1' => '115.121.181.112', // This is a ‘user-defined field’ that can be used to send additional information about the transaction.
'UDF2' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. 'UDF2' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction.
'UDF3' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. 'UDF3' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction.
...@@ -384,7 +385,8 @@ $BayanPayArray = array('BayanPay_Online_setting' => array( ...@@ -384,7 +385,8 @@ $BayanPayArray = array('BayanPay_Online_setting' => array(
'UDF9' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction. 'UDF9' => 'abc', // This is a ‘user-defined field’ that can be used to send additional information about the transaction.
'UDF10' => 'abc' // This is a ‘user-defined field’ that can be used to send additional information about the transaction. 'UDF10' => 'abc' // This is a ‘user-defined field’ that can be used to send additional information about the transaction.
), ),
'Field_Existence_Indicator_OtherData' => array( 'Field_Existence_Indicator_OtherData' =>
array(
'custID' => '12345', 'custID' => '12345',
'transactionSource' => 'IVR', 'transactionSource' => 'IVR',
'productInfo' => 'Book', 'productInfo' => 'Book',
...@@ -393,45 +395,44 @@ $BayanPayArray = array('BayanPay_Online_setting' => array( ...@@ -393,45 +395,44 @@ $BayanPayArray = array('BayanPay_Online_setting' => array(
'itemCategory' => 'CD, Book', 'itemCategory' => 'CD, Book',
'ignoreValidationResult' => 'FALSE' 'ignoreValidationResult' => 'FALSE'
), ),
'Field_Existence_Indicator_DCC' => array( 'Field_Existence_Indicator_DCC' =>
array(
'DCCReferenceNumber' => '09898787', // DCC Reference Number 'DCCReferenceNumber' => '09898787', // DCC Reference Number
'foreignAmount' => '240.00', // Foreign Amount 'foreignAmount' => '240.00', // Foreign Amount
'ForeignCurrency' => 'USD' // Foreign Currency 'ForeignCurrency' => 'USD' // Foreign Currency
) )
); );
$BayanPayOnlineObject = new BayanPayBitmapPaymentIntegration($BayanPayArray); $networkOnlineObject = new NetworkonlieBitmapPaymentIntegration($networkOnlineArray);
if(isset($_REQUEST['responseParameter']) && $_REQUEST['responseParameter'] != ''){ if(isset($_REQUEST['responseParameter']) && $_REQUEST['responseParameter'] != ''){
$response = $BayanPayOnlineObject->decryptData($_REQUEST['responseParameter'],$BayanPayOnlineObject->merchantKey,$BayanPayOnlineObject->iv); $response = $networkOnlineObject->decryptData($_REQUEST['responseParameter'],$networkOnlineObject->merchantKey,$networkOnlineObject->iv);
$BayanPayOnlineObject->AddLog('BayanPay Response : '.print_r($response, TRUE),'16'); $networkOnlineObject->AddLog('Network Online Response : '.print_r($response, TRUE),'16');
} }
$requestParameter = $BayanPayOnlineObject->BayanPostData; $requestParameter = $networkOnlineObject->NeoPostData;
// // if($BayanPayOnlineObject->url) // if($networkOnlineObject->url)
// $requestUrl = 'https://payments.bayanpay.sa/direcpay/secure/PaymentTxnServlet'; // $requestUrl = 'https://www.timesofmoney.com/direcpay/secure/PaymentTxnServlet';
// else // else
$requestUrl = 'https://staging.bayanpay.sa/direcpay/secure/PaymentTxnServlet'; $requestUrl = 'https://staging.bayanpay.sa/direcpay/secure/PaymentTxnServlet';
echo '<form action="'.$requestUrl.'" method="post" name="network_online_payment"
?> id="network_online_payment">
<form action="<?php echo $requestUrl; ?>" method="post" name="BayanPay_online_payment" <input type="hidden" name="requestParameter" value='.$requestParameter.'>
id="BayanPay_online_payment">
<?php echo '<input type="hidden" name="requestParameter" value='.$requestParameter.'>'; ?>
<input type="submit" value="Submit"> <input type="submit" value="Submit">
</form> </form>';
<?php
} }
function baseurl(){ function baseurl(){
if(isset($_SERVER['HTTPS'])){ if(isset($_SERVER['HTTPS']))
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
} else
else{
$protocol = 'http'; $protocol = 'http';
}
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} }
} }
\ No newline at end of file
<?php
class Validation_model extends CI_Model {
public $validation_array = array(
'login'=> array('email_id'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'),
'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')
),
'password'=>array('required'=>array('code'=>'ER04', 'message'=>'Password is null or empty'),
)
),
'register'=> array('email_id'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'),
'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')
),
'phone'=>array('required'=>array('code'=>'ER07', 'message'=>'Phone no is null or empty'),
'phone'=>array('code'=>'ER08', 'message'=>'Invalid Phone no'),
),
'password'=>array('required'=>array('code'=>'ER04', 'message'=>'Password is null or empty'),
)
),
'forgot'=> array('email_id'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'),
'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')
)
),
'popular'=>array(),
'category'=>array(),
'locality'=>array(),
'favourite'=>array('event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty')
),
'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
'status'=>array('required'=>array('code'=>'ER18', 'message'=>'Favourite status is missing'),
),
),
'favouritelist'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
),
'bookedlist'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
),
'bookingdetails'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
'bookingCode'=>array('required'=>array('code'=>'ER23', 'message'=>'Booking code is null or empty'),
),
),
'cancel'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
'bookingCode'=>array('required'=>array('code'=>'ER23', 'message'=>'Booking code is null or empty'),
),
),
'confirm'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
'bookingCode'=>array('required'=>array('code'=>'ER23', 'message'=>'Booking code is null or empty'),
),
),
'userinfo'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
),
'profile'=>array('name'=>array('required'=>array('code'=>'ER27', 'message'=>'Name is null or empty')
),
'gender'=>array('required'=>array('code'=>'ER28', 'message'=>'Gender is null or empty')
),
'dob'=>array('required'=>array('code'=>'ER29', 'message'=>'Date of birth is null or empty')
),
'city'=>array('required'=>array('code'=>'ER30', 'message'=>'City no is null or empty')
),
'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
),
'tempbooking'=>array('event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty')
),
'event_date_id'=>array('required'=>array('code'=>'ER33', 'message'=>'Event date and time is null or empty')
),
'amount'=>array('required'=>array('code'=>'ER35', 'message'=>'Amount is null or empty')
),
'no_of_ticket'=>array('required'=>array('code'=>'ER36', 'message'=>'no of ticket is null or empty')
),
'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
),
'recommend'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
),
'search'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
),
'discover'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
'cat_id'=>array('required'=>array('code'=>'ER38', 'message'=>'Category id null or empty')
),
),
'event'=>array('auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
),
'event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty')
),
),
'searchEvent'=>array()
);
public function _consruct(){
parent::_construct();
}
public function validation_check($method_name, $parms) {
$state = 0;
$rules = $this->validation_array[$method_name];
$error_key = '';
foreach ($rules as $key => $value) {
foreach ($value as $keys => $values) {
switch ($keys) {
case 'required':
if(!isset($parms[$key]) || $parms[$key]=='' || $parms[$key]== null){
$state = 1;
$error_key = $values;
}
break;
case 'email':
if (isset($parms[$key]) && !filter_var($parms[$key], FILTER_VALIDATE_EMAIL)) {
$state = 1;
$error_key = $values;
}
break;
case 'phone':
if(isset($parms[$key])){
$phone = preg_replace('/[^0-9]/', '', $parms[$key]);
if (strlen($phone) !== 10) {
$state = 1;
$error_key = $values;
}
}
break;
default:
# code...
break;
}
if($state==1){
break;
}
}
if($state==1){
break;
}
}
return array('state'=>$state,'response'=>$error_key);
}
}
?>
\ No newline at end of file
...@@ -644,7 +644,7 @@ class Api_model extends CI_Model { ...@@ -644,7 +644,7 @@ class Api_model extends CI_Model {
if($user_id > 0) { if($user_id > 0) {
$event_id = $data['event_id']; $event_id = $data['event_id'];
$this->db->query("SET SESSION group_concat_max_len = 20000"); $this->db->query("SET SESSION group_concat_max_len = 20000");
$result = $this->db->query("SELECT events.event_id, AVG(review.rate) AS rate, MAX(booking.id) AS attendees, events.event_name,events.event_discription AS event_description,events.seat_pricing, events.custom_seat_layout, events.seat_pricing, venue.layout, venue.layout_details,venue.venue_name,venue.venue_details,venue.location,venue.location_lat AS lat,venue.location_lng AS lng, GROUP_CONCAT(DISTINCT `event_gallery`.`media_url`) AS media_url,favourite.status AS fav_status, events.max_booking, host_categories.show_layout, GROUP_CONCAT(DISTINCT tags.tag_name) AS tag, GROUP_CONCAT(DISTINCT CONCAT_WS('#',event_date_time.id,event_date_time.date,event_date_time.time)) AS date_time FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`status` != 0 LEFT JOIN booking on booking.event_id = events.event_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = ".$user_id." AND favourite.status = 1 LEFT JOIN event_tags ON events.event_id = event_tags.event_id LEFT JOIN tags on tags.tag_id = event_tags.tag_id LEFT JOIN review ON events.event_id = review.event_id INNER JOIN host_categories ON venue.host_cat_id = host_categories.host_cat_id WHERE events.event_id = ".$event_id." GROUP BY events.event_id, event_date_time.event_id")->result(); $result = $this->db->query("SELECT events.has_payment,events.event_id, AVG(review.rate) AS rate, MAX(booking.id) AS attendees, events.event_name,events.event_discription AS event_description,events.seat_pricing, events.custom_seat_layout, events.seat_pricing, venue.layout, venue.layout_details,venue.venue_name,venue.venue_details,venue.location,venue.location_lat AS lat,venue.location_lng AS lng, GROUP_CONCAT(DISTINCT `event_gallery`.`media_url`) AS media_url,favourite.status AS fav_status, events.max_booking, host_categories.show_layout, GROUP_CONCAT(DISTINCT tags.tag_name) AS tag, GROUP_CONCAT(DISTINCT CONCAT_WS('#',event_date_time.id,event_date_time.date,event_date_time.time)) AS date_time FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`status` != 0 LEFT JOIN booking on booking.event_id = events.event_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = ".$user_id." AND favourite.status = 1 LEFT JOIN event_tags ON events.event_id = event_tags.event_id LEFT JOIN tags on tags.tag_id = event_tags.tag_id LEFT JOIN review ON events.event_id = review.event_id INNER JOIN host_categories ON venue.host_cat_id = host_categories.host_cat_id WHERE events.event_id = ".$event_id." GROUP BY events.event_id, event_date_time.event_id")->result();
if(count($result)>0){ if(count($result)>0){
$resultData = array(); $resultData = array();
$event_layout = ''; $event_layout = '';
...@@ -676,6 +676,7 @@ class Api_model extends CI_Model { ...@@ -676,6 +676,7 @@ class Api_model extends CI_Model {
$media_url = explode(',', $rs->media_url); $media_url = explode(',', $rs->media_url);
$resData = array( $resData = array(
'has_payment'=>$rs->has_payment,
'event_id'=>$rs->event_id, 'event_id'=>$rs->event_id,
'event_name'=>$rs->event_name, 'event_name'=>$rs->event_name,
'event_description'=>$rs->event_description, 'event_description'=>$rs->event_description,
......
...@@ -25,7 +25,6 @@ class Validation_model extends CI_Model { ...@@ -25,7 +25,6 @@ class Validation_model extends CI_Model {
'popular'=>array(), 'popular'=>array(),
'category'=>array(), 'category'=>array(),
'locality'=>array(), 'locality'=>array(),
'paymentGateway'=>array(),
'favourite'=>array('event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty') 'favourite'=>array('event_id'=>array('required'=>array('code'=>'ER16', 'message'=>'Event id is null or empty')
), ),
'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'), 'auth_token'=>array('required'=>array('code'=>'ER17', 'message'=>'User Id is null or empty'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment