Example #1
0
def sbi_get(view, request):
    serial = SellerBangoOnly(data=request.DATA)
    if not serial.is_valid():
        return Response(serial.errors, status=400)

    data = {'packageId': serial.object['seller_bango'].package_id}
    res = view.client('GetSBIAgreement', data)
    obj = EasyObject(
        text=terms(res.sbiAgreement),
        valid=res.sbiAgreementValidFrom,
        accepted=None,
        expires=None
    )
    return Response(SBISerializer(obj).data)
Example #2
0
    def obj_get(self, request, **kwargs):
        # We are expecting the pk to be 'agreement' so that are we not doing a
        # get on a list and all the tastypie baggage that provides.
        if kwargs['pk'] != 'agreement':
            raise ImmediateHttpResponse(response=HttpNotFound())

        data = self.deserialize(request,
                                request.raw_post_data,
                                format='application/json')
        form = SBIForm(data)
        if not form.is_valid():
            raise self.form_errors(form)

        res = self.client('GetSBIAgreement', form.bango_data)
        return SBIAgreement(terms(res.sbiAgreement), res.sbiAgreementValidFrom,
                            None, None)
Example #3
0
    def obj_get(self, request, **kwargs):
        # We are expecting the pk to be 'agreement' so that are we not doing a
        # get on a list and all the tastypie baggage that provides.
        if kwargs['pk'] != 'agreement':
            raise ImmediateHttpResponse(response=HttpNotFound())

        data = self.deserialize(request, request.body,
                                format='application/json')
        form = SBIForm(data)
        if not form.is_valid():
            raise self.form_errors(form)

        res = self.client('GetSBIAgreement', form.bango_data)
        return SBIAgreement(terms(res.sbiAgreement),
                            res.sbiAgreementValidFrom,
                            None, None)
 def test_fallback(self):
     assert 'Bango Developer Terms' in terms('sbi', language='de')
 def test_fr(self):
     with open(self.fr, 'w') as fr:
         fr.write('fr')
     assert 'fr' in terms('sbi', language='fr')
 def test_en(self):
     assert 'Bango Developer Terms' in terms('sbi')
Example #7
0
 def test_fallback(self):
     assert 'Bango Developer Terms' in terms('sbi', language='de')
Example #8
0
 def test_fr(self):
     with open(self.fr, 'w') as fr:
         fr.write('fr')
     assert 'fr' in terms('sbi', language='fr')
Example #9
0
 def test_en(self):
     assert 'Bango Developer Terms' in terms('sbi')