Add method for getting the credit status
This commit is contained in:
parent
98748f2ff6
commit
cf51cebe48
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## New features
|
## New features
|
||||||
|
|
||||||
TBD
|
- Add support for getting the credit status from the gateway.
|
||||||
|
|
||||||
## Changes
|
## Changes
|
||||||
|
|
||||||
|
|
|
@ -116,3 +116,12 @@ class Gateway:
|
||||||
data = json.dumps(options).encode()
|
data = json.dumps(options).encode()
|
||||||
|
|
||||||
return self.request("/v2/send", data=data)
|
return self.request("/v2/send", data=data)
|
||||||
|
|
||||||
|
def get_credit_status(self) -> float:
|
||||||
|
"""Get the credit status."""
|
||||||
|
# As the amount is returned as a string with a Danish decimal
|
||||||
|
# separator, we replace this before parsing the amount.
|
||||||
|
data = self.request("/v2/creditvalue")
|
||||||
|
amount = float(data["credit"].replace(",", "."))
|
||||||
|
|
||||||
|
return amount
|
||||||
|
|
Loading…
Reference in a new issue