class ShieldPay::Customer

Attributes

customer_key[RW]
display_name[RW]
email[RW]
kyc_verified[RW]
mobile_no[RW]

Public Class Methods

create(params={}) click to toggle source

Contact Params Parameter Optional? Description display_name no The customer's name email no Email address for contact person mobile_no no This customer's mobile number

# File lib/shieldpay/customer.rb, line 13
def self.create(params={})
  stringify_keys!(params)
  response = Request.new.post("/Customer/CreateRegisterCustomer", params)

  customer_key = response["Data"].dig("CustomerKey")
  kyc_verified = response["Data"].dig("KYCStatus") == "Verified"
  new.tap do |c|
    c.customer_key = customer_key
    c.kyc_verified = kyc_verified
    c.display_name = params["display_name"]
    c.email = params["email"]
    c.mobile_no = params["mobile_no"]
  end
end
kyc_verify(params={}) click to toggle source

Verification Params Parameter title first_name last_name gender date_of_birth flat_number building_number street state town postcode country customer_key

# File lib/shieldpay/customer.rb, line 44
def self.kyc_verify(params={})
  stringify_keys!(params)
  if params["customer_key"].strip.empty?
    raise ShieldPay::Errors::RequiredField.new("customer_key field is required to verify this customer. You can create a customer_key field using the Customer.create method")
  end
  params["gender"] = params.delete("gender").to_s.upcase
  params["date_of_birth"] = Date.parse(params["date_of_birth"].to_s).to_s
  response = Request.new.post("/Customer/KYCVerification", params)
  kyc_verified = response["Data"].dig("AddressVerified")
  new.tap do |c|
    c.kyc_verified = kyc_verified
  end
end

Public Instance Methods

kyc_verified?() click to toggle source
# File lib/shieldpay/customer.rb, line 58
def kyc_verified?
  @kyc_verified
end