Beispiel #1
0
 def parse_xml(self, xml):
     from django_recurly.client import get_client
     
     client = get_client()
     client.parse_notification(xml)
     
     return client.response
Beispiel #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)
Beispiel #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()
Beispiel #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()
Beispiel #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)
Beispiel #6
0
 def get_transactions(self):
     client = get_client()
     response = client.accounts.transactions(account_code=self.account_code)
     return response["transaction"]
Beispiel #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"]