Packages

A Simple LIB to use the Checkout.com API

Current section

Files

Jump to
checkout_sdk lib requests payments sources we_chat_pay.ex
Raw

lib/requests/payments/sources/we_chat_pay.ex

defmodule Requests.Payments.Sources.WeChatPay do
alias Customers.BillingAddress
@type t :: %__MODULE__{
type: String.t(),
billing_address: String.t()
}
@enforce_keys [:type]
defstruct [
:type,
:billing_address
]
def build(%{type: type, billing_address: billing_address}) do
%{
type: type,
billing_address: BillingAddress.build(billing_address)
}
end
def build(%{"type" => type, "billing_address" => billing_address}) do
%{
type: type,
billing_address: BillingAddress.build(billing_address)
}
end
def build(_), do: nil
end