Braintree Elixir 项目教程

Braintree Elixir 项目教程

braintree-elixir:credit_card: Native elixir client for Braintree项目地址:https://gitcode.com/gh_mirrors/br/braintree-elixir

1. 项目的目录结构及介绍

Braintree Elixir 项目的目录结构如下:

braintree-elixir/
├── lib/
│   ├── braintree/
│   │   ├── client.ex
│   │   ├── configuration.ex
│   │   └── ...
│   └── braintree.ex
├── priv/
├── test/
│   ├── braintree_test.exs
│   └── ...
├── mix.exs
├── mix.lock
├── README.md
├── CHANGELOG.md
├── LICENSE.txt
└── .gitignore

目录介绍:

  • lib/: 包含项目的主要代码文件,其中 braintree/ 目录下是 Braintree 客户端的具体实现,如 client.exconfiguration.ex
  • priv/: 私有资源文件,通常用于存储项目特定的数据或配置。
  • test/: 包含项目的测试文件,如 braintree_test.exs
  • mix.exs: 项目的配置文件,定义了项目的依赖、版本等信息。
  • mix.lock: 锁定依赖版本的文件。
  • README.md: 项目说明文档。
  • CHANGELOG.md: 项目更新日志。
  • LICENSE.txt: 项目许可证。
  • .gitignore: Git 忽略文件配置。

2. 项目的启动文件介绍

项目的启动文件是 lib/braintree.ex,它定义了 Braintree 模块,并可能包含一些初始化代码或模块导入。

defmodule Braintree do
  # 模块定义和初始化代码
end

3. 项目的配置文件介绍

项目的配置文件是 mix.exs,它包含了项目的依赖、版本、描述等信息。以下是 mix.exs 的部分内容:

defmodule Braintree.Mixfile do
  use Mix.Project

  def project do
    [
      app: :braintree,
      version: "0.13.0",
      elixir: "~> 1.9",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      test_coverage: [tool: ExCoveralls],
      description: description(),
      package: package(),
      name: "Braintree",
      deps: deps(),
      docs: docs(),
      dialyzer: [
        flags: [:unmatched_returns, :error_handling, :race_conditions]
      ]
    ]
  end

  def application do
    [
      extra_applications: [:logger, :xmerl, :telemetry],
      env: [
        environment: :sandbox,
        http_options: [timeout: 30_000],
        master_merchant_id: {:system, "BRAINTREE_MASTER_MERCHANT_ID"},
        merchant_id: {:system, "BRAINTREE_MERCHANT_ID"},
        private_key: {:system, "BRAINTREE_PRIVATE_KEY"},
        public_key: {:system, "BRAINTREE_PUBLIC_KEY"}
      ]
    ]
  end

  defp description do
    """
    Native Braintree client library for Elixir
    """
  end

  defp package do
    [
      maintainers: ["Parker Selbert"],
      licenses: ["MIT"],
      links: %{"GitHub" => "https://github.com/sorentwo/braintree-elixir"},
      files: ~w(lib priv mix.exs README.md CHANGELOG.md)
    ]
  end

  defp deps do
    [
      {:hackney, "~> 1.15"},
      {:plug, "~> 1.12"},
      {:telemetry, "~> 1.0 or ~> 0.4"},
      {:ex_doc, "~> 0.25", only: [:dev, :test], runtime: false},
      {:credo, "~> 1.6", only: [:dev, :test], runtime: false},
      {:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},

braintree-elixir:credit_card: Native elixir client for Braintree项目地址:https://gitcode.com/gh_mirrors/br/braintree-elixir

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谢璋声Shirley

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值