forked from BlueWallet/Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buy-bitcoin-redirect.html
99 lines (96 loc) · 5.1 KB
/
buy-bitcoin-redirect.html
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
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<noscript>
<meta http-equiv="Refresh" content="0;URL=https://moonpay-redirect.herokuapp.com/?apiKey=pk_live_IkhSI2lIXSiolwakfd95QFD4p3908cZa&enabledPaymentMethods=credit_debit_card%2Capple_pay%2Csepa_bank_transfer%2Cgbp_bank_transfer%2Cgoogle_pay%2Csamsung_pay¤cyCode=BTC&colorCode=%2368BBE1&showWalletAddressForm=false"/>
</noscript>
<style>
.lds-dual-ring {
display: block;
width: 64px;
height: 64px;
margin: auto;
}
.lds-dual-ring:after {
content: " ";
display: block;
width: 46px;
height: 46px;
margin: 1px;
border-radius: 50%;
border: 5px solid #CCDDF9;
border-color: #CCDDF9 transparent #CCDDF9 transparent;
animation: lds-dual-ring 1.2s linear infinite;
}
@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="lds-dual-ring"></div>
<script>
var safello_countries = ["SE"];
var xanpool_countries = []; // + "SG", "HK", "ID"
var moonpay_currencies = ["AUD", "BGN", "BRL", "CAD", "CHF", "CNY", "COP", "CZK", "DKK", "DOP", "EGP", "EUR", "GBP", "HKD", "HRK", "IDR", "ILS", "JOD", "JPY", "KES", "KRW", "KWD", "LKR", "MAD", "MXN", "MYR", "NGN", "NOK", "NZD", "OMR", "PEN", "PKR", "PLN", "RON", "RUB", "SEK", "SGD", "THB", "TRY", "TWD", "USD", "VND", "ZAR"]; // curl -s https://api.moonpay.io/v3/currencies?apiKey=pk_live_IkhSI2lIXSiolwakfd95QFD4p3908cZa | jq '.' | grep fiat -A 2 | grep code
var xanpool_currencies = ["SGD", "HKD", "THB", "PHP", "INR", "IDR", "VND", "MYR", "SGD", "HKD", "PHP", "INR", "VND", "THB"];
var mercuryo_countries = [];
var mercuryo_currencies = ["EUR", "RUB", "USD", "IDR", "KRW", "JPY", "TRY", "GBP", "UAH", "ARS"];
var u = new URLSearchParams(window.location.search);
var address = u.get('address') || '';
var currency = u.get('currency') || '';
var force_country = u.get('force_country') || '';
var safello_state_token = u.get('safelloStateToken')
if (safello_state_token == 'TEST') {
// for the sake of testing
alert(safello_state_token);
throw new Error("Script execution terminated");
}
$.ajax({
url: "https://geolocation-db.com/jsonp",
timeout: 5000,
jsonpCallback: "callback",
dataType: "jsonp",
error: function() {
var moonpay_url = 'https://moonpay-redirect.herokuapp.com/?apiKey=pk_live_IkhSI2lIXSiolwakfd95QFD4p3908cZa&enabledPaymentMethods=credit_debit_card%2Capple_pay%2Csepa_bank_transfer%2Cgbp_bank_transfer%2Cgoogle_pay%2Csamsung_pay¤cyCode=BTC&colorCode=%2368BBE1&showWalletAddressForm=false';
if (address) moonpay_url += '&walletAddress=' + address;
if (moonpay_currencies.indexOf(currency) !== -1) moonpay_url += '&baseCurrencyCode=' + currency;
window.location = moonpay_url;
},
success: function( location ) {
console.log('country_code', location.country_code);
if (force_country) location.country_code = force_country;
if (safello_countries.indexOf(location.country_code) !== -1) {
var safello_url = 'https://app.safello.com/sdk/quickbuy.html?appId=4904c769-8a1d-43ca-8bd0-896520c94fdf&utm_source=BlueWallet&utm_medium=Wallet&country=' + location.country_code + '&theme=bluewallet&layout=app&address=' + address;
if (safello_state_token) {
safello_url += '&stateToken=' + safello_state_token
}
window.location = safello_url
} else if (xanpool_countries.indexOf(location.country_code) !== -1) {
var xanpool_url = "https://widget.xanpool.com/?apiKey=7e3o3bzh5f2opybhhkqgo63yfbqykmll&cryptoCurrency=btc&transactionType=buy&isWebView=true";
if (address) xanpool_url += "&wallet=" + address;
if (xanpool_currencies.indexOf(currency) !== -1) xanpool_url += "¤cy=" + currency;
window.location = xanpool_url;
} else if (mercuryo_countries.indexOf(location.country_code) !== -1) {
var mercuryo_url = "https://exchange.mercuryo.io/?widget_id=4d94cb57-60a4-4804-82a8-257aa94bcb73&hide_address=true&utm_source=BlueWallet&utm_medium=referral&type=buy¤cy=BTC&fix_currency=true";
if (address) mercuryo_url += "&address=" + address;
if (mercuryo_currencies.indexOf(currency) !== -1) mercuryo_url += "&fiat_currency=" + currency;
window.location = mercuryo_url;
} else {
var moonpay_url = 'https://moonpay-redirect.herokuapp.com/?apiKey=pk_live_IkhSI2lIXSiolwakfd95QFD4p3908cZa&enabledPaymentMethods=credit_debit_card%2Capple_pay%2Csepa_bank_transfer%2Cgbp_bank_transfer%2Cgoogle_pay%2Csamsung_pay¤cyCode=BTC&colorCode=%2368BBE1&showWalletAddressForm=false';
if (address) moonpay_url += '&walletAddress=' + address;
if (moonpay_currencies.indexOf(currency) !== -1) moonpay_url += '&baseCurrencyCode=' + currency;
window.location = moonpay_url;
}
}
});
</script>
</body>
</html>