djgoku / peek_poc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PeekPoc

There is one main context PeekPoc.Organizations. There are 3 schemas PeekPoc.Organizations.Customer, PeekPoc.Organizations.Order and PeekPoc.Organizations.Payment. These are all backed by a SQLite3 database.

Current State: Tests Passing

It is easier to say what I didn't implement yet and that was the randomized payment failures.

Here is a run down how to use the code in this repository:

{:ok, customer} = PeekPoc.Organizations.create_customer(%{email: "a@example.com"})
{:ok, order_without_payment} = PeekPoc.Organizations.create_order(%{customer_id: customer.id, original_cost: 30})
PeekPoc.Organizations.get_order(order_without_payment.id)
PeekPoc.Organizations.get_orders_for_customer(customer.email)
{:ok, :payment_made} = PeekPoc.Organizations.apply_payment_to_order(order_without_payment, "payment-1", 1)
{:ok, %{order: order, payment: payment}} = PeekPoc.Organizations.create_order_and_pay(customer, %{original_cost: 5}, %{amount: 1, client_identifier: "payment-1"})

About


Languages

Language:Elixir 100.0%