zoukankan      html  css  js  c++  java
  • 安装Braintree Python模块(braintree==3.45.0)

    一、项目的settings.py文件添加下列内容:

    # Braintree settings
    BRAINTREE_MERCHANT_ID = '保密'
    BRAINTREE_PUBLIC_KEY = '保密'
    BRAINTREE_PRIVATE_KEY = '保密'
    from braintree import Configuration, Environment
    Configuration.configure(
        Environment.parse_environment("sandbox"),  # 这一句重点,千万別写成 Environment.Sandbox
        # Environment.parse_environment("product"),
        BRAINTREE_MERCHANT_ID,
        BRAINTREE_PUBLIC_KEY,
        BRAINTREE_PRIVATE_KEY
    )
    

    二、Environment.parse_environment("sandbox"),  这一句重点,千万別写成 Environment.Sandbox ,

    原因如下:

    1、ctrl+鼠标左键点击上面代码的configure(参数1,参数2,参数3,参数4),会发现 参数1 要填 environment,

    2、为了找到 environment ,

    ctrl+鼠标左键点击上面代码的Environment,

    会发现类Environment里的函数  def parse_environment(environment),  返回值是  Environment.All[environment],

    正好 Environment.All["sandbox"] = Environment.Sandbox 

    @staticmethod
        def parse_environment(environment):
            if isinstance(environment, Environment) or environment is None:
                return environment
            try:
                return Environment.All[environment]
            # ...............................
    #........................................ Environment.All = { "development": Environment.Development, "integration": Environment.Development, "qa": Environment.QA, "sandbox": Environment.Sandbox, "production": Environment.Production }

      

  • 相关阅读:
    批处理实现SQLServer数据库备份与还原
    Axapta物流模块深度历险(二)
    Axapta4.0Tech
    Script#
    Axapta物流模块深度历险(一)
    Agrs Class
    折半的意义
    个人性格
    诚实
    英语学习闪存
  • 原文地址:https://www.cnblogs.com/tuobei/p/12529105.html
Copyright © 2011-2022 走看看