-
Notifications
You must be signed in to change notification settings - Fork 3
/
fee_payment.php
215 lines (161 loc) · 7.58 KB
/
fee_payment.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?php
#################################################################
## MyPHPAuction v6.05 ##
##-------------------------------------------------------------##
## Copyright ©2009 MyPHPAuction. All rights reserved. ##
##-------------------------------------------------------------##
#################################################################
session_start();
define ('IN_SITE', 1);
include_once ('includes/global.php');
include_once ('includes/class_formchecker.php');
include_once ('includes/class_custom_field.php');
include_once ('includes/class_user.php');
include_once ('includes/class_fees.php');
include_once ('includes/class_item.php');
if (!$session->value('user_id'))
{
header_redirect('login.php');
}
else
{
require ('global_header.php');
//$msg_changes_saved = '<p align="center" class="contentfont">' . MSG_CHANGES_SAVED . '</p>';
$template->set('members_area_header', header7(MSG_MEMBERS_AREA_TITLE));
$user_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE user_id=" . $session->value('user_id'));
if ($_REQUEST['do'] == 'clear_balance')
{
$fee_type_message = ' - ' . MSG_CLEAR_ACC_BALANCE;
$balance_fee = new fees();
$balance_fee->setts = &$setts;
$user_payment_mode = $fees->user_payment_mode($session->value('user_id'));
if ($user_payment_mode == 2 && $user_details['balance'] >= $setts['min_invoice_value'])
{
$payment_table_display = $balance_fee->clear_balance($session->value('user_id'), $user_details['balance']);
}
else
{
$payment_table_display = MSG_ERROR_FEE_PAYMENT_CLEAR_BALANCE;
}
$template->set('payment_table_display', $payment_table_display);
}
else if ($_REQUEST['do'] == 'credit_account')
{
$fee_type_message = ' - ' . MSG_CREDIT_ACCOUNT;
$balance_fee = new fees();
$balance_fee->setts = &$setts;
$user_payment_mode = $fees->user_payment_mode($session->value('user_id'));
if ($user_payment_mode == 2 && $_REQUEST['credit_amount'] > 0)
{
$payment_table_display = $balance_fee->clear_balance($session->value('user_id'), $_REQUEST['credit_amount'], $setts['sitename'] . $fee_type_message);
}
else
{
$payment_table_display = MSG_ERROR_FEE_PAYMENT_CLEAR_BALANCE;
}
$template->set('payment_table_display', $payment_table_display);
}
else if ($_REQUEST['do'] == 'subscription_payment')
{
$fee_type_message = ' - ' . GMSG_SUBSCRIPTION_PAYMENT;
$subscr_fee = new fees();
$subscr_fee->setts = &$setts;
$is_account = $db->get_sql_number("SELECT a.account_id FROM
" . DB_PREFIX . "user_accounts a, " . DB_PREFIX . "users u WHERE
u.account_id=a.account_id AND a.active=1 AND u.user_id=" . $session->value('user_id'));
if ($is_account)
{
$output = $subscr_fee->signup($session->value('user_id'));
$payment_table_display = $output['display'];
}
else
{
$payment_table_display = MSG_ERROR_SUBSCRIPTION_PAYMENT;
}
$template->set('payment_table_display', $payment_table_display);
}
else if ($_REQUEST['do'] == 'setup_fee_payment')
{
$fee_type_message = ' - ' . GMSG_SETUP_FEES;
$setup_fee = new fees();
$setup_fee->setts = &$setts;
$setup_fee->live_setup_fee = true;
$item_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "auctions WHERE
auction_id='" . intval($_REQUEST['auction_id']) . "' AND owner_id='" . $session->value('user_id') . "'");
$setup_fee->rollback_auction_id = $item_details['auction_id'];
## add nb of images and videos so the fees for these features are also paid.
$user_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE
user_id='" . $session->value('user_id') . "'");
$fee_output = $setup_fee->setup($user_details, $item_details, null, $item_details['is_relisted_item'], true);
$template->set('payment_table_display', $fee_output['display']);
}
else if ($_REQUEST['do'] == 'sale_fee_payment')
{
$fee_type_message = ' - ' . GMSG_ENDAUCTION_FEE;
$sale_fee = new fees();
$sale_fee->setts = &$setts;
$winning_bid_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "winners WHERE winner_id='" . intval($_REQUEST['winner_id']) . "' AND
(seller_id=" . $session->value('user_id') . " OR buyer_id=" . $session->value('user_id') . ")");
$item_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "auctions WHERE
auction_id='" . $winning_bid_details['auction_id'] . "'");## MyPHPAuction 2009 since the buyer could also pay for the end of auction fee.
$fee_output = $sale_fee->sale($winning_bid_details, $item_details);
$template->set('payment_table_display', $fee_output['display']);
}
else if ($_REQUEST['do'] == 'wa_setup_fee_payment')
{
$fee_type_message = ' - ' . GMSG_WA_SETUP_FEE;
$setup_fee = new fees();
$setup_fee->setts = &$setts;
$item_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "wanted_ads WHERE
wanted_ad_id='" . intval($_REQUEST['wanted_ad_id']) . "' AND owner_id='" . $session->value('user_id') . "'");
$user_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE
user_id='" . $session->value('user_id') . "'");
$fee_output = $setup_fee->wanted_ad_setup($user_details, $item_details);
$template->set('payment_table_display', $fee_output['display']);
}
else if ($_REQUEST['do'] == 'invoice_direct_payment')
{
$item = new item();
$item->setts = &$setts;
$fee_type_message = ' - ' . MSG_DIRECT_PAYMENT . ' [ ' . MSG_INVOICE_ID . ': ' . $_REQUEST['invoice_id'] . ' ]';
$sql_select_products = $db->query("SELECT w.*, a.name,
a.direct_payment, a.currency, a.owner_id, a.apply_tax FROM " . DB_PREFIX . "winners w
LEFT JOIN " . DB_PREFIX . "auctions a ON a.auction_id=w.auction_id WHERE
w.invoice_id='" . intval($_REQUEST['invoice_id']) . "' AND w.buyer_id='" . $session->value('user_id') . "'");
(array) $dp_array = null;
(array) $items_array = null;
while ($item_details = $db->fetch_array($sql_select_products))
{
$items_array[] = $item_details;
$dp_array[] = ($item_details['direct_payment']) ? @explode(',', $item_details['direct_payment']) : null;
}
(string) $direct_payment_link = null;
$payment_table_display = $item->direct_payment_multiple_box($_REQUEST['invoice_id'], $items_array, $dp_array, $session->value('user_id'));
$template->set('payment_table_display', $payment_table_display);
}
else if ($_REQUEST['do'] == 'store_subscription_payment')
{
$fee_type_message = ' - ' . GMSG_STORE_SUBSCRIPTION_PAYMENT;
$store_fee = new fees();
$store_fee->setts = &$setts;
$user_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE
user_id='" . $session->value('user_id') . "'");
$fee_output = $store_fee->store_subscription($user_details['shop_account_id'], $session->value('user_id'));
$template->set('payment_table_display', $fee_output['display']);
}
else if ($_REQUEST['do'] == 'seller_verification')
{
$fee_type_message = ' - ' . GMSG_SELLER_VERIFICATION_PAYMENT;
$verification_fee = new fees();
$verification_fee->setts = &$setts;
$user_details = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "users WHERE
user_id='" . $session->value('user_id') . "'");
$fee_output = $verification_fee->seller_verification($session->value('user_id'));
$template->set('payment_table_display', $fee_output['display']);
}
$template->set('fee_payment_header', headercat(MSG_FEE_PAYMENT . $fee_type_message));
$template_output .= $template->process('fee_payment.tpl.php');
include_once ('global_footer.php');
echo $template_output;
}
?>