mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Merge pull request #1594 from alphagov/vb-free-sms-history
Use annual_billing tables at backend for getting and updating free_sm…
This commit is contained in:
@@ -23,3 +23,26 @@ class BillingAPIClient(NotifyAdminAPIClient):
|
||||
'/service/{0}/billing/yearly-usage-summary'.format(service_id),
|
||||
params=dict(year=year)
|
||||
)
|
||||
|
||||
def get_free_sms_fragment_limit_for_year(self, service_id, year=None):
|
||||
result = self.get(
|
||||
'/service/{0}/billing/free-sms-fragment-limit'.format(service_id),
|
||||
params=dict(financial_year_start=year)
|
||||
)
|
||||
return result['free_sms_fragment_limit']
|
||||
|
||||
def get_free_sms_fragment_limit_for_all_years(self, service_id, year=None):
|
||||
return self.get(
|
||||
'/service/{0}/billing/free-sms-fragment-limit'.format(service_id))
|
||||
|
||||
def create_or_update_free_sms_fragment_limit(self, service_id, free_sms_fragment_limit, year=None):
|
||||
# year = None will update current and future year in the API
|
||||
data = {
|
||||
"financial_year_start": year,
|
||||
"free_sms_fragment_limit": free_sms_fragment_limit
|
||||
}
|
||||
|
||||
return self.post(
|
||||
url='/service/{0}/billing/free-sms-fragment-limit'.format(service_id),
|
||||
data=data
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user