-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdissatisfied.php
133 lines (91 loc) · 5.74 KB
/
dissatisfied.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
<?php
include_once "config.php";
include_once "include/header.php";
//taskerid ==userid
$secretkey = mysql_query("select * from stripecredentials where id ='1'");
$sresult = mysql_fetch_array($secretkey);
$details = mysql_query("select * from members where id ='".$_POST['taskerid']."'");
$rec = mysql_fetch_array($details);
//transfer = servicefee - stripefee
$servicefee = floor($_POST['amount'] * 0.15 - ($_POST['amount'] * 1.15 * 0.029 + 30));
$checkcreditdetails= mysql_query("select * from taskerdetails where userid = '".$_POST['taskerid']."' && secretkey='".$sresult['secretkey']."'");
if(mysql_num_rows($checkcreditdetails)>0)
{
$data =mysql_fetch_array($checkcreditdetails);
$source= mysql_query("select * from stripepayment where taskid = '".$_POST['taskid']."' && taskerid = '".$_POST['taskerid']."'");
$rec = mysql_fetch_array($source);
try{
$stripeClassesDir = __DIR__ . '/Stripe/lib/';
$stripeUtilDir = $stripeClassesDir . 'Util/';
$stripeErrorDir = $stripeClassesDir . 'Error/';
set_include_path($stripeClassesDir . PATH_SEPARATOR . $stripeUtilDir . PATH_SEPARATOR . $stripeErrorDir);
function __autoload($class)
{
$parts = explode('\\', $class);
require end($parts) . '.php';
}
\Stripe\Stripe::setApiKey($sresult['secretkey']);
$data = \Stripe\Transfer::create(array(
"amount" => $_POST['amount'],
"currency" => "usd",
"recipient" => $data['recipientid'],
//"card" =>$data['cardid'],
"destination" =>$data['bankid'],
"source_transaction" =>$rec['chargeid'],
"description" => "Tasker Payment."
));
//Service Fee Transfer
$data = \Stripe\Transfer::create(array(
"amount" => $servicefee,
"currency" => "usd",
"recipient" => "self",
"source_transaction" =>$rec['chargeid'],
"description" => "Service Fee."
));
$update = mysql_query("update satisfiedstatus set `paymentstatus` ='1' where bid_id ='".$_POST['taskid']."' && tasker_id = '".$_POST['taskerid']."'");
echo"<h3>Transfer has been done Successfully</h3>";
$gettaskdetail = mysql_query("select * from tasks where id='".$_POST['taskid']."'");
$taskdetail = mysql_fetch_array($gettaskdetail);
$taskname = $taskdetail['taskname'];
$data = mysql_query("select * from members where id='".$_POST['taskerid']."'");
$rec = mysql_fetch_array($data);
$to = $rec['email'];
$subject = "Payment Transfer Notification";
//$to = '[email protected]';
$amnt = $_POST['amount']/100;
$body="<table cellpadding='5px' width='600px' height='300px' style='border:1px solid #00aeec' align='center'><tr><td height='30px;' bgcolor='#fff' style='border-bottom:1px solid #00aeec'> <img src='http://ubangbangwo.com/images/logo.png' height='50'></td></tr><tr><td><h1>Dear ".$rec['fname']." ".$rec['lname'].",</h1><td></tr><tr><td>Your Work on Job <b>".$taskname."</b> is rated.</td></tr><tr><td> </td></tr><tr><td>Rate - dissatisfied</td></tr><tr><td> </td></tr><tr><td>$".$amnt." is Transferring to your account </td></tr><tr><td><a href='http://www.ubangbangwo.com/dashboard'>Click here to view</a></td></tr><tr><td> </td></tr><tr><td>Thanks</td></tr><tr><td>Your BangBangWo Team</td></tr></table>";
$headers = 'From: [email protected].' . "\r\n" ;
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
if($_POST['page']!='')
{
header('Refresh: 2; URL=http://'.$_SERVER['HTTP_HOST'].'/dashboard?page='.$_POST['page'].'&dissatisfied');
}
else
{
header('Refresh: 2; URL=http://'.$_SERVER['HTTP_HOST'].'/dashboard?dissatisfied');
}
}
catch(Stripe_CardError $e){
$error = $e->getMessage();
echo '<br><span style="color:red">'.$error.'</span><br>';
}
catch(stripe_InvalidRequestError $e){
$error = $e->getMessage();
echo '<br><span style="color:red">'.$error.'</span><br>';
}
catch(stripe_AuthenticationError $e){
$error = $e->getMessage();
echo '<br><span style="color:red">'.$error.'</span><br>';
}
catch(Exception $e){
$error = $e->getMessage();
echo '<br><span style="color:red">'.$error.'</span><br>';
}
}
else
{
echo '<br><span style="color:red">Credit card details are not entered by Tasker .. Ask him to Connect with stripe</span><br>';
}
?>