Skip to content

Commit

Permalink
Merge pull request #73 from ManishNarayan/manishn/feat_add_contact_to…
Browse files Browse the repository at this point in the history
…_invoice

add customer contact
  • Loading branch information
lockstep-rakesh authored Apr 18, 2024
2 parents a93aea8 + 7664657 commit 53a8f87
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 35 deletions.
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.80)
lockstep_rails (0.3.81)
rails

GEM
Expand Down
1 change: 1 addition & 0 deletions app/models/lockstep/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 Down
67 changes: 34 additions & 33 deletions app/platform_api/schema/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ def self.id_ref
nil
end

# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
#
# The GroupKey uniquely identifies a single Lockstep 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 this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
#
# The unique ID of this record, automatically assigned by Lockstep when this record is
# added to the Lockstep platform.
#
# For the ID of this record in its originating financial system, see `ErpKey`.
# @type: string
# @format: uuid
Expand All @@ -31,23 +31,23 @@ def self.id_ref
# @format: uuid
field :customer_id

# The unique ID of this record as it was known in its originating financial system.
#
# If this company record was imported from a financial system, it will have the value `ErpKey`
# set to the original primary key number of the record as it was known in the originating financial
# system. If this record was not imported, this value will be `null`.
#
# The unique ID of this record as it was known in its originating financial system.
#
# If this company record was imported from a financial system, it will have the value `ErpKey`
# set to the original primary key number of the record as it was known in the originating financial
# system. If this record was not imported, this value will be `null`.
#
# For more information, see [Identity Columns](https://developer.lockstep.io/docs/identity-columns).
# @type: string
field :erp_key

# The "Purchase Order Code" is a code that is sometimes used by companies to refer to the original PO
# that was sent that caused this invoice to be written. If a customer sends a purchase order to a vendor,
# The "Purchase Order Code" is a code that is sometimes used by companies to refer to the original PO
# that was sent that caused this invoice to be written. If a customer sends a purchase order to a vendor,
# the vendor can then create an invoice and refer back to the originating purchase order using this field.
# @type: string
field :purchase_order_code

# An additional reference code that is sometimes used to identify this invoice.
# An additional reference code that is sometimes used to identify this invoice.
# The meaning of this field is specific to the ERP or accounting system used by the user.
# @type: string
field :reference_code
Expand All @@ -60,20 +60,20 @@ def self.id_ref
# @type: string
field :salesperson_name

# A code identifying the type of this invoice.
#
# Recognized Invoice types are:
# * `AR Invoice` - Represents an invoice sent by Company to the Customer
# * `AP Invoice` - Represents an invoice sent by Vendor to the Company
# * `AR Credit Memo` - Represents a credit memo generated by Company given to Customer
# A code identifying the type of this invoice.
#
# Recognized Invoice types are:
# * `AR Invoice` - Represents an invoice sent by Company to the Customer
# * `AP Invoice` - Represents an invoice sent by Vendor to the Company
# * `AR Credit Memo` - Represents a credit memo generated by Company given to Customer
# * `AP Credit Memo` - Represents a credit memo generated by Vendor given to Company
# @type: string
field :invoice_type_code

# A code identifying the status of this invoice.
#
# Recognized Invoice status codes are:
# * `Open` - Represents an invoice that is considered open and needs more work to complete
# A code identifying the status of this invoice.
#
# Recognized Invoice status codes are:
# * `Open` - Represents an invoice that is considered open and needs more work to complete
# * `Closed` - Represents an invoice that is considered closed and resolved
# @type: string
field :invoice_status_code
Expand All @@ -87,7 +87,7 @@ def self.id_ref
# @type: string
field :workflow_status_notes

# A code identifying the terms given to the purchaser. This field is imported directly from the originating
# A code identifying the terms given to the purchaser. This field is imported directly from the originating
# financial system and does not follow a specified format.
# @type: string
field :terms_code
Expand Down Expand Up @@ -135,7 +135,7 @@ def self.id_ref
# @format: date
field :posted_date

# The date when the invoice was closed and finalized after completion of all payments and delivery of all products and
# The date when the invoice was closed and finalized after completion of all payments and delivery of all products and
# services.
# @type: string
# @format: date
Expand Down Expand Up @@ -186,9 +186,9 @@ def self.id_ref
# @format: uuid
field :modified_user_id

# The AppEnrollmentId of the application that imported this record. For accounts
# with more than one financial system connected, this field identifies the originating
# financial system that produced this record. This value is null if this record
# The AppEnrollmentId of the application that imported this record. For accounts
# with more than one financial system connected, this field identifies the originating
# financial system that produced this record. This value is null if this record
# was not loaded from an external ERP or financial system.
# @type: string
# @format: uuid
Expand Down Expand Up @@ -254,15 +254,15 @@ def self.id_ref
# @format: date-time
field :source_modified_date, Types::Params::DateTime

# The Company associated to this invoice.
# The Company associated to this invoice.
# To retrieve this item, specify `Company` in the "Include" parameter for your query.
field :company

# The Customer associated to the invoice customer
# The Customer associated to the invoice customer
# To retrieve this item, specify `Customer` in the "Include" parameter for your query.
field :customer

# The Contact associated to the invoice customer
# The Contact associated to the invoice customer
# To retrieve this item, specify `Customer` in the "Include" parameter for your query.
field :customer_primary_contact

Expand All @@ -280,6 +280,7 @@ def self.id_ref
belongs_to :connection, {:class_name=>"Lockstep::Connection", :primary_key=>:company_id, :foreign_key=>"customer_id"}
belongs_to :created_user, {:class_name=>"Lockstep::User", :primary_key=>:user_id, :foreign_key=>"created_user_id"}
belongs_to :modified_user, {:class_name=>"Lockstep::User", :primary_key=>:user_id, :foreign_key=>"modified_user_id"}
belongs_to :customer_primary_contact, {:class_name=>"Lockstep::Contact", :included=>true}

has_many :workflow_statuses, {:class_name=>"Schema::InvoiceWorkflowStatusHistory", :included=>true}
has_many :addresses, {:class_name=>"Schema::InvoiceAddress", :included=>true}
Expand Down
2 changes: 1 addition & 1 deletion lib/lockstep_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module LockstepRails
VERSION = '0.3.80'
VERSION = '0.3.81'
end

0 comments on commit 53a8f87

Please sign in to comment.