def _parse_result(self, transaction: Transaction, result):
        if "success" in result and not result["success"]:
            transaction.fail(fail_reason=str(result["message"]))
            transaction.save()
            return False

        transaction.data['longurl'] = result['payment_request']['longurl']
        return True
    def handle_transaction_response(self, transaction: Transaction, request):
        try:
            if request.GET.get('payment_id', None):
                transaction.data['payment_id'] = request.GET['payment_id']
                self.handle_transaction_response_inner(
                    transaction, transaction.data['payment_id'])
            else:
                error = request.GET.get('err', None) or 'Unknown error'
                transaction.fail(fail_reason=error)
        except TransitionNotAllowed:
            pass

        transaction.save()