Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle customer primary contact better #76

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
lockstep_rails (0.3.83)
lockstep_rails (0.3.84)
rails

GEM
Expand Down
7 changes: 6 additions & 1 deletion app/models/lockstep/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Lockstep::Invoice < Lockstep::ApiRecord
load_schema(Schema::Invoice)

belongs_to :connection, class_name: 'Lockstep::Connection', foreign_key: :customer_id
belongs_to :customer_primary_contact, {:class_name=>"Lockstep::Contact", :included=>true}

scope :einvoices, -> { where(is_e_invoice: true).include_object(:customer, :lines, :attachments) }
scope :received_einvoices, -> { einvoices.where(invoice_type_code: 'AP Invoice') }
Expand All @@ -16,4 +15,10 @@ def download_pdf
response = resource.get "#{id}/pdf"
response.body
end

def customer_primary_contact
return nil unless attributes['customer_primary_contact'].present?

Lockstep::Contact.new attributes['customer_primary_contact']
end
end
6 changes: 3 additions & 3 deletions app/platform_api/schema/accounting_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
# @type: string
# @format: uuid
field :accounting_profile_id
Expand All @@ -16,7 +16,7 @@ def self.id_ref
# @format: uuid
field :company_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
6 changes: 3 additions & 3 deletions app/platform_api/schema/accounting_profile_contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
# @type: string
# @format: uuid
field :accounting_profile_contact_id
Expand All @@ -25,7 +25,7 @@ def self.id_ref
# @type: boolean
field :is_primary

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
10 changes: 7 additions & 3 deletions app/platform_api/schema/accounting_profile_contact_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
#
# For the ID of this record in its originating financial system, see `ErpKey`.
# @type: string
Expand All @@ -18,7 +18,7 @@ def self.id_ref
# @format: uuid
field :company_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down Expand Up @@ -77,6 +77,10 @@ def self.id_ref
# @type: string
field :address3

# The fourth line of the address.
# @type: string
field :address4

# The city of the address.
# @type: string
field :city
Expand Down
6 changes: 3 additions & 3 deletions app/platform_api/schema/accounting_profile_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
# @type: string
# @format: uuid
field :accounting_profile_id
Expand All @@ -16,7 +16,7 @@ def self.id_ref
# @format: uuid
field :company_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
2 changes: 1 addition & 1 deletion app/platform_api/schema/api_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.id_ref
# @format: uuid
field :api_key_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
6 changes: 3 additions & 3 deletions app/platform_api/schema/app_enrollment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
# @type: string
# @format: uuid
field :app_enrollment_id
Expand All @@ -17,7 +17,7 @@ def self.id_ref
# @format: uuid
field :app_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
2 changes: 1 addition & 1 deletion app/platform_api/schema/app_enrollment_custom_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.id_ref
# @type: string
field :app_type

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
2 changes: 1 addition & 1 deletion app/platform_api/schema/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def self.id_ref
# @type: boolean
field :is_active

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
18 changes: 9 additions & 9 deletions app/platform_api/schema/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,49 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
# @type: string
# @format: uuid
field :attachment_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
# @type: string
# @format: uuid
field :group_key

# An Attachment is connected to an existing item within the Lockstep Platform by the fields `TableKey` and
# An Attachment is connected to an existing item within the ADS Platform by the fields `TableKey` and
# `ObjectKey`. For example, an Attachment connected to Invoice 12345 would have a `TableKey` value of
# `Invoice` and an `ObjectKey` value of `12345`.
#
# The `TableKey` value contains the name of the table within the Lockstep Platform to which this Attachment
# The `TableKey` value contains the name of the table within the ADS Platform to which this Attachment
# is connected.
#
# For more information, see [linking metadata to an object](https://developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
# @type: string
field :table_key

# An Attachment is connected to an existing item within the Lockstep Platform by the fields `TableKey` and
# An Attachment is connected to an existing item within the ADS Platform by the fields `TableKey` and
# `ObjectKey`. For example, an Attachment connected to Invoice 12345 would have a `TableKey` value of
# `Invoice` and an `ObjectKey` value of `12345`.
#
# The `ObjectKey` value contains the primary key of the record within the Lockstep Platform to which this
# The `ObjectKey` value contains the primary key of the record within the ADS Platform to which this
# Attachment is connected.
#
# For more information, see [linking metadata to an object](https://developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
# @type: string
# @format: uuid
field :object_key

# An Attachment represents a file that was uploaded to the Lockstep Platform. This field contains the original
# An Attachment represents a file that was uploaded to the ADS Platform. This field contains the original
# name of the file on disk, without its extension.
# @type: string
field :file_name

# An Attachment represents a file that was uploaded to the Lockstep Platform. This field contains the original
# An Attachment represents a file that was uploaded to the ADS Platform. This field contains the original
# extension name of the file on disk.
# @type: string
field :file_ext
Expand Down
14 changes: 7 additions & 7 deletions app/platform_api/schema/attachment_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ def self.id_ref
nil
end

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
# @type: string
# @format: uuid
field :group_key

# The unique ID of an attachment record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of an attachment record, automatically assigned by ADS when this record is
# added to the ADS Platform.
# @type: string
# @format: uuid
field :attachment_id

# An Attachment is connected to an existing item within the Lockstep Platform by the fields `TableKey` and
# An Attachment is connected to an existing item within the ADS Platform by the fields `TableKey` and
# `ObjectKey`. For example, an Attachment connected to Invoice 12345 would have a `TableKey` value of
# `Invoice` and an `ObjectKey` value of `12345`.
#
# The `ObjectKey` value contains the primary key of the record within the Lockstep Platform to which this
# The `ObjectKey` value contains the primary key of the record within the ADS Platform to which this
# Attachment is connected.
#
# For more information, see [linking metadata to an object](https://developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
# @type: string
# @format: uuid
field :object_key

# An Attachment is connected to an existing item within the Lockstep Platform by the fields `TableKey` and
# An Attachment is connected to an existing item within the ADS Platform by the fields `TableKey` and
# `ObjectKey`. For example, an Attachment connected to Invoice 12345 would have a `TableKey` value of
# `Invoice` and an `ObjectKey` value of `12345`.
#
# The `TableKey` value contains the name of the table within the Lockstep Platform to which this Attachment
# The `TableKey` value contains the name of the table within the ADS Platform to which this Attachment
# is connected.
#
# For more information, see [linking metadata to an object](https://developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
Expand Down
6 changes: 3 additions & 3 deletions app/platform_api/schema/code_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
# @type: string
# @format: uuid
field :code_definition_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
16 changes: 12 additions & 4 deletions app/platform_api/schema/company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def self.id_ref
nil
end

# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
# The unique ID of this record, automatically assigned by ADS when this record is
# added to the ADS Platform.
#
# For the ID of this record in its originating financial system, see `ErpKey`.
# @type: string
Expand Down Expand Up @@ -55,7 +55,7 @@ def self.id_ref
# @format: uuid
field :enterprise_id

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand All @@ -82,7 +82,7 @@ def self.id_ref
# The scan status of the company's logo, if it exists
field :company_logo_status

# The Lockstep `ContactId` of the primary contact for this company.
# The ADS Platform `ContactId` of the primary contact for this company.
# @type: string
# @format: uuid
field :primary_contact_id
Expand All @@ -99,6 +99,10 @@ def self.id_ref
# @type: string
field :address3

# Address info
# @type: string
field :address4

# Address info
# @type: string
field :city
Expand Down Expand Up @@ -209,6 +213,10 @@ def self.id_ref
# @type: string
field :public_url_slug

# Indicates if the primary contact has been set by the user.
# @type: boolean
field :primary_contact_set

# State Tax ID
# @type: string
field :state_tax_id
Expand Down
2 changes: 1 addition & 1 deletion app/platform_api/schema/company_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.id_ref
nil
end

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
2 changes: 1 addition & 1 deletion app/platform_api/schema/company_details_payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.id_ref
nil
end

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# The GroupKey uniquely identifies a single ADS Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
Expand Down
Loading
Loading