This repository has been archived by the owner on Nov 10, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from theinventor/payment_methods
implement list payment methods for online flavor
- Loading branch information
Showing
6 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ coverage | |
.DS_Store | ||
Gemfile.lock | ||
.rvmrc | ||
*~ | ||
*~ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Quickeebooks | ||
module Online | ||
module Model | ||
class PaymentMethod < Quickeebooks::Online::Model::IntuitType | ||
include ActiveModel::Validations | ||
|
||
XML_COLLECTION_NODE = 'PaymentMethods' | ||
XML_NODE = 'PaymentMethod' | ||
|
||
# https://qbo.sbfinance.intuit.com/resource/payment-methods/v2/<realmID> | ||
REST_RESOURCE = "payment-method" | ||
|
||
xml_name 'PaymentMethod' | ||
xml_convention :camelcase | ||
xml_accessor :id, :from => 'Id', :as => Quickeebooks::Online::Model::Id | ||
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer | ||
xml_accessor :meta_data, :from => 'MetaData', :as => Quickeebooks::Online::Model::MetaData | ||
xml_accessor :external_key, :from => 'ExternalKey' | ||
xml_accessor :name, :from => 'Name' | ||
xml_accessor :active, :from => 'Active' | ||
xml_accessor :type, :from => 'Type' | ||
|
||
validates_length_of :name, :minimum => 1 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'quickeebooks/online/model/payment_method' | ||
require 'quickeebooks/online/service/service_base' | ||
|
||
module Quickeebooks | ||
module Online | ||
module Service | ||
class PaymentMethod < ServiceBase | ||
include ServiceCRUD | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
describe "Quickeebooks::Windows::Service::PaymentMethod" do | ||
before(:all) do | ||
construct_oauth_service :payment_method | ||
end | ||
|
||
it "can fetch a list of journal entries" do | ||
xml = onlineFixture("payment_methods.xml") | ||
url = @service.url_for_resource(Quickeebooks::Online::Model::PaymentMethod.resource_for_collection) | ||
FakeWeb.register_uri(:post, url, :status => ["200", "OK"], :body => xml) | ||
payment_methods = @service.list | ||
payment_methods.current_page.should == 1 | ||
payment_methods.entries.count.should == 6 | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<qbo:SearchResults xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo"> | ||
<qbo:CdmCollections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PaymentMethods"> | ||
<PaymentMethod> | ||
<Id idDomain="QBO">3</Id> | ||
<SyncToken>0</SyncToken> | ||
<MetaData> | ||
<CreateTime>2009-06-19T14:04:29-07:00</CreateTime> | ||
<LastUpdatedTime>2009-06-19T14:04:29-07:00</LastUpdatedTime> | ||
</MetaData> | ||
<Name>American Express</Name> | ||
<Type>CREDIT_CARD</Type> | ||
</PaymentMethod> | ||
<PaymentMethod> | ||
<Id idDomain="QBO">1</Id> | ||
<SyncToken>0</SyncToken> | ||
<MetaData> | ||
<CreateTime>2009-06-19T14:04:29-07:00</CreateTime> | ||
<LastUpdatedTime>2009-06-19T14:04:29-07:00</LastUpdatedTime> | ||
</MetaData> | ||
<Name>Cash</Name> | ||
<Type>NON_CREDIT_CARD</Type> | ||
</PaymentMethod> | ||
<PaymentMethod> | ||
<Id idDomain="QBO">2</Id> | ||
<SyncToken>0</SyncToken> | ||
<MetaData> | ||
<CreateTime>2009-06-19T14:04:29-07:00</CreateTime> | ||
<LastUpdatedTime>2009-06-19T14:04:29-07:00</LastUpdatedTime> | ||
</MetaData> | ||
<Name>Check</Name> | ||
<Type>NON_CREDIT_CARD</Type> | ||
</PaymentMethod> | ||
<PaymentMethod> | ||
<Id idDomain="QBO">4</Id> | ||
<SyncToken>0</SyncToken> | ||
<MetaData> | ||
<CreateTime>2009-06-19T14:04:29-07:00</CreateTime> | ||
<LastUpdatedTime>2009-06-19T14:04:29-07:00</LastUpdatedTime> | ||
</MetaData> | ||
<Name>Discover</Name> | ||
<Type>CREDIT_CARD</Type> | ||
</PaymentMethod> | ||
<PaymentMethod> | ||
<Id idDomain="QBO">5</Id> | ||
<SyncToken>0</SyncToken> | ||
<MetaData> | ||
<CreateTime>2009-06-19T14:04:29-07:00</CreateTime> | ||
<LastUpdatedTime>2009-06-19T14:04:29-07:00</LastUpdatedTime> | ||
</MetaData> | ||
<Name>MasterCard</Name> | ||
<Type>CREDIT_CARD</Type> | ||
</PaymentMethod> | ||
<PaymentMethod> | ||
<Id idDomain="QBO">6</Id> | ||
<SyncToken>0</SyncToken> | ||
<MetaData> | ||
<CreateTime>2009-06-19T14:04:29-07:00</CreateTime> | ||
<LastUpdatedTime>2009-06-19T14:04:29-07:00</LastUpdatedTime> | ||
</MetaData> | ||
<Name>Visa</Name> | ||
<Type>CREDIT_CARD</Type> | ||
</PaymentMethod> | ||
</qbo:CdmCollections> | ||
<qbo:Count>6</qbo:Count> | ||
<qbo:CurrentPage>1</qbo:CurrentPage> | ||
</qbo:SearchResults> |