ex_openpay

A OpenPay Library for Elixir.


Keywords
elixir, elixir-library, ex-openpay, grvty, hex, openpay, openpay-api, phoenix
License
BSD-3-Clause

Documentation

Openpay for Elixir Build Status Hex.pm Hex Docs Hex.pm Coverage Status

An Elixir library for working with Openpay.

Features:

Openpay API

Works with API version 2017-11-24

Usage

Install the dependency:

{:ex_openpay, "~> 0.1.1"}

Next, add to your applications:

defp application do
  extra_applications: [:ex_openpay]
end

Configuration

To make API calls, it is necessary to configure your Openpay Api Key and your Merchant ID

use Mix.Config

config :ex_openpay, api_key: "YOUR API KEY"
config :ex_openpay, merchant_id: "YOUR MERCHANT ID"

To customize the underlying HTTPoison library, you may optionally add an :httpoison_options key to the ex_openpay configuration. For a full list of configuration options, please refer to the HTTPoison documentation.

config :ex_openpay, httpoison_options: [timeout: 10000, recv_timeout: 10000, proxy: {"proxy.mydomain.com", 8080}]

Testing

If you start contributing and you want to run mix test, first you need to export OPENPAY_API_KEY and OPENPAY_MERCHANT_ID environment variables in the same shell as the one you will be running mix test in. All tests have the @tag disabled: false and the test runner is configured to ignore disabled: true. This helps to turn tests on/off when working in them. Most of the tests depends on the order of execution (test random seed = 0) to minimize runtime. I've tried having each tests isolated but this made it take ~10 times longer.

export OPENPAY_API_KEY="yourkey"
export OPENPAY_MERCHANT_ID="yourmerchantid"
mix test

The API

I've tried to make the API somewhat comprehensive and intuitive. If you'd like to see things in detail be sure to have a look at the tests - they show (generally) the way the API goes together.

In general, if Openpay requires some information for a given API call, you'll find that as part of the arity of the given function. For instance if you want to delete a Customer, you'll find that you must pass the id along:

{:ok, result} = ExOpenpay.Customers.delete "some_id"

Authors

Contributing

Feedback, feature requests, and fixes are welcomed and encouraged. Please make appropriate use of Issues and Pull Requests. All code should have accompanying tests.

License

Please see LICENSE for licensing details.


Made with ❤️ by:

StackShare

GRVTY