I hereby claim:
- I am anagromataf on github.
- I am anagrom_ataf (https://keybase.io/anagrom_ataf) on keybase.
- I have a public key whose fingerprint is 858B 05E3 3EE2 9806 F29C 94F3 DA62 05E2 59F7 41BD
To claim this, I am signing this object:
defmodule Store do | |
@callback prepare(ref(), revision(), module(), transaction()) :: | |
{:ok, transaction_ref()} | |
| on_error() | |
@callback commit(ref(), transaction_ref(), state()) :: | |
{:ok, revision()} | |
| on_error() | |
end |
defmodule Action do | |
@callback prepare(state(), args()) :: | |
{:ok, transaction()} | |
| on_error() | |
@callback commit(state(), transaction()) :: | |
{:ok, state(), result()} | |
| on_error() | |
end |
def apply(action, state, args, store, ref, revision) do | |
with {:ok, transaction} <- action.prepare(state, args), | |
{:ok, transaction_ref} <- store.prepare(ref, revision, action, transaction), | |
{:ok, new_state, result} <- action.commit(state, transaction), | |
{:ok, revision} <- store.commit(ref, transaction_ref, new_state) do | |
{:ok, new_state, revision, result} | |
end | |
end |
def capture(checkout, payment) do | |
with {:ok, transaction} <- Capture.prepare(checkout, payment), | |
{:ok, persisted_transaction} <- Store.prepare(checkout, transaction), | |
{:ok, updated_checkout} <- Capture.commit(checkout, persisted_transaction), | |
{:ok, persisted_checkout} <- Store.commit(updated_checkout) do | |
{:ok, checkout} | |
end | |
end |
defmodule Store do | |
def prepare(checkout, transaction) do | |
store_transaction(checkout, transaction) | |
end | |
def commit(checkout) do | |
update_checkout(checkout) | |
end | |
end |
defmodule Capture do | |
def prepare(checkout, payment) do | |
request = %{ | |
amount: checkout.amount, | |
card_pan: payment.card_pan, | |
request_id: UUID.uuid4() | |
} | |
{:ok, request} | |
end |
defmodule Capture do | |
def run(checkout, payment) do | |
with {:ok, prepared_checkout} <- prepare_request(checkout, payment), | |
{:ok, response} <- perform_request(prepared_checkout.request), | |
{:ok, final_checkout} <- handle_response(prepared_checkout, response) do | |
:ok | |
end | |
end | |
def prepare_request(checkout, payment) do |
MAXSPAMSCORE="3" | |
logfile "$HOME/mailfilter.log" | |
# set default Maildir | |
MAILDIR="$HOME/Maildir" | |
# check if we're called from a .qmail-EXT instead of .qmail | |
import EXT | |
if ( $EXT ) |
#!/bin/sh | |
## | |
## Create a folder at /var/teamsserver/ and set the user and group to _teamsserver | |
## Copy this script to /Applications/Xcode.app/Contents/Developer/usr/share/git-core/templates/hooks/post-checkout | |
## | |
export LC_ALL="en_US.UTF-8" | |
export HOME="/var/teamsserver/" |
I hereby claim:
To claim this, I am signing this object: