Build Status Gem Version Coverage Status

synapse_client

A ruby client for the SynapsePay.com API.

I ripped originally wrote this in a rails app of mine and stripped this out. There's some work left to do to really make it a true ruby gem. See that in the todo section.

Notes

  • This is written with the perspective of being the merchant. This gem doesn't support marketplace payments yet, although SynapsePay does support that.
  • This is also written with the assumption that a customer has no knowledge of their Synapse account. This means:
    • that this gem says "Customers" when Synapse says "Users"
    • all orders are bank pay orders
    • customers do not have passwords

Installation

Include the following in your Gemfile

  gem "syanpse_client"

and then run bundle install.

You can also simply run gem install synapse_client.

Usage

See the specs for the most up to date usage demo.

configuration

  SynapseClient.client_id           = "e06fa0f143a267c2ed8e"
  SynapseClient.client_secret       = "f578105bf9ae03d9310e0af6f4637c1bf363998b"
  SynapseClient.merchant_synapse_id = 1
  SynapseClient.dev                 = true

create a customer

  SynapseClient::Customer.create({
    :email       => "[email protected]",
    :fullname    => "Foo Bar,
    :phonenumber => "5555555555",
    :ip_address  => "8.8.8.8"
  })

retrieve a customer

  SynapseClient::Customer.retrieve("_customer_access_token_")

list bank accounts for a customer

  @customer.bank_accounts

add a bank account to a customer with just account & routing number

  @customer.({
    :account_num   => "1111111111",
    :routing_num   => "084000026",
    :nickname      => "Example bank account",
    :account_type  => "1",
    :account_class => "1"
  })
  @customer.({
    :username => "synapse_good",
    :password => "test1234",
    :pin      => "1234",
    :bank     => "Bank of America"
  })

get recent orders for a customer

  @customer.orders

add an order for a customer

  @customer.add_order({
    :amount  => 500,      # $500 USD
    :bank_id => 1
  })

retrieve an order

  SynapseClient::Order.retrieve(4)

TODO (in order of priority)

  • Better synapse error handling
  • HTTP Error handling
  • Logging
  • MassPay
  • Refresh access tokens
  • Security Questions
  • Deposits
  • Withdrawals
  • Callbacks?

Links