class OnlinePaymentPlatform::Client::Merchant

Attributes

features[R]
transactions[R]
uid[R]

Public Class Methods

create(opts = {}) click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 45
def self.create(opts = {})
  assert_required_keys!(opts, :country, :emailaddress, :notify_url, :phone)
  Merchant.new post(generate_uri(:merchants), opts)
end
find(uid) click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 50
def self.find(uid)
  response = fetch generate_uri(:merchants, uid)
  Merchant.new response
end
find_or_create(opts = {}) click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 38
def self.find_or_create(opts = {})
  assert_required_keys!(opts, :country, :emailaddress, :notify_url, :phone)
  response = fetch(generate_uri(:merchants) + "?filter[0][name]=emailaddress&filter=[0][operand]=eq&filter[0][value]=#{opts[:emailaddress]}")

  byebug
end
new(opts = {}) click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 10
def initialize(opts = {})
  @features = opts
  @uid = @features['uid']
  @transactions = Transaction.new @uid
end

Public Instance Methods

delete() click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 23
def delete
  update(status: :terminated)
end
migrate(opts = {}) click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 31
def migrate(opts = {})
  parent = self.class
  parent.assert_required_keys!(opts, :coc_nr, :country)
  response = parent.post parent.generate_uri(:merchants, uid, :migrate), opts
  Merchant.new response
end
suspend() click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 27
def suspend
  update(status: :suspended)
end
update(opts = {}) click to toggle source
# File lib/online_payment_platform/client/merchant.rb, line 16
def update(opts = {})
  parent = self.class
  parent.assert_one_of!(opts, :notify_url, :return_url, :metadata, :status)
  response = parent.post parent.generate_uri(:merchants, uid), opts
  Merchant.new response
end