# ExSaferpay
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/jshmrtn/ex-saferpay/master/LICENSE)
[![Build Status](https://travis-ci.org/jshmrtn/ex-saferpay.svg?branch=master)](https://travis-ci.org/jshmrtn/ex-saferpay)
[![Hex.pm Version](https://img.shields.io/hexpm/v/ex_saferpay.svg?style=flat)](https://hex.pm/packages/ex_saferpay)
[![InchCI](https://inch-ci.org/github/jshmrtn/ex-saferpay.svg?branch=master)](https://inch-ci.org/github/jshmrtn/ex-saferpay)
[![Coverage Status](https://coveralls.io/repos/github/jshmrtn/ex-saferpay/badge.svg?branch=master)](https://coveralls.io/github/jshmrtn/ex-saferpay?branch=master)
Elixir wrapper for Saferpay JSON API.
**This library is in development and not yet ready!**
## Installation
The package can be installed by adding `ex_saferpay` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ex_saferpay, "~> 0.2"}
]
end
```
The docs can be found at [https://hexdocs.pm/ex_saferpay](https://hexdocs.pm/ex_saferpay).
## Configuration
```elixir
config :ex_saferpay,
environment: :test, # :test or :prod, default = :test
authentication_method: :credentials, # :credentials or :client_ssl, default = :credentials
client_key: {:file, path}, # Path to pem formatted key. Only required with auth method client_ssl
client_certificate: {:file, path}, # Path to pem formatted certificate. Only required with auth method client_ssl
username: "username", # Username for JSON API. Only required with auth method credentials
password: "password", # Password for JSON API. Only required with auth method credentials
customer_id: 7, # Customer ID
terminal_id: 7 # Terminal ID
```
## Testing
To test the library, a test account has to be acquired from Saferpay. https://test.saferpay.com/BO/SignUp?lang=de
### Environment Variables
Those values can be obtained from the registration email form the test account creation.
* `SAFERPAY_USERNAME` - API username
* `SAFERPAY_PASSWORD` - API password
* `SAFERPAY_CUSTOMER_ID` - Customer ID
* `SAFERPAY_TERMINAL_ID` - Terminal ID
### Response Mocks
The library has included response mocking capability. To see how to use it, look at existing tests.
There are mix commands to manage the mock responses.