import braintree
import gocardless
import paypalrestsdk as paypal


PROVIDER_ID = {'gocardless':1, 'paypal': 2, 'braintree': 3}
PROVIDER_NAME = {1: 'gocardless', 2: 'paypal', 3: 'braintree'}

class payment:
    def __call__(self, **args):
        raise NotImplemented

    def __init__(self, provider='gocardless', style='payment', mode='sandbox'):
       raise NotImplemented

    def lookup_provider_by_id(self, provider_id):
        return PROVIDER_NAME.get(provider_id, None)

    def make_donation(self, amount, reference, redirect_success, redirect_failure):
        raise NotImplemented

    def fetch_subscriptions(self):
        raise NotImplemented

    def subscribe_confirm(self, args):
        raise NotImplemented

    def unsubscribe(self, reference):
        raise NotImplemented

    def subscribe(self, amount, name, redirect_success, redirect_failure, interval_unit='month', interval_length='1'):
        raise NotImplemented

    def confirm(self, args):
        raise NotImplemented

# conf = {
#     'environment': braintree.Environment.Sandbox,
#     'merchant_id': 'b3sdmyczd3fz6b3p',
#     'public_key': 'rxb7yffm3tk758rqi',
#     'private_key': '62f92d2b00a451c40fdf5fbca54f0421'
# }

print(braintree.Configuration.configure(braintree.Environment.Sandbox, merchant_id='b3sdmyczd3fz6b3p', public_key='rxb7yffm3tk758rq', private_key='62f92d2b00a451c40fdf5fbca54f0421'))
#braintree.Configuration.configure(**conf)
token = braintree.ClientToken.generate()
print(token)
result = braintree.Transaction.sale({
    "amount": "10.00",
    "payment_method_nonce": token,
    "options": {
      "submit_for_settlement": True
     }
 })

result = braintree.Subscription.create({
    "payment_method_token": token,
    "plan_id": "membership",
    "price": "20.00"
})


print(result)
