netsuite 0.8.6 → 0.8.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +20 -0
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -0
  5. data/Gemfile +1 -6
  6. data/HISTORY.md +38 -0
  7. data/README.md +42 -21
  8. data/Rakefile +1 -1
  9. data/lib/netsuite/configuration.rb +13 -0
  10. data/lib/netsuite/records/accounting_period.rb +2 -2
  11. data/lib/netsuite/records/assembly_unbuild.rb +1 -3
  12. data/lib/netsuite/records/contact.rb +1 -1
  13. data/lib/netsuite/records/cost_category.rb +28 -0
  14. data/lib/netsuite/records/credit_memo.rb +1 -1
  15. data/lib/netsuite/records/currency_rate.rb +1 -1
  16. data/lib/netsuite/records/custom_field_list.rb +9 -3
  17. data/lib/netsuite/records/customer_deposit.rb +5 -5
  18. data/lib/netsuite/records/customer_payment.rb +5 -2
  19. data/lib/netsuite/records/customer_payment_credit.rb +17 -0
  20. data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
  21. data/lib/netsuite/records/estimate.rb +95 -14
  22. data/lib/netsuite/records/inventory_item.rb +62 -1
  23. data/lib/netsuite/records/inventory_number.rb +1 -1
  24. data/lib/netsuite/records/inventory_transfer.rb +1 -0
  25. data/lib/netsuite/records/invoice.rb +98 -5
  26. data/lib/netsuite/records/invoice_item.rb +1 -1
  27. data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
  28. data/lib/netsuite/records/item_receipt_item.rb +3 -2
  29. data/lib/netsuite/records/member_list.rb +0 -2
  30. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  31. data/lib/netsuite/records/non_inventory_resale_item.rb +1 -1
  32. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  33. data/lib/netsuite/records/opportunity.rb +2 -2
  34. data/lib/netsuite/records/partner.rb +7 -5
  35. data/lib/netsuite/records/phone_call.rb +1 -1
  36. data/lib/netsuite/records/serialized_assembly_item.rb +3 -2
  37. data/lib/netsuite/records/service_resale_item.rb +1 -1
  38. data/lib/netsuite/records/service_sale_item.rb +1 -1
  39. data/lib/netsuite/records/transfer_order_item.rb +1 -1
  40. data/lib/netsuite/records/vendor.rb +6 -5
  41. data/lib/netsuite/records/vendor_currency.rb +26 -0
  42. data/lib/netsuite/records/vendor_currency_list.rb +9 -0
  43. data/lib/netsuite/support/fields.rb +17 -0
  44. data/lib/netsuite/support/records.rb +1 -1
  45. data/lib/netsuite/support/search_result.rb +23 -4
  46. data/lib/netsuite/utilities.rb +1 -0
  47. data/lib/netsuite/version.rb +1 -1
  48. data/lib/netsuite.rb +5 -0
  49. data/netsuite.gemspec +4 -2
  50. data/spec/netsuite/actions/search_spec.rb +22 -0
  51. data/spec/netsuite/configuration_spec.rb +33 -1
  52. data/spec/netsuite/records/basic_record_spec.rb +8 -1
  53. data/spec/netsuite/records/cost_category_spec.rb +105 -0
  54. data/spec/netsuite/records/custom_field_list_spec.rb +40 -2
  55. data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
  56. data/spec/netsuite/records/customer_payment_spec.rb +1 -6
  57. data/spec/netsuite/records/estimate_spec.rb +103 -13
  58. data/spec/netsuite/records/inventory_item_spec.rb +65 -0
  59. data/spec/netsuite/records/invoice_spec.rb +94 -0
  60. data/spec/netsuite/records/partner_spec.rb +6 -4
  61. data/spec/netsuite/records/vendor_spec.rb +1 -1
  62. data/spec/netsuite/support/fields_spec.rb +36 -1
  63. data/spec/support/field_matcher.rb +8 -6
  64. data/spec/support/fixtures/custom_fields/multi_select.xml +47 -0
  65. data/spec/support/fixtures/search/saved_search_item.xml +55 -0
  66. data/spec/support/fixtures/search/saved_search_joined_custom_customer.xml +15 -1
  67. data/spec/support/search_only_field_matcher.rb +7 -0
  68. metadata +42 -16
  69. data/circle.yml +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c52f30c1f82b68e1ac2e078d81eed79f6c34ec0cc5937dd4251a53cb9a5a5c0
4
- data.tar.gz: 4208277a164ec0b92520cef24b19367538788ecce870cd37f683ddb9fb85143e
3
+ metadata.gz: 5b4128e448acd323b0ed8828e4974270806ea84372925ba266b6dd71014e3105
4
+ data.tar.gz: 676b94d3445e96b7064826f70e393a92f44814e3c2e0ffe5cf5ae4bdd87a4f74
5
5
  SHA512:
6
- metadata.gz: bd8c7a34e1ecced72b398715f17978677bc87021e0bc9581449299f918b51993770d956eb3553775c1631ef16c8e488e6ffe682d9575665d81434106635f7e53
7
- data.tar.gz: f40134f2aaf8824e9b51f9dba00a8a4d9b3b1e935df0d0d07f100018becf8180f6b603f63e52331e65877bbeb135de491fed75a9c5af0928e7409eedbc2f62b4
6
+ metadata.gz: 4ee18c44870a2ee0be4bb9ab21aeb912c682cf861830909780f2601620c57a0bda210a91855490d882a637a561e0c4ee363fae694de633de7fe0d3d0f07c3cd9
7
+ data.tar.gz: fbbd65d4baeafb3b94605ee875189264f1811bdb532c93cb9ac7d80c192784c57c3770da0a1e113ac38941680bd12db5f9eefa3afecc982bd4b3dec462107fa6
@@ -0,0 +1,20 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby-version: [2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1]
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - name: Set up Ruby ${{ matrix.ruby-version }}
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby-version }}
17
+ - name: Install dependencies
18
+ run: bundle install
19
+ - name: Run tests
20
+ run: bundle exec rake
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 2.7.3
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.3
data/Gemfile CHANGED
@@ -2,15 +2,10 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'simplecov', :require => false
5
- gem 'rspec_junit_formatter'
6
5
 
7
6
  gem 'pry-nav'
8
7
  gem 'pry-rescue'
9
8
 
10
9
  # optional dependency for more accurate timezone conversion
11
10
  gem 'tzinfo', '1.2.5'
12
- # gem 'tzinfo', '2.0.0'
13
-
14
- # required for CircleCI to build properly with ruby 1.9.3
15
- gem 'json', '~> 2.3.0'
16
- gem 'rack', '~> 2.1.4'
11
+ # gem 'tzinfo', '2.0.0'
data/HISTORY.md ADDED
@@ -0,0 +1,38 @@
1
+ ## Unreleased
2
+
3
+ ### Added
4
+ *
5
+
6
+ ### Fixed
7
+ *
8
+
9
+ ## 0.8.10
10
+
11
+ ### Added
12
+
13
+ * Update Estimate record fields/record refs for 2021.2. `balance`, `bill_address`, `bill_is_residential`, and `is_multi_ship_to` were all removed as fields as either being incorrect, outdated, or a search-only field. (#496)
14
+
15
+ ### Fixed
16
+
17
+ * Savon 2.12 supported
18
+
19
+ ## 0.8.9
20
+
21
+ ### Fixed
22
+
23
+ * Fixed issue where search only fields could be specified when an existing field exists. https://github.com/NetSweet/netsuite/pull/488
24
+
25
+ ## 0.8.8
26
+
27
+ ### Added
28
+
29
+ * Adding serialized assembly item to get_item
30
+ * Add CostCategory record (#482)
31
+ * Introduce search only fields (#483)
32
+
33
+ ### Fixed
34
+
35
+ * Fix accessing custom field values returned in advanced search results (#480)
36
+ * Fixing bug where single-selection custom multi select fields would incorrectly be parsed 3377c971d0cb727d81f4b4bc6e30edfbdfaccfd1
37
+ * Fixed some field definitions on serialized assembly item
38
+ * Properly extract external_id from advanced search results (#478)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
2
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
- **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
3
+ **Table of Contents**
4
4
 
5
5
  - [NetSuite SuiteTalk API Ruby Gem](#netsuite-suitetalk-api-ruby-gem)
6
6
  - [Help & Support](#help--support)
@@ -13,35 +13,33 @@
13
13
  - [Custom Records & Fields](#custom-records--fields)
14
14
  - [Searching](#searching)
15
15
  - [Non-standard Operations](#non-standard-operations)
16
- - [About SuiteSync](#about-suitesync)
17
16
 
18
17
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
19
18
 
20
- [![Circle CI](https://circleci.com/gh/NetSweet/netsuite/tree/master.svg?style=svg)](https://circleci.com/gh/NetSweet/netsuite/tree/master)
19
+ [![Ruby](https://github.com/NetSweet/netsuite/actions/workflows/main.yml/badge.svg)](https://github.com/NetSweet/netsuite/actions/workflows/main.yml)
21
20
  [![Slack Status](https://opensuite-slackin.herokuapp.com/badge.svg)](http://opensuite-slackin.herokuapp.com)
22
21
  [![Gem Version](https://badge.fury.io/rb/netsuite.svg)](http://badge.fury.io/rb/netsuite)
23
22
 
24
23
  # NetSuite SuiteTalk API Ruby Gem
25
24
 
26
25
  * This gem will act as a wrapper around the NetSuite SuiteTalk WebServices API.
27
- * The gem does not cover the entire API, only the subset contributors have used so far.
28
- * NetSuite is a complex system. There's a lot to learn and sparse resources available to learn from. Here's a list of [NetSuite Development Resources](https://github.com/NetSweet/netsuite/wiki/NetSuite-Development-Resources) that might make things a bit less painful.
26
+ * The gem does not cover the entire API, only the subset contributors have used so far. Please submit a PR for any functionality that's missing!
27
+ * NetSuite is a complex system. There's a lot to learn and sparse resources available to learn from. Here's a list of [NetSuite Development Resources](https://github.com/NetSweet/netsuite/wiki/NetSuite-Development-Resources).
29
28
 
30
29
  # Help & Support
31
30
 
32
31
  Join the [slack channel](http://opensuite-slackin.herokuapp.com) for help with any NetSuite issues. Please do not post usage questions as issues in GitHub.
33
32
 
34
- Messages in the Slack ground are [archived here](https://suitechat.slackarchive.io). Search the archives to see if your question has been answered before.
35
-
36
33
  There is some additional helpful resources for NetSuite development [listed here](https://dashboard.suitesync.io/docs/resources#netsuite).
37
34
 
38
35
  # Testing
39
36
 
40
37
  Before contributing a patch make sure all existing tests pass.
41
38
 
42
- ```
39
+ ```shell
43
40
  git clone git://github.com/NetSweet/netsuite.git
44
41
  cd netsuite
42
+
45
43
  bundle
46
44
  bundle exec rspec
47
45
  ```
@@ -56,28 +54,44 @@ gem 'netsuite'
56
54
 
57
55
  If you'd like more accurate time conversion support, include the `tzinfo` gem.
58
56
 
59
- This gem is built for ruby 1.9.x+, checkout the [1-8-stable](https://github.com/NetSweet/netsuite/tree/1-8-stable) branch for ruby 1.8.x support.
57
+ This gem is built for ruby 2.6.x+, but should work on older versions down to 1.9. There's a [1-8-stable](https://github.com/NetSweet/netsuite/tree/1-8-stable) branch for ruby 1.8.x support.
60
58
 
61
59
  ## Configuration
62
60
 
63
61
  The most important thing you'll need is your NetSuite account ID. Not sure how to find your account id? [Here's a guide.](http://mikebian.co/find-netsuite-web-services-account-number/)
64
62
 
65
- For most use-cases, the following configuration will be sufficient:
63
+ How you connect to NetSuite has changed a lot over the years and differs between API versions. For instance:
64
+
65
+ * Older API versions (~2015) allowed authentication via username and password
66
+ * Newever API versions (> 2016) still allowed for username and password authentication, but required an application ID
67
+ * "OAuth", which requires four separate keys to be manually generated, was supported sometime after 2015
68
+ * API versions greater than 2018_2 require `endpoint` to be set directly ([more info](https://github.com/NetSweet/netsuite/pull/473))
69
+
70
+ Here's an example connection configuration. You don't want to actually use username + password config; token based authentication is detailed below in a separate section:
66
71
 
67
72
  ```ruby
68
73
  NetSuite.configure do
69
74
  reset!
70
75
 
76
+ # production & sandbox account numbers will differ
71
77
  account 'TSTDRV1576318'
72
78
  api_version '2018_2'
73
79
 
80
+ # password-based login information
81
+ # in most cases you should use token based authentication instead
74
82
  email 'email@example.com'
75
83
  password 'password'
76
84
  role 10
77
85
 
78
- # use `NetSuite::Utilities.data_center_url('TSTDRV1576318')` to retrieve the URL
86
+ # recent API versions require a account-specific endpoint o be set
87
+ # use `NetSuite::Utilities.data_center_url('TSTDRV1576318')` to retrieve wsdl URL
79
88
  # you'll want to do this in a background process and strip the protocol out of the return string
80
89
  wsdl_domain 'tstdrv1576318.suitetalk.api.netsuite.com'
90
+
91
+ # the endpoint indicated in the > 2018_2 wsdl is invalid
92
+ # you must set the endpoint directly
93
+ # https://github.com/NetSweet/netsuite/pull/473
94
+ endpoint "https://#{wsdl_domain}/services/NetSuitePort_#{api_version}"
81
95
  end
82
96
  ```
83
97
 
@@ -115,6 +129,7 @@ NetSuite.configure do
115
129
  # log_level :debug
116
130
 
117
131
  # password-based login information
132
+ # in most cases you should use token based authentication instead
118
133
  email 'email@domain.com'
119
134
  password 'password'
120
135
  account '12345'
@@ -127,9 +142,9 @@ NetSuite.configure do
127
142
  end
128
143
  ```
129
144
 
130
- If you'd like to use a API endpoints greater than 2015_1 you'll need to specify an application ID:
145
+ If are using username + password authentication (which you shouldn't be!) *and* you'd like to use a API endpoints greater than 2015_1 you'll need to specify an application ID:
131
146
 
132
- ```
147
+ ```ruby
133
148
  NetSuite::Configuration.soap_header = {
134
149
  'platformMsgs:ApplicationInfo' => {
135
150
  'platformMsgs:applicationId' => 'your-netsuite-app-id'
@@ -139,7 +154,7 @@ NetSuite::Configuration.soap_header = {
139
154
 
140
155
  ### Token based Authentication
141
156
 
142
- OAuth credentials are also supported. [Learn more about how to set up token based authentication here](http://mikebian.co/using-netsuites-token-based-authentication-with-suitetalk/).
157
+ OAuth credentials are supported and the recommended authentication approach. [Learn more about how to set up token based authentication here](http://mikebian.co/using-netsuites-token-based-authentication-with-suitetalk/).
143
158
 
144
159
  ```ruby
145
160
  NetSuite.configure do
@@ -154,6 +169,11 @@ NetSuite.configure do
154
169
 
155
170
  # oauth does not work with API versions less than 2015_2
156
171
  api_version '2016_2'
172
+
173
+ # the endpoint indicated in the > 2018_2 wsdl is invalid
174
+ # you must set the endpoint directly
175
+ # https://github.com/NetSweet/netsuite/pull/473
176
+ endpoint "https://#{wsdl_domain}/services/NetSuitePort_#{api_version}"
157
177
  end
158
178
  ```
159
179
 
@@ -195,7 +215,7 @@ task.update(message: 'New Message')
195
215
  task.delete
196
216
 
197
217
  # refresh/reload a record (helpful after adding the record for the first time)
198
- task.reload
218
+ task.refresh
199
219
 
200
220
  # using get_select_value with a standard record
201
221
  NetSuite::Records::BaseRefList.get_select_value(
@@ -401,7 +421,10 @@ NetSuite::Records::SalesOrder.search({
401
421
  'tranSales:basic' => [
402
422
  'platformCommon:internalId/' => {},
403
423
  'platformCommon:email/' => {},
404
- 'platformCommon:tranDate/' => {}
424
+ 'platformCommon:tranDate/' => {},
425
+ # If you include columns that are only part of the *SearchRowBasic (ie. TransactionSearchRowBasic),
426
+ # they'll be readable on the resulting record just like regular fields (my_record.close_date).
427
+ 'platformCommon:closeDate/' => {}
405
428
  ],
406
429
  'tranSales:accountJoin' => [
407
430
  'platformCommon:internalId/' => {}
@@ -415,7 +438,9 @@ NetSuite::Records::SalesOrder.search({
415
438
  'tranSales:itemJoin' => [
416
439
  'platformCommon:customFieldList' => [
417
440
  'platformCore:customField/' => {
418
- '@internalId' => 'custitem_apcategoryforsales',
441
+ '@scriptId' => 'custitem_apcategoryforsales',
442
+ # Or, for API versions 2013.1 and older:
443
+ # '@internalId' => 'custitem_apcategoryforsales',
419
444
  '@xsi:type' => "platformCore:SearchColumnSelectCustomField"
420
445
  }
421
446
  ]
@@ -593,7 +618,3 @@ states = NetSuite::Configuration.connection.call(:get_all, message: {
593
618
  })
594
619
  states.to_array.first[:get_all_response][:get_all_result][:record_list][:record].map { |r| { country: r[:country], abbr: r[:shortname], name: r[:full_name] } }
595
620
  ```
596
-
597
- # About SuiteSync
598
-
599
- [SuiteSync, the Stripe-NetSuite integration](http://suitesync.io) uses this gem and funds the majority of it's development and maintenance.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ task :default => :spec
7
7
 
8
8
  desc 'Run specs'
9
9
  RSpec::Core::RakeTask.new do |t|
10
- t.pattern = './spec/**/*_spec.rb'
10
+ # t.pattern = './spec/**/*_spec.rb'
11
11
  end
12
12
 
13
13
  desc 'Generate code coverage'
@@ -17,6 +17,7 @@ module NetSuite
17
17
  def connection(params={}, credentials={})
18
18
  client = Savon.client({
19
19
  wsdl: cached_wsdl || wsdl,
20
+ endpoint: endpoint,
20
21
  read_timeout: read_timeout,
21
22
  open_timeout: open_timeout,
22
23
  namespaces: namespaces,
@@ -94,6 +95,18 @@ module NetSuite
94
95
  attributes[:api_version] = version
95
96
  end
96
97
 
98
+ def endpoint=(endpoint)
99
+ attributes[:endpoint] = endpoint
100
+ end
101
+
102
+ def endpoint(endpoint=nil)
103
+ if endpoint
104
+ self.endpoint = endpoint
105
+ else
106
+ attributes[:endpoint]
107
+ end
108
+ end
109
+
97
110
  def sandbox=(flag)
98
111
  if attributes[:sandbox] != flag
99
112
  attributes[:wsdl] = nil
@@ -8,12 +8,12 @@ module NetSuite
8
8
 
9
9
  actions :get, :get_list, :add, :delete, :upsert, :search
10
10
 
11
- fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date
11
+ fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date, :closed
12
12
 
13
13
  record_refs :parent
14
14
 
15
15
  attr_reader :internal_id
16
- attr_accessor :external_id
16
+ attr_accessor :external_id, :search_joins
17
17
 
18
18
  def initialize(attributes = {})
19
19
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -12,7 +12,7 @@ module NetSuite
12
12
  :search
13
13
 
14
14
  fields :bin_numbers, :built, :created_date, :expiration_date,
15
- :last_modified_date, :memo, :quantity, :serial_numbers, :total,
15
+ :last_modified_date, :memo, :quantity, :serial_numbers,
16
16
  :tran_date, :tran_id
17
17
 
18
18
  read_only_fields :total
@@ -36,5 +36,3 @@ module NetSuite
36
36
  end
37
37
  end
38
38
  end
39
-
40
-
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListRel
9
9
 
10
- actions :get, :get_list, :add, :delete, :delete_list, :search, :update, :upsert
10
+ actions :get, :get_deleted, :get_list, :add, :delete, :delete_list, :search, :update, :upsert, :upsert_list
11
11
 
12
12
  fields :salutation, :first_name, :middle_name, :last_name, :title, :phone, :fax, :email, :default_address,
13
13
  :entity_id, :phonetic_name, :alt_email, :office_phone, :home_phone, :mobile_phone, :supervisor_phone,
@@ -0,0 +1,28 @@
1
+ module NetSuite
2
+ module Records
3
+ class CostCategory
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::ListAcct
9
+
10
+ actions :add, :delete, :delete_list, :get, :get_all, :get_list, :get_select_value, :search, :update, :update_list, :upsert, :upsert_list
11
+ # TODO: Add add_list when supported by gem
12
+
13
+ fields :is_inactive, :item_cost_type, :name
14
+
15
+ record_refs :account
16
+
17
+ attr_reader :internal_id
18
+ attr_accessor :external_id
19
+
20
+ def initialize(attributes = {})
21
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
22
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
23
+ initialize_from_attributes_hash(attributes)
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -17,7 +17,7 @@ module NetSuite
17
17
  :sales_effective_date, :shipping_cost, :shipping_tax1_rate, :shipping_tax2_rate, :source, :status,
18
18
  :sync_partner_teams, :sync_sales_teams, :tax2_total, :tax_rate, :to_be_emailed, :to_be_faxed,
19
19
  :to_be_printed, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :vat_reg_num,
20
- :vsoe_auto_calc
20
+ :vsoe_auto_calc, :tax_details_override, :tax_reg_override
21
21
 
22
22
  field :custom_field_list, CustomFieldList
23
23
  field :item_list, CreditMemoItemList
@@ -12,7 +12,7 @@ module NetSuite
12
12
 
13
13
  actions :get, :get_list, :search
14
14
 
15
- fields :base_currency, :effective_date, :exchange_rate, :transaction_currency
15
+ fields :effective_date, :exchange_rate
16
16
 
17
17
  record_refs :base_currency, :transaction_currency
18
18
 
@@ -110,10 +110,16 @@ module NetSuite
110
110
  attrs = custom_field_data.clone
111
111
  type = (custom_field_data[:"@xsi:type"] || custom_field_data[:type])
112
112
 
113
- if type == "platformCore:SelectCustomFieldRef"
113
+ case type
114
+ when "platformCore:SelectCustomFieldRef", "platformCore:SearchColumnSelectCustomField"
114
115
  attrs[:value] = CustomRecordRef.new(custom_field_data[:value])
115
- elsif type == 'platformCore:MultiSelectCustomFieldRef'
116
- attrs[:value] = custom_field_data[:value].map do |entry|
116
+ when 'platformCore:MultiSelectCustomFieldRef', 'platformCore:SearchColumnMultiSelectCustomField'
117
+ # if there is only a single selection, `:value` will be hash not an array
118
+ attrs[:value] = if custom_field_data[:value].is_a?(Array)
119
+ custom_field_data[:value]
120
+ else
121
+ [custom_field_data[:value]]
122
+ end.map do |entry|
117
123
  CustomRecordRef.new(entry)
118
124
  end
119
125
  end
@@ -21,11 +21,11 @@ module NetSuite
21
21
  field :apply_list, CustomerDepositApplyList
22
22
  # accountingBookDetailList
23
23
 
24
- record_refs :customer, :sales_order, :account, :department, :payment_method,
25
- :custom_form, :currency, :posting_period, :subsidiary, :location,
26
-
27
- # only available in an advanced search result
28
- :deposit_transaction
24
+ record_refs :customer, :sales_order, :account, :department,
25
+ :payment_method, :payment_option, :custom_form, :currency,
26
+ :posting_period, :subsidiary, :location,
27
+ # only available in an advanced search result
28
+ :deposit_transaction
29
29
 
30
30
  attr_reader :internal_id
31
31
  attr_accessor :external_id
@@ -17,11 +17,14 @@ module NetSuite
17
17
 
18
18
  field :custom_field_list, CustomFieldList
19
19
  field :apply_list, CustomerPaymentApplyList
20
+ field :credit_list, CustomerPaymentCreditList
20
21
 
21
22
  read_only_fields :applied, :balance, :pending, :total, :unapplied
22
23
 
23
- record_refs :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass,
24
- :location, :payment_method, :posting_period, :subsidiary, :currency
24
+ record_refs :account, :ar_acct, :credit_card, :credit_card_processor,
25
+ :custom_form, :customer, :department, :klass, :location,
26
+ :payment_method, :payment_option, :posting_period, :subsidiary,
27
+ :currency
25
28
 
26
29
  attr_reader :internal_id
27
30
  attr_accessor :external_id
@@ -0,0 +1,17 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerPaymentCredit
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::TranCust
7
+
8
+ fields :amount, :applied_to, :apply, :credit_date, :currency, :doc, :due, :line,
9
+ :ref_num, :total, :type
10
+
11
+ def initialize(attributes = {})
12
+ initialize_from_attributes_hash(attributes)
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerPaymentCreditList < Support::Sublist
4
+ include Namespaces::TranCust
5
+
6
+ sublist :credit, CustomerPaymentCredit
7
+
8
+ alias :credits :credit
9
+
10
+ end
11
+ end
12
+ end
@@ -9,24 +9,105 @@ module NetSuite
9
9
 
10
10
  actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search
11
11
 
12
- fields :alt_handling_cost, :alt_sales_total, :alt_shipping_cost, :balance,
13
- :bill_address, :billing_address, :billing_schedule, :bill_is_residential,
14
- :created_date, :currency_name, :discount_rate, :email, :end_date,
15
- :est_gross_profit, :exchange_rate, :handling_cost, :handling_tax1_rate, :is_taxable,
16
- :last_modified_date, :memo, :message, :other_ref_num, :ship_date, :shipping_cost,
17
- :shipping_tax1_rate, :source, :start_date, :status, :sync_partner_teams, :sync_sales_teams,
18
- :to_be_emailed, :to_be_faxed, :to_be_printed, :total_cost_estimate, :tran_date, :tran_id,
19
- :linked_tracking_numbers, :is_multi_ship_to
12
+ fields :alt_handling_cost,
13
+ :alt_sales_total,
14
+ :alt_shipping_cost,
15
+ :can_have_stackable,
16
+ :contrib_pct,
17
+ :created_date,
18
+ :currency_name,
19
+ :discount_rate,
20
+ :discount_total,
21
+ :due_date,
22
+ :email,
23
+ :end_date,
24
+ :est_gross_profit,
25
+ :est_gross_profit_percent,
26
+ :exchange_rate,
27
+ :expected_close_date,
28
+ :fax,
29
+ :fob,
30
+ :handling_cost,
31
+ :handling_tax1_rate,
32
+ :handling_tax2_rate,
33
+ :include_in_forecast,
34
+ :is_taxable,
35
+ :last_modified_date,
36
+ :linked_tracking_numbers,
37
+ :memo,
38
+ :message,
39
+ :one_time,
40
+ :other_ref_num,
41
+ :probability,
42
+ :recur_annually,
43
+ :recur_monthly,
44
+ :recur_quarterly,
45
+ :recur_weekly,
46
+ :ship_date,
47
+ :ship_is_residential,
48
+ :shipping_cost,
49
+ :shipping_tax1_rate,
50
+ :shipping_tax2_rate,
51
+ :source,
52
+ :start_date,
53
+ :status,
54
+ :sub_total,
55
+ :sync_partner_teams,
56
+ :sync_sales_teams,
57
+ :tax2_total,
58
+ :tax_details_override,
59
+ :tax_point_date,
60
+ :tax_rate,
61
+ :tax_reg_override,
62
+ :tax_total,
63
+ :title,
64
+ :to_be_emailed,
65
+ :to_be_faxed,
66
+ :to_be_printed,
67
+ :total,
68
+ :total_cost_estimate,
69
+ :tracking_numbers,
70
+ :tran_date,
71
+ :tran_id,
72
+ :vat_reg_num,
73
+ :visible_to_customer
20
74
 
21
- field :shipping_address, Address
22
75
  field :billing_address, Address
23
-
24
- field :item_list, EstimateItemList
25
76
  field :custom_field_list, CustomFieldList
77
+ field :item_list, EstimateItemList
78
+ field :promotions_list, PromotionsList
79
+ field :shipping_address, Address
26
80
 
27
- record_refs :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item, :entity,
28
- :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner,
29
- :promo_code, :sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms
81
+ record_refs :bill_address_list,
82
+ :billing_schedule,
83
+ :klass,
84
+ :created_from,
85
+ :currency,
86
+ :custom_form,
87
+ :department,
88
+ :discount_item,
89
+ :entity,
90
+ :entity_status,
91
+ :entity_tax_reg_num,
92
+ :forecast_type,
93
+ :handling_tax_code,
94
+ :job,
95
+ :lead_source,
96
+ :location,
97
+ :message_sel,
98
+ :nexus,
99
+ :opportunity,
100
+ :partner,
101
+ :promo_code,
102
+ :sales_group,
103
+ :sales_rep,
104
+ :ship_address_list,
105
+ :ship_method,
106
+ :shipping_tax_code,
107
+ :subsidiary,
108
+ :subsidiary_tax_reg_num,
109
+ :tax_item,
110
+ :terms
30
111
 
31
112
  attr_reader :internal_id
32
113
  attr_accessor :external_id