From becd8d38cffb3c821491a305449cde67e1404c35 Mon Sep 17 00:00:00 2001 From: philippA Date: Fri, 30 Oct 2020 17:42:39 +0100 Subject: [PATCH] Update VodafoneDE.js Add CallYa Amount --- VodafoneDE/VodafoneDE.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/VodafoneDE/VodafoneDE.js b/VodafoneDE/VodafoneDE.js index 6356ab2..fa28bf4 100644 --- a/VodafoneDE/VodafoneDE.js +++ b/VodafoneDE/VodafoneDE.js @@ -3,9 +3,11 @@ // icon-color: red; icon-glyph: broadcast-tower; /************** -Version 1.2.1 +Version 1.2.2 Changelog: + v1.2.2: + - Add CallYa Amount v1.2.1: - Code '40100' added for CallYa Tariff v1.2.0: @@ -222,6 +224,15 @@ async function getUsage(user, pass, number) { throw new Error(ErrorMsg) } + let amount + if (res['serviceUsageVBO']['usageAccounts'][0]['details']['amount'] === undefined) { + const ErrorMsgDetails = "Can't find amount." + console.log(ErrorMsgDetails) + throw new Error(ErrorMsgDetails) + }else{ + amount = res['serviceUsageVBO']['usageAccounts'][0]['details']['amount'] + } + let datenvolumen; if (datenContainer.usage.length == 1) { datenvolumen = datenContainer.usage[0] @@ -252,6 +263,7 @@ async function getUsage(user, pass, number) { total: datenvolumen.total, used: datenvolumen.used, remaining: datenvolumen.remaining, + amount: amount, endDate } } catch (e) { @@ -374,11 +386,16 @@ if (data !== undefined) { totalValuesText.centerAlignText() totalValuesText.textColor = new Color(textColor) + let strAmount = "" + if (data.amount) { + strAmount = ` - ${data.amount} €` + } + // Remaining Days if (data.endDate) { widget.addSpacer(5) let remainingDays = getTimeRemaining(data.endDate).days + 1 - let remainingDaysText = widget.addText(`${remainingDays} Tage verleibend`) + let remainingDaysText = widget.addText(`${remainingDays} Tage verleibend${strAmount}`) remainingDaysText.font = Font.mediumSystemFont(8) remainingDaysText.centerAlignText() remainingDaysText.textColor = new Color(textColor)