datatrans_helper v0.1.0 DatatransHelper

Small Helper Function to sign Datatrans Request Parameters

Summary

Functions

generate_payment_info(amount, currency, reference)
generate_payment_info(float, String.t, String.t) :: %{merchant_id: String.t, amount: float, currency: String.t, refno: String.t, sign: String.t}

Generate Map of payment parameters.

Examples

iex> Application.put_env(:datatrans_helper, :merchant_id, "73452")
iex> Application.put_env(:datatrans_helper, :hmac_key, "your_key")
iex> DatatransHelper.generate_payment_info(7.2, "CHF", "a5e511e9-7334-44c2-be21-cef964091739")
%{amount: 7.2, currency: "CHF", merchant_id: "73452",
 refno: "a5e511e9-7334-44c2-be21-cef964091739",
 sign: "1EC9627CC7BA2E58251656BD500672BB6C5509FD569BB31737EE381C56CFE785"}