ECPayInvoice.Payload (ecpay_invoice v0.0.1-alpha9)

This module contains functions related to encoding request payloads to the format expected by the ECPay API.

Link to this section Summary

Functions

With a given payload as map and a profile name as string or atom, encodes the given payload to the JSON format expected by the ECPay Invoice API, putting the respective fields of the request, such as Revision key, MerchantID, and Timestamp, in the correct parts of the JSON object.

Link to this section Functions

Link to this function

encode(data, profile)

Specs

encode(data :: map(), profile :: atom() | binary()) :: binary()

With a given payload as map and a profile name as string or atom, encodes the given payload to the JSON format expected by the ECPay Invoice API, putting the respective fields of the request, such as Revision key, MerchantID, and Timestamp, in the correct parts of the JSON object.

Serializes the original payload as JSON, URL-encodes it, encrypts it using the AES cipher as required by the API, and serializes the resulting binary to Base64. For more details regarding this step, see ECPayInvoice.Crypto.encrypt_payload/2.