class PS::Customer

Attributes

alt_email[RW]
alt_phone[RW]
billing_address1[RW]
billing_address2[RW]
billing_city[RW]
billing_country_code[RW]
billing_postal_code[RW]
billing_state[RW]
company_name[RW]
created_on[RW]
email[RW]
fax[RW]
first_name[RW]
last_modified[RW]
last_name[RW]
middle_name[RW]
notes[RW]
phone[RW]
shipping_address1[RW]
shipping_address2[RW]
shipping_city[RW]
shipping_country_code[RW]
shipping_postal_code[RW]
shipping_same_as_billing[RW]
shipping_state[RW]
web_site[RW]

Public Class Methods

create(options={}) click to toggle source
# File lib/ps/objects/customer.rb, line 72
def create(options={})
  customer = self.new(options)
  customer.save()
  return customer
end
create_and_make_ach_payment(customer={}, account={}, amount=0.0, cid="") click to toggle source
# File lib/ps/objects/customer.rb, line 55
def create_and_make_ach_payment(customer={}, account={}, amount=0.0, cid="")
  request("addcustomerandmakeachpayment", {
    :customer => customer, 
    :customerAccount => account, 
    :amount => amount, 
    :cid => cid
  }, &instantiate_object)
end
create_and_make_cc_payment(customer={}, account={}, amount=0.0, cid="") click to toggle source

returns [ PS::Customer, PS::CustomerAccount, PS::Payment ]

# File lib/ps/objects/customer.rb, line 45
def create_and_make_cc_payment(customer={}, account={}, amount=0.0, cid="")
  request("addcustomerandmakeccpayment", {
    :customer => customer, 
    #account must have a customer_id of 0
    :customerAccount => account, 
    :amount => amount, 
    :cid => cid
  }, &instantiate_object)
end
find(id) click to toggle source
# File lib/ps/objects/customer.rb, line 68
def find(id)
  request("getcustomer", { :id => id }, &instantiate_object)
end
get_customer_and_default_accounts(customer_id) click to toggle source
# File lib/ps/objects/customer.rb, line 64
def get_customer_and_default_accounts(customer_id)
  request("GetCustomerAndDefaultAccounts", { :customerId => customer_id }, &instantiate_object)
end

Public Instance Methods

default_credit_card_account() click to toggle source
# File lib/ps/objects/customer.rb, line 39
def default_credit_card_account
  CreditCardAccount.default_for_customer_id(self.ps_reference_id)
end
default_customer_account() click to toggle source
# File lib/ps/objects/customer.rb, line 35
def default_customer_account
  CustomerAccount.default(self.ps_reference_id)
end
destroy() click to toggle source
# File lib/ps/objects/customer.rb, line 18
def destroy
  if self.ps_reference_id then
    request("deletecustomer", { :id => self.ps_reference_id } ) 
    true
  else
    false
  end
end
payments() click to toggle source
# File lib/ps/objects/customer.rb, line 27
def payments
  Payment.find(self.ps_reference_id)
end
save() click to toggle source
# File lib/ps/objects/customer.rb, line 5
def save
  begin
    save!()
    true
  rescue Exception
    false
  end
end
save!() click to toggle source
# File lib/ps/objects/customer.rb, line 14
def save!
  request("addcustomer", { :customer => attributes }, &update_self)
end
set_default_customer_account(account_id) click to toggle source
# File lib/ps/objects/customer.rb, line 31
def set_default_customer_account(account_id)
  CustomerAccount.find(account_id).make_default
end