-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkout_ajax.php
151 lines (118 loc) · 5.36 KB
/
checkout_ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
require_once(__DIR__ . "/lib/SslCommerzNotification.php");
include("db_connection.php");
include("OrderTransaction.php");
$idGenDate = date("Ymd");
use SslCommerz\SslCommerzNotification;
$requestData = (array) json_decode($_POST['cart_json']);
$post_data['total_amount'] = 81;
$post_data['currency'] = "BDT";
// $post_data['tran_id'] = "WS".$idGenDate .$requestData['admission_no'];
$post_data['tran_id'] = "WS".time().mt_rand();
//# CUSTOMER INFORMATION
$post_data['cus_name'] = $requestData['student_name'];
$post_data['cus_email'] = $requestData['student_class'];
$post_data['cus_add1'] = $requestData['admission_no'];
$post_data['cus_add2'] = $requestData['admission_year'];
$post_data['cus_city'] = $requestData['fathers_name'];
$post_data['cus_state'] = "Dhaka";
$post_data['cus_postcode'] = "1000";
$post_data['cus_country'] = "Bangladesh";
$post_data['cus_phone'] = $requestData['student_mobile'];
$post_data['cus_fax'] = $requestData['category_id'];
# SHIPMENT INFORMATION
$post_data["shipping_method"] = "YES";
$post_data['ship_name'] = "Store Test";
$post_data['ship_add1'] = date('Y-m-d', strtotime("+250 days"));
$post_data['ship_add2'] = $requestData['group_name'];
$post_data['ship_city'] = $requestData['class_id'];
$post_data['ship_state'] = $requestData['student_photo_url'];
$post_data['ship_postcode'] = "1000";
$post_data['ship_phone'] = "";
$post_data['ship_country'] = "Bangladesh";
$post_data['emi_option'] = "1";
$post_data["product_category"] = "Electronic";
$post_data["product_profile"] = "general";
$post_data["product_name"] = "Computer";
$post_data["num_of_item"] = "1";
$post_data['value_a'] = $requestData['admission_no'];
$post_data['value_b'] = $requestData['student_class'];
# OPTIONAL PARAMETERS
// $post_data['value_a'] = "Regent Air";
// $post_data['value_b'] = "ref002";
// $post_data['value_c'] = "ref003";
// $post_data['value_d'] = "ref004";
# MANAGED TRANS
//$post_data['multi_card_name'] = "brac_visa,dbbl_visa,city_visa,ebl_visa,brac_master,dbbl_master,city_master,ebl_master,city_amex,qcash,dbbl_nexus,bankasia,abbank,ibbl,mtbl,city";
//$post_data['allowed_bin'] = "371598,371599,376947,376948,376949";
//$post_data['multi_card_name'] = "bankasia,mtbl,city";
# CART PARAMETERS
// $post_data['cart'] = json_encode(array(
// array("sku" => "REF0001", "product" => "DHK TO BRS AC A1", "quantity" => "1", "amount" => "200.00"),
// array("sku" => "REF0002", "product" => "DHK TO BRS AC A2", "quantity" => "1", "amount" => "200.00"),
// array("sku" => "REF0003", "product" => "DHK TO BRS AC A3", "quantity" => "1", "amount" => "200.00"),
// array("sku" => "REF0004", "product" => "DHK TO BRS AC A4", "quantity" => "2", "amount" => "200.00")
// ));
//$post_data['emi_max_inst_option'] = "9";
//$post_data['emi_selected_inst'] = "24";
//$post_data['product_amount'] = "0";
//$post_data['discount_amount'] = "5";
//$post_data['product_amount'] = "100";
//$post_data['vat'] = "5";
//$post_data['discount_amount'] = "5";
//$post_data['convenience_fee'] = "3";
//$post_data['discount_amount'] = "5";
//$post_data['multi_card_name'] = "brac_visa,brac_master";
//$post_data['allowed_bin'] = "408860,458763,489035,432147,432145,548895,545610,545538,432149,484096,484097,464573,539932,436475";
# RECURRING DATA
// $schedule = array(
// "refer" => "5B90BA91AA3F2", # Subscriber id which generated in Merchant Admin panel
// "acct_no" => "01730671731",
// "type" => "daily", # Recurring Schedule - monthly,weekly,daily
// //"dayofmonth" => "24", # 1st day of every month
// //"month" => "8", # 1st day of January for Yearly Recurring
// //"week" => "sat", # In case, weekly recurring
// );
// $post_data["product_shipping_contry"] = "Bangladesh";
// $post_data["vip_customer"] = "YES";
// $post_data["hours_till_departure"] = "12 hrs";
// $post_data["flight_type"] = "Oneway";
// $post_data["journey_from_to"] = "DAC-CGP";
// $post_data["third_party_booking"] = "No";
// $post_data["hotel_name"] = "Sheraton";
// $post_data["length_of_stay"] = "2 days";
// $post_data["check_in_time"] = "24 hrs";
// $post_data["hotel_city"] = "Dhaka";
// $post_data["product_type"] = "Prepaid";
// $post_data["phone_number"] = "01711111111";
// $post_data["country_topUp"] = "Bangladesh";
// $post_data["shipToFirstName"] = "John";
// $post_data["shipToLastName"] = "Doe";
// $post_data["shipToStreet"] = "93 B, New Eskaton Road";
// $post_data["shipToCity"] = "Dhaka";
// $post_data["shipToState"] = "Dhaka";
// $post_data["shipToPostalCode"] = "1000";
// $post_data["shipToCountry"] = "Bangladesh";
// $post_data["shipToEmail"] = "[email protected]";
// $post_data["ship_to_phone_number"] = "01711111111";
# SPECIAL PARAM
// $post_data['tokenize_id'] = "1";
# 1 : Physical Goods
# 2 : Non-Physical Goods Vertical(software)
# 3 : Airline Vertical Profile
# 4 : Travel Vertical Profile
# 5 : Telecom Vertical Profile
// $post_data["product_profile_id"] = "5";
// $post_data["topup_number"] = "01711111111"; # topUpNumber
# First, save the input data into local database table `orders`
$query = new OrderTransaction();
$sql = $query->saveTransactionQuery($post_data);
if ($conn_integration->query($sql) === TRUE) {
# Call the Payment Gateway Library
$sslcz = new SslCommerzNotification();
$sslcz->makePayment($post_data, 'checkout', 'plain');
} else {
echo "Error: " . $sql . "<br>" . $conn_integration->error;
}