Skip to content
Open
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Welcome to your new gem! In this directory, you'll find the files you need to be

TODO: Delete this and the text above, and describe your gem

## Enverus API Documentation

The endpoints that are used in this gem are not publicly documented as Enverus has built
a API specific for FundThrough.

[Documentation for V1 and V2](https://docs.google.com/document/d/1hclQzZH_VeItW4xC8e68RhdD70dWn6l7/edit?usp=sharing&ouid=104023789344514089935&rtpof=true&sd=true)

## Installation

Add this line to your application's Gemfile:
Expand Down
4 changes: 0 additions & 4 deletions lib/open_invoice/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,5 @@ def supplier
def buyer
@buyer ||= ::OpenInvoice::Entities::Buyer.new(supplier_uuid)
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen payment API used by Quickbooks integration. Is it possible that Braavos calls payment for all the integrations and might error out if this is removed? (just wondering if this should be a no-op rather than removed)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm it is possible @dbaron-ft. We have no payments in our braavos db where the source is oi, but looking at the data import job in braavos, there is a Generics::Importers::Base class that is used to imort payments.. which makes me think that maybe it tries to call this endpoint, even for OI?

I can leave it in & add a comment if that makes more sense?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more context, I met with the OI API team last week and asked them about this endpoint. The investigated and confirmed that they have nothing on their end related to a payment endpoint currently in production or being developed

def payment
@buyer ||= ::OpenInvoice::Entities::Payment.new(supplier_uuid)
end
end
end
2 changes: 2 additions & 0 deletions lib/open_invoice/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module Configure

attr_writer(*KEYS)

VERSION_2 = "v2".freeze

def configure
yield self
self
Expand Down
2 changes: 1 addition & 1 deletion lib/open_invoice/entities/buyer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module OpenInvoice
module Entities
class Buyer < Base
def index(opts = {})
request(:get, "/supplier/#{supplier_uuid}/buyers", opts)
request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}/buyers", opts)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/open_invoice/entities/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ module OpenInvoice
module Entities
class Invoice < Base
def index(opts = {})
request(:get, "/supplier/#{supplier_uuid}/invoices/page", opts)
request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}/invoices/page", opts)
end

def attachments(invoice_id, opts = {})
request(:get, "/supplier/#{supplier_uuid}/invoices/#{invoice_id}/attachments", opts)
request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}/invoices/#{invoice_id}/attachments", opts)
end

def download_attachment(invoice_id, attachment_id, file_path, opts)
attachment_url = "/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/attachments/#{attachment_id}"
attachment_url = "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/attachments/#{attachment_id}"
dirname = File.dirname(file_path)
opts[:stream_body] = true
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
Expand All @@ -39,7 +39,7 @@ def download_attachment(invoice_id, attachment_id, file_path, opts)
end

def history(invoice_id, opts = {})
request(:get, "/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/history", opts)
request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/history", opts)
end
end
end
Expand Down
9 changes: 0 additions & 9 deletions lib/open_invoice/entities/payment.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/open_invoice/entities/supplier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module OpenInvoice
module Entities
class Supplier < Base
def index(opts = {})
request(:get, "/supplier/#{supplier_uuid}", opts)
request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}", opts)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/open_invoice/entities/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(user_uuid)
end

def get
request(:get, "/users/#{user_uuid}")
request(:get, "/#{OpenInvoice::Configure::VERSION_2}/users/#{user_uuid}")
end
end
end
Expand Down