Esempio n. 1
0
    def post(self, request, format=None):
        data = request.data
        try:
            category = 'Agent'
            currency_code = 'KES'
            user_id = data['agentID']
            source = data['source']
            amount = data['amount']
            ref_id = data['refID']
            print ref_id, amount, source, user_id, currency_code, category

            gateway = SleuthGateway()
            response_data = gateway.top_up_user(
                user_category=category,
                user_id=user_id,
                source=source,
                amount=amount,
                ref_id=ref_id,
                currency_code=currency_code
            )
            print response_data

        except SleuthGatewayException, e:
            print "Caught exception when calling AT Gateway: " + str(e)
            response_data = {}
Esempio n. 2
0
    def get(self, request, format=None):
        data = request.query_params
        try:
            user_category = data['userCategory']
            user_id = data['userId']

            gateway = SleuthGateway()
            response_data = gateway.get_user_balance(
                user_category=user_category,
                user_id=user_id,
            )

        except SleuthGatewayException, e:
            print "Caught exception when calling AT Gateway: " + str(e)
            response_data = {}