coinswitch integration

This commit is contained in:
Kukks 2018-12-18 20:00:30 +01:00
parent 2b4603a234
commit b2e5415a35
2 changed files with 39 additions and 41 deletions

View file

@ -293,12 +293,12 @@
<coinswitch inline-template
v-if="!srvModel.changellyEnabled || selectedThirdPartyProcessor === 'coinswitch'"
:mode="srvModel.coinSwitchMode"
:merchant-id="srvModel.changellyMerchantId"
:merchant-id="srvModel.coinSwitchMerchantId"
:to-currency="srvModel.paymentMethodId"
:to-currency-due="srvModel.btcDue"
:autoload="selectedThirdPartyProcessor === 'coinswitch'"
:to-currency-address="srvModel.btcAddress">
<iframe v-if="mode === 'inline'" :url="url" v-show="url">a</iframe>
<iframe v-if="mode === 'inline'" :url="url" v-show="url"></iframe>
<a v-else-if="mode === 'popup'"
v-on:click="openDialog($event)" :href="url" class="action-button" v-show="url">
{{$t("Pay with CoinSwitch")}}
@ -321,7 +321,7 @@
<select
v-model="selectedFromCurrency"
:disabled="isLoading"
v-on:change="onCurrencyChange($event)"payment__details__instruction__open-wallet__btn
v-on:change="onCurrencyChange($event)"
ref="changellyCurrenciesDropdown">
<option value="">{{$t("ConversionTab_CurrencyList_Select_Option")}}</option>
<option v-for="currency of currencies"

View file

@ -3,40 +3,11 @@
<head>
<meta charset="UTF-8">
<title>CoinSwitch</title>
<!--<script>-->
<!--//Initialize the CS object with your Merchant Id-->
<!--var payment = new Coinswitch('yadoshi');-->
<!--//When the library is available on the page, execute your code-->
<!--payment.on('Exchange:Ready', function() {-->
<!--// Add the "To Currency" and "To Currency Address"-->
<!--var config = {-->
<!--to_currency: 'btc',-->
<!--to_currency_address:'1CQ7ZdKeGWyCHF819MPB5vN4qYLjtKBpGE',-->
<!--to_amount: 1-->
<!--};-->
<!--// Open the payment wizard.-->
<!--payment.open(config);-->
<!--// Event: When the conversion request is created by the user.-->
<!--payment.on("Exchange:Initiated", function(orderId) {-->
<!--console.log("Exchange:Initiated CallbackFn", orderId);-->
<!--});-->
<!--// Event: When the conversion request is completed.-->
<!--payment.on("Exchange:Complete", function() {-->
<!--console.log("Exchange:Complete CallbackFn");-->
<!--})-->
<!--});-->
<!--</script>-->
<script id="cs_js" async src="https://files.coinswitch.co/public/js/cs_switch.js"></script>
<script>
var script = document.querySelector('#cs_js');
// window.onload = function () {
var script = document.createElement('script'),
head = document.head || document.getElementsByTagName('head')[0];
script.src = window.location.protocol + '//files.coinswitch.co/public/js/cs_switch.js';
head.insertBefore(script, head.firstChild);
script.addEventListener('load', function () {
var qs = (function (a) {
if (a == "") return {};
@ -51,7 +22,6 @@
return b;
})(window.location.search.substr(1).split('&'));
debugger;
var merchantId = qs["merchant_id"];
var toCurrencyDue = qs["toCurrencyDue"];
var toCurrencyAddress = qs["toCurrencyAddress"];
@ -65,8 +35,8 @@
};
waitForCoinSwitch();
function waitForCoinSwitch(){
if(typeof payment.open !== "function"){
function waitForCoinSwitch() {
if (typeof payment.open !== "function") {
setTimeout(waitForCoinSwitch, 1000);
return;
}
@ -79,10 +49,38 @@
})
}
});
// }
</script>
<style>
#CoinSwitchPayment .cs-pay {
width: 100%;
height: 100%;
}
#CoinSwitchPayment .cs-pay__main {
width: 100%;
height: 100%;
padding-bottom: 20px;
}
#CoinSwitchPayment .cs-pay__dismiss-row {
display: none;
}
#CoinSwitchPayment .cs-pay__footer {
position: absolute;
left: 0;
bottom: 0px;
width: 100%;
height: 20px;
z-index: 10001;
}
#CoinSwitchPayment .cs-pay__powered-text {
color: black;
}
</style>
</head>
<body>
sdasd
</body>
</html>