-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcurrencies.php
More file actions
39 lines (26 loc) · 989 Bytes
/
currencies.php
File metadata and controls
39 lines (26 loc) · 989 Bytes
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
<?php
require_once 'lib/CmsOrder.php';
require_once 'lib/PayBearOrder.php';
$cms_order = new CmsOrder();
$payBearOrder = new PayBearOrder();
$currencies = $payBearOrder->getCurrencies();
$order_id = $_GET['order_id'];
$last_order = $cms_order->findByIncrementId($order_id);
if (empty($last_order)) {
echo 'Order not found';
return;
}
if (isset($_GET['token'])) {
$token = $_GET['token'];
$data = $payBearOrder->getCurrency($order_id, $token, $last_order->order_total, $last_order->fiat_currency, true );
} else {
$data = array();
foreach($currencies as $key => $currency) {
if (count($currencies) == 1) {
$data = $payBearOrder->getCurrency($order_id, $key, $last_order->order_total, $last_order->fiat_currency, true );
}else {
$data[$key] = $payBearOrder->getCurrency($order_id, $key, $last_order->order_total, $last_order->fiat_currency);
}
}
}
echo json_encode($data); //return this data to PayBear form