def test_transactions_order(self): process = Processor(notification( subject=subscription(transactions=[ # Repeated transactions only most recent (first) # should be used. transaction(id='first:id'), transaction(id='another:id') ]), kind=self.kind)) process.process() eq_(process.transactions[0].uid_support, 'first:id')
def test_transactions_order(self): process = Processor( notification( subject=subscription(transactions=[ # Repeated transactions only most recent (first) # should be used. transaction(id='first:id'), transaction(id='another:id') ]), kind=self.kind)) process.process() eq_(process.transactions[0].uid_support, 'first:id')
def parse(request): form = WebhookParseForm(request.DATA) if not form.is_valid(): raise FormError(form.errors) # Parse the gateway without doing a validation on this server. # The validation has happened on the solitude-auth server. gateway = get_client().Configuration.instantiate().gateway() payload = base64.decodestring(form.cleaned_data['bt_payload']) attributes = XmlUtil.dict_from_xml(payload) parsed = WebhookNotification(gateway, attributes['notification']) log.info('Received webhook: {p.kind}.'.format(p=parsed)) debug_log.debug(parsed) processor = Processor(parsed) processor.process() data = processor.data return Response(data, status=200 if data else 204)
def test_none(self): self.braintree_sub.delete() obj = Processor(notification(kind=self.kind, subject=self.sub)) with self.assertRaises(BraintreeSubscription.DoesNotExist): obj.process()
def test_no_transactions_data(self): process = Processor( notification(subject=subscription(transactions=[]), kind=self.kind)) process.process() eq_(process.transaction, None)
def process(self, subscription): hook = Processor(notification(subject=subscription, kind=self.kind)) hook.process() hook.get_subscription() hook.update_transactions() return hook
def test_none(self): self.braintree_sub.delete() obj = Processor(notification(kind=self.kind, subject=self.sub)) with self.assertRaises(BraintreeSubscription.DoesNotExist): obj.process()
def test_no_transactions_data(self): process = Processor(notification( subject=subscription(transactions=[]), kind=self.kind)) process.process() eq_(process.transaction, None)
def process(self, subscription): hook = Processor(notification(subject=subscription, kind=self.kind)) hook.process() hook.get_subscription() hook.update_transactions() return hook