-
Notifications
You must be signed in to change notification settings - Fork 87
/
RetrievePaymethods.php
114 lines (104 loc) · 3.62 KB
/
RetrievePaymethods.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
<?php
/**
* OpenPayU Examples
*
* @copyright Copyright (c) PayU
* http://www.payu.com
* http://developers.payu.com
*/
require_once realpath(dirname(__FILE__)) . '/../../../lib/openpayu.php';
require_once realpath(dirname(__FILE__)) . '/../../config.php';
?>
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Retrieve Pay Methods - OpenPayU v2.1</title>
<link rel="stylesheet" href="../../layout/css/bootstrap.min.css">
<link rel="stylesheet" href="../../layout/css/style.css">
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Retrieve Pay Methods - OpenPayU v2.1</h1>
</div>
<?php
$response = null;
try {
$response = OpenPayU_Retrieve::payMethods();
$status_desc = OpenPayU_Util::statusDesc($response->getStatus());
if ($response->getStatus() == 'SUCCESS') {
echo '<div class="alert alert-success">SUCCESS: ' . $status_desc;
echo '</div>';
} else {
echo '<div class="alert alert-warning">' . $response->getStatus() . ': ' . $status_desc;
echo '</div>';
}
} catch (OpenPayU_Exception $e) {
echo '<pre>';
var_dump((string)$e);
echo '</pre>';
}
?>
<?php if ($response && $response->getStatus() == 'SUCCESS'): ?>
<h1>Pay Methods</h1>
<?php
$payMethods = $response->getResponse();
?>
<table class="table table-hover table-bordered">
<tr>
<th colspan="4">Pay By Links</th>
</tr>
<tr>
<td>payType</td>
<td>Name of payType</td>
<td>Status</td>
<td style="width: 120px">Image</td>
</tr>
<?php if ($payMethods->payByLinks):
foreach ($payMethods->payByLinks as $payByLink):
?>
<tr>
<td><?php echo $payByLink->value; ?></td>
<td><?php echo $payByLink->name; ?></td>
<td><?php echo $payByLink->status; ?></td>
<td><img src="<?php echo $payByLink->brandImageUrl; ?>" style="width: 100px"></td>
</tr>
<?php
endforeach;
endif;
?>
<?php if ($payMethods->cardTokens): ?>
<tr>
<th colspan="4">Card Tokens</th>
</tr>
<tr>
<td>Card Info</td>
<td>Token</td>
<td>Status</td>
<td style="width: 120px">Image</td>
</tr>
<?php foreach ($payMethods->cardTokens as $cardToken):
print_r($cardToken);
?>
<tr>
<td>Card: <?php echo $cardToken->cardNumberMasked; ?><br>
Expiry: <?php echo $cardToken->cardExpirationMonth; ?> / <?php echo $cardToken->cardExpirationYear; ?><br>
Brand:<?php echo $cardToken->cardBrand; ?>
</td>
<td><?php echo $cardToken->value; ?></td>
<td><?php echo $cardToken->status; ?></td>
<td><img src="<?php echo $cardToken->brandImageUrl; ?>" style="width: 100px"></td>
</tr>
<?php
endforeach;
endif;
?>
</table>
<?php endif; ?>
<h1>Response</h1>
<div id="unregisteredCardData">
<?php var_dump($response); ?>
</div>
</div>
</html>