Ejemplo n.º 1
0
    def create(self, request, *args, **kw):
        form = RefundForm(request.DATA)
        if not form.is_valid():
            return self.form_errors(form)

        obj = form.cleaned_data['uuid']
        manual = form.cleaned_data['manual']
        external_uuid = str(uuid.uuid4())

        try:
            res = self.client('DoRefund', {
                'bango': obj.seller_product.product.bango_id,
                'externalTransactionId': external_uuid,
                'refundType': 'OPERATOR',
                'transactionId': obj.uid_support
            },
                              raise_on=(PENDING, ),
                              client=self.get_client(request.DATA,
                                                     fake=manual))
        except BangoAnticipatedError, exc:
            # We haven't been able to get a response back that is pending
            # so I'm not sure if the refundTransactionId is there. Check
            # this.
            res = EasyObject(responseCode=exc.id,
                             responseMessage=exc.message,
                             refundTransactionId='todo')
Ejemplo n.º 2
0
    def create(self, request, *args, **kw):
        form = RefundForm(request.DATA)
        if not form.is_valid():
            return self.form_errors(form)

        obj = form.cleaned_data['uuid']
        manual = form.cleaned_data['manual']
        external_uuid = str(uuid.uuid4())

        try:
            res = self.client(
                'DoRefund', {
                    'bango': obj.seller_product.product.bango_id,
                    'externalTransactionId': external_uuid,
                    'refundType': 'OPERATOR',
                    'transactionId': obj.uid_support
                },
                raise_on=(PENDING,),
                client=self.get_client(request.DATA, fake=manual)
            )
        except BangoAnticipatedError, exc:
            # We haven't been able to get a response back that is pending
            # so I'm not sure if the refundTransactionId is there. Check
            # this.
            res = EasyObject(
                responseCode=exc.id,
                responseMessage=exc.message,
                refundTransactionId='todo')
Ejemplo n.º 3
0
    def obj_create(self, bundle, request, **kw):
        form = RefundForm(bundle.data)
        if not form.is_valid():
            raise self.form_errors(form)

        obj = form.cleaned_data['uuid']
        manual = form.cleaned_data['manual']
        external_uuid = str(uuid.uuid4())

        try:
            res = self.client(
                'DoRefund', {
                    'bango': obj.seller_product.product.bango_id,
                    'externalTransactionId': external_uuid,
                    'refundType': 'OPERATOR',
                    'transactionId': obj.uid_support
                },
                raise_on=(PENDING,),
                client=self.get_client(bundle.data, fake=manual)
            )
        except BangoFormError, exc:
            # We haven't been able to get a response back that is pending
            # so I'm not sure if the refundTransactionId is there. Check
            # this.
            res = BangoResponse(exc.id, exc.message, 'todo')
Ejemplo n.º 4
0
    def obj_create(self, bundle, request, **kw):
        form = RefundForm(bundle.data)
        if not form.is_valid():
            raise self.form_errors(form)

        obj = form.cleaned_data['uuid']

        external_uuid = str(uuid.uuid4())

        try:
            res = self.client('DoRefund', {
                'bango': obj.seller_product.product.bango_id,
                'externalTransactionId': external_uuid,
                'refundType': 'OPERATOR',
                'transactionId': obj.uid_support
            },
                              raise_on=(PENDING, ),
                              client=self.get_client(bundle.data))
        except BangoFormError, exc:
            # We haven't been able to get a response back that is pending
            # so I'm not sure if the refundTransactionId is there. Check this.
            res = BangoResponse(exc.id, exc.message, 'todo')