Ejemplo n.º 1
0
def sbi_post(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}
    try:
        res = view.client('AcceptSBIAgreement', data,
                          raise_on=[SBI_ALREADY_ACCEPTED])
    except BangoAnticipatedError, exc:
        if exc.id != SBI_ALREADY_ACCEPTED:
            raise
Ejemplo n.º 2
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)