-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathApiPayment.php
More file actions
238 lines (204 loc) · 7.42 KB
/
ApiPayment.php
File metadata and controls
238 lines (204 loc) · 7.42 KB
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?php include('menu.php');?>
<fieldset>
<legend>
<label style="font-weight: bold; width: 250px;">Sepet Bilgileri</label>
</legend>
<table class="table">
<thead>
<tr>
<th>Ürün</th>
<th>Kod</th>
<th>Adet</th>
<th>Birim Fiyat</th>
</tr>
</thead>
<tbody>
<tr>
<td>Telefon</td>
<td>TLF0001</td>
<td>1</td>
<td>50.00 TL</td>
</tr>
<tr>
<td>Bilgisayar</td>
<td>BLG0001</td>
<td>1</td>
<td>50.00 TL</td>
</tr>
<tr>
<td colspan="3">Toplam Tutar</td>
<td>100.00 TL</td>
</tr>
</tbody>
</table>
</fieldset>
<fieldset>
<legend>
<label style="font-weight: bold; width: 250px;">Kargo Adresi Bilgileri</label>
</legend>
<label style="font-weight: bold;">Ad :</label> Murat<br> <label
style="font-weight: bold;">Soyad :</label> Kaya <br> <label
style="font-weight: bold;">Adres :</label> Mevlüt Pehlivan Mah.
Multinet Plaza Şişli <br> <label style="font-weight: bold;">Posta Kodu
:</label> 34782 <br> <label style="font-weight: bold;">Şehir :</label>
İstanbul <br> <label style="font-weight: bold;">Ülke :</label> Türkiye
<br> <label style="font-weight: bold;">Telefon Numarası:</label>
2123886600 <br>
</fieldset>
<fieldset>
<legend>
<label style="font-weight: bold; width: 250px;">Fatura Adresi
Bilgileri</label>
</legend>
<label style="font-weight: bold;">Ad :</label> Murat<br> <label
style="font-weight: bold;">Soyad :</label> Kaya<br> <label
style="font-weight: bold;">Adres :</label> Mevlüt Pehlivan Mah.
Multinet Plaza Şişli<br> <label style="font-weight: bold;">Posta Kodu :</label>
34782<br> <label style="font-weight: bold;">Şehir :</label> İstanbul<br>
<label style="font-weight: bold;">Ülke :</label> Türkiye<br> <label
style="font-weight: bold;">TC Kimlik Numarası :</label> 1234567890<br>
<label style="font-weight: bold;">Telefon Numarası:</label> 2123886600<br>
<label style="font-weight: bold;">Vergi Numarası :</label> 123456<br> <label
style="font-weight: bold;">Vergi Dairesi Adı :</label> Kozyatağı<br> <label
style="font-weight: bold;">Firma Adı:</label> iPara
</fieldset>
<form action="" method="post" class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>
<label style="font-weight: bold; width: 250px;">Kart Bilgileriyle
Ödeme</label>
</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="">Kart Sahibi Adı Soyadı:</label>
<div class="col-md-4">
<input value="Kart Sahibi Ad Soyad" name="nameSurname"
class="form-control input-md">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for=""> Kart Numarası:</label>
<div class="col-md-4">
<input value="5456165456165454" name="cardNumber"
class="form-control input-md">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for=""> Son Kullanma Tarihi
Ay/Yıl: </label>
<div class="col-md-4">
<input value="12" name="month" class="form-control input-md"
width="50px"> <input value="24" name="year"
class="form-control input-md" width="50px">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for=""> CVC: </label>
<div class="col-md-4">
<input value="000" name="cvc" class="form-control input-md">
</div>
</div>
</fieldset>
Taksit Sayısı <select name="installment">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for=""></label>
<div class="col-md-4">
<button type="submit" id="" name="" class="btn btn-success">API
Payment ile Ödeme</button>
</div>
</div>
</form>
<?php if (!empty($_POST)): ?>
<?php
/*
*3D secure olmadan ödeme işlemleri için gerekli olan parametrelerin doldurulduğu kısımdır.
*setting ayarlarımızı alıp, ApiPaymentRequest alanlarının formdan gelen verilere göre doldurup post edildiği kısımdır.
*Post işlemi sonucunda oluşan sonucu ekranda gösteriyoruz.
*/
$settings = new Settings ();
$request = new ApiPaymentRequest ();
$request->OrderId = Helper::Guid ();
$request->Echo = "Echo";
$request->Mode = $settings->Mode;
$request->Amount = "10000"; // 100 tL
$request->CardOwnerName = $_POST ["nameSurname"];
$request->CardNumber = $_POST ["cardNumber"];
$request->CardExpireMonth = $_POST ["month"];
$request->CardExpireYear = $_POST ["year"];
$request->Installment = $_POST ["installment"];
$request->Cvc = $_POST ["cvc"];
$request->ThreeD = "false";
// region Sipariş veren bilgileri
$request->Purchaser = new Purchaser ();
$request->Purchaser->Name = "Murat";
$request->Purchaser->SurName = "Kaya";
$request->Purchaser->BirthDate = "1986-07-11";
$request->Purchaser->Email = "murat@kaya.com";
$request->Purchaser->GsmPhone = "5881231212";
$request->Purchaser->IdentityNumber = "1234567890";
$request->Purchaser->ClientIp = Helper::get_client_ip ();
// endregion
// region Fatura bilgileri
$request->Purchaser->InvoiceAddress = new PurchaserAddress ();
$request->Purchaser->InvoiceAddress->Name = "Murat";
$request->Purchaser->InvoiceAddress->SurName = "Kaya";
$request->Purchaser->InvoiceAddress->Address = "Mevlüt Pehlivan Mah-> Multinet Plaza Şişli";
$request->Purchaser->InvoiceAddress->ZipCode = "34782";
$request->Purchaser->InvoiceAddress->CityCode = "34";
$request->Purchaser->InvoiceAddress->IdentityNumber = "1234567890";
$request->Purchaser->InvoiceAddress->CountryCode = "TR";
$request->Purchaser->InvoiceAddress->TaxNumber = "123456";
$request->Purchaser->InvoiceAddress->TaxOffice = "Kozyatağı";
$request->Purchaser->InvoiceAddress->CompanyName = "iPara";
$request->Purchaser->InvoiceAddress->PhoneNumber = "2122222222";
// endregion
// region Kargo Adresi bilgileri
$request->Purchaser->ShippingAddress = new PurchaserAddress ();
$request->Purchaser->ShippingAddress->Name = "Murat";
$request->Purchaser->ShippingAddress->SurName = "Kaya";
$request->Purchaser->ShippingAddress->Address = "Mevlüt Pehlivan Mah-> Multinet Plaza Şişli";
$request->Purchaser->ShippingAddress->ZipCode = "34782";
$request->Purchaser->ShippingAddress->CityCode = "34";
$request->Purchaser->ShippingAddress->IdentityNumber = "1234567890";
$request->Purchaser->ShippingAddress->CountryCode = "TR";
$request->Purchaser->ShippingAddress->PhoneNumber = "2122222222";
// endregion
// region Ürün bilgileri
$request->Products = array ();
$p = new Product ();
$p->Title = "Telefon";
$p->Code = "TLF0001";
$p->Price = "5000";
$p->Quantity = 1;
$request->Products [0] = $p;
$p = new Product ();
$p->Title = "Bilgisayar";
$p->Code = "BLG0001";
$p->Price = "5000";
$p->Quantity = 1;
$request->Products [1] = $p;
// endregion
$response = ApiPaymentRequest::execute ( $request, $settings ); // 3D secure olmadan ödeme yapma servis çağrısının yapıldığı kısımdır.
$output = Helper::formattoXMLOutput($response); //3D secure sonucu servis çıktı parametrelerinin ekrana yansıtıldığı kısımdır.
print "<h3>Sonuç:</h3>";
echo "<pre>";
echo htmlspecialchars($output);
echo "</pre>";
?>
<?php endif; ?>
<?php include('footer.php');?>