def parse_xml(self, xml): from django_recurly.client import get_client client = get_client() client.parse_notification(xml) return client.response
def terminate(self, refund="none"): """Terminate the subscription refund may be one of: - "none" : No refund, subscription is just expired - "partial" : Give a prorated refund - "full" : Provide a full refund of the most recent charge """ client = get_client() client.accounts.subscription.delete(account_code=self.account.account_code, refund=refund)
def push_notifications(request): client = get_client() name = client.parse_notification(request.raw_post_data) try: signal = getattr(signals, name) except AttributeError: return HttpResponseBadRequest("Invalid notification name.") signal.send(sender=client, data=client.response) return HttpResponse()
def change_plan(self, plan_code): """Change this subscription to the specified plan_code. This will call the Recurly API. """ client = get_client() update_data = { "timeframe": "now", "plan_code": plan_code } client.accounts.subscription.update(account_code=self.account.account_code, data=update_data) self.plan_code = plan_code self.save()
def cancel(self): """Cancel the subscription, it will expire at the end of the current billing cycle""" client = get_client() client.accounts.subscription.delete(account_code=self.account.account_code)
def get_transactions(self): client = get_client() response = client.accounts.transactions(account_code=self.account_code) return response["transaction"]
def get_transactions(self): client = get_client() import pdb; pdb.set_trace(); response = client.accounts.transactions(account_code=self.account_code) return response["transaction"]