Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

jshmrtn/ex-saferpay

Repository files navigation

ExSaferpay

GitHub license Build Status Hex.pm Version InchCI Coverage Status

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:

def deps do
  [
    {:ex_saferpay, "~> 0.2"}
  ]
end

The docs can be found at https://hexdocs.pm/ex_saferpay.

Configuration

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.