Esempio n. 1
0
 def parse_xml(self, xml):
     from django_recurly.client import get_client
     
     client = get_client()
     client.parse_notification(xml)
     
     return client.response
Esempio n. 2
0
 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)
Esempio n. 3
0
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()
Esempio n. 4
0
 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()
Esempio n. 5
0
 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)
Esempio n. 6
0
 def get_transactions(self):
     client = get_client()
     response = client.accounts.transactions(account_code=self.account_code)
     return response["transaction"]
Esempio n. 7
0
 def get_transactions(self):
     client = get_client()
     import pdb; pdb.set_trace();
     response = client.accounts.transactions(account_code=self.account_code)
     return response["transaction"]