# frozen_string_literal: true module CapitalOnTap class Application SALUTATIONS = %w[Mr Mrs Miss Ms Dr] BUSINESS_TYPES = %w[SoleTrader Partnership LimitedCompany LimitedLiabilityPartnership].freeze attr_accessor :salutation, :first_name, :middle_name, :last_name, :date_of_birth, :mobile_phone attr_accessor :home_phone, :email_address, :customer_uses_personal_bank_account_for_business attr_accessor :monthly_income, :monthly_expenditure, :personal_address attr_accessor :trading_name, :business_legal_name, :business_land_line, :years_trading attr_accessor :monthly_turn_over, :business_type, :registration_number, :business_address attr_accessor :promo_code, :on_paste_event_fields, :montly_business_expenditure attr_accessor :external_reference, :partner_code, :restricted_countries, :requested_credit # Create a new application with the given parameters # Example JSON: # { # "salutation": "Mr", # "firstName": "Joe", # "middleName": "Fred", # "lastName": "Bloggs", # "dateOfBirth": "1970-02-15", # "mobilePhone": "07700900408", # "homePhone": "02079460794", # "emailAddress": "joe.bloggs@mail.com", # "customerUsesPersonalBankAccountforBusiness": true, # "monthlyIncome": "3000", # "monthlyExpenditure": "2000", # # "personalAddress": { # "company" : "" # "buildingName": "Home Building", # "buildingNumber": "123", # "unitNumber": "A", # "street": "Home Street", # "city": "London", # "postCode": "W123456", # "countryCode": "UK", # "line1":"PostApplication", # "line2":null # }, # # "tradingName": "Joe Bloggs Ltd", # "businessLegalName": "Joe Bloggs Ltd", # "businessLandline": "02079460182", # "yearsTrading": "5", # "monthlyTurnOver": "10000", # "businessType": "SoleTrader", # "registrationNumber": "12345678", # # "businessAddress": { # "company" : null, # "buildingName": "Business Building", # "buildingNumber": "123", # "unitNumber": "A", # "street": "Business Street", # "city": "London", # "postCode": "W123456", # "countryCode": "UK", # "line1":"PostApplication", # "line2":null # }, # "promoCode": "ExampleCode", # "onPasteEventFields": "firstName", # "monthlyBusinessExpenditure": "5000", # "externalReference": "ExampleAccountNumber", # "partnerCode":null, # "restrictedCountries":false, # "requestedCredit":10000, # } def self.create(params) response = CapitalOnTap.connection.post('/Applications', params) response end def self.status(locator_id) CapitalOnTap.connection.get("/Applications/#{locator_id}") end end end