Module: ShieldPay::Errors

Included in:
Request
Defined in:
lib/shieldpay/errors.rb

Defined Under Namespace

Classes: AddressNotVerified, CompanyAlreadyExists, CustomerDoesntExist, CustomerEmailExists, CustomerMobileExists, InvalidCompanyIdentifier, InvalidOrganizationKey, OrganizationKeyDoesntExist, OtherShieldPayError, RequiredField

Constant Summary collapse

ERROR_MATCHING =
{
  "Invalid Organization key." => InvalidOrganizationKey,
  "OrganizationKey is not valid." => InvalidOrganizationKey,
  "OrganizationKey is not exists." => OrganizationKeyDoesntExist,

  "Company identifier already exists." => CompanyAlreadyExists,
  "Company identifier could not be validated" => InvalidCompanyIdentifier,

  "Email already exists." => CustomerEmailExists,
  "Customer does not exist" => CustomerDoesntExist,
  "Address not verified." => AddressNotVerified,
  "Address not varified, Exception in Request" => AddressNotVerified,

  "This mobile number is already registered." => CustomerMobileExists
}

Instance Method Summary collapse

Instance Method Details

#check_for_error(response_body) ⇒ Object



37
38
39
40
# File 'lib/shieldpay/errors.rb', line 37

def check_for_error(response_body)
  user_message = response_body['coreRes']['userMessage']
  raise_error(user_message) if has_error?(response_body)
end