How to use the africastalking.Payment.PaymentService.TRANSFER_TYPE.values function in africastalking

To help you get started, we’ve selected a few africastalking examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AfricasTalkingLtd / africastalking-python / africastalking / Payment.py View on Github external
def mobile_b2b(self, product_name, business, callback=None):

        providers = PaymentService.PROVIDER.values()
        types = PaymentService.TRANSFER_TYPE.values()
        schema = Schema({
            'provider': And(str, lambda s: s in providers),
            'transferType': And(str, lambda s: s in types),
            'currencyCode': And(str, lambda s: len(s) == 3),
            'amount': And(lambda f: float(f) > 0),
            'destinationChannel': And(str, len),
            'destinationAccount': And(str, len),
            Optional('metadata'): And(dict)
        })
        business = schema.validate(business)
        url = self._make_url('/mobile/b2b/request')
        headers = dict(self._headers)
        headers['Content-Type'] = 'application/json'
        data = business.copy()
        data.update({
            'username': self._username,