11# -*- coding: utf-8 -*-
2- from datetime import datetime
32from six import string_types
4- from payplug import config , exceptions , network , notifications , resources , routes
5- from payplug .network import HttpClient , UrllibRequest
3+ from payplug import config , exceptions , resources , routes
4+ from payplug .network import HttpClient
65from payplug .__version__ import __version__
76
87
@@ -29,6 +28,7 @@ def set_secret_key(token):
2928
3029 config .secret_key = token
3130
31+
3232def set_api_version (version ):
3333 """
3434 Specify the PayPlug API version to use.
@@ -363,3 +363,37 @@ def list(customer, per_page=None, page=None):
363363 http_client = HttpClient ()
364364 response , _ = http_client .get (routes .url (routes .CARD_RESOURCE , customer_id = customer , pagination = pagination ))
365365 return resources .APIResourceCollection (resources .Card , ** response )
366+
367+
368+ class AccountingReport :
369+ """
370+ A DAO for resources.AccountingReport which provides a way to query accounting reports.
371+ """
372+ @staticmethod
373+ def retrieve (report_id ):
374+ """
375+ Retrieve an accounting report from its id.
376+
377+ :param report_id: The report id
378+ :type report_id: string
379+
380+ :return: The accounting report resource
381+ :rtype: resources.AccountingReport
382+ """
383+ http_client = HttpClient ()
384+ response , __ = http_client .get (routes .url (routes .ACCOUNTING_REPORT_RESOURCE , resource_id = report_id ))
385+ return resources .AccountingReport (** response )
386+
387+ @staticmethod
388+ def create (** data ):
389+ """
390+ Create an accounting report.
391+
392+ :param data: data required to create the report
393+
394+ :return: The accounting report resource
395+ :rtype resources.AccountingReport
396+ """
397+ http_client = HttpClient ()
398+ response , _ = http_client .post (routes .url (routes .ACCOUNTING_REPORT_RESOURCE ), data )
399+ return resources .AccountingReport (** response )
0 commit comments