def __init__(self, testing_mode=None, merchant_name=None, merchant_password=None): """ Initialize the interface. If the testing_mode is not set, it defaults to the ``DOCDATA_TESTING`` setting. """ if testing_mode is None: testing_mode = appsettings.DOCDATA_TESTING self.testing_mode = testing_mode self.client = DocdataClient(testing_mode, merchant_name=merchant_name, merchant_password=merchant_password)
def update_order(self, order): """ :type order: DocdataOrder """ # Fetch the latest status client = DocdataClient() statusreply = client.status( order.order_key) # Can bail out with an exception (already logged) # Store the new status self._store_report(order, statusreply.report)
def cancel_order(self, order): """ Cancel the order. """ client = DocdataClient() client.cancel( order.order_key) # Can bail out with an exception (already logged) # Let docdata be the master. # Don't wait for server to send event back, get most recent state now. self.update_order(order)