netsuite 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +14 -12
- data/lib/netsuite.rb +16 -2
- data/lib/netsuite/actions/delete_list.rb +104 -0
- data/lib/netsuite/actions/login.rb +26 -1
- data/lib/netsuite/actions/search.rb +7 -3
- data/lib/netsuite/actions/upsert.rb +0 -4
- data/lib/netsuite/configuration.rb +1 -0
- data/lib/netsuite/namespaces/tran_purch.rb +11 -0
- data/lib/netsuite/records/cash_refund.rb +2 -2
- data/lib/netsuite/records/cash_sale.rb +41 -1
- data/lib/netsuite/records/cash_sale_item.rb +40 -0
- data/lib/netsuite/records/cash_sale_item_list.rb +25 -0
- data/lib/netsuite/records/contact.rb +1 -1
- data/lib/netsuite/records/contact_list.rb +1 -4
- data/lib/netsuite/records/credit_memo.rb +1 -1
- data/lib/netsuite/records/credit_memo_apply_list.rb +1 -4
- data/lib/netsuite/records/credit_memo_item.rb +1 -0
- data/lib/netsuite/records/credit_memo_item_list.rb +1 -4
- data/lib/netsuite/records/custom_field_list.rb +3 -0
- data/lib/netsuite/records/customer.rb +8 -8
- data/lib/netsuite/records/customer_payment.rb +1 -1
- data/lib/netsuite/records/customer_payment_apply.rb +1 -1
- data/lib/netsuite/records/customer_payment_apply_list.rb +13 -9
- data/lib/netsuite/records/customer_refund.rb +1 -1
- data/lib/netsuite/records/customer_refund_apply_list.rb +7 -3
- data/lib/netsuite/records/customer_refund_deposit_list.rb +1 -1
- data/lib/netsuite/records/deposit.rb +3 -3
- data/lib/netsuite/records/deposit_payment_list.rb +5 -2
- data/lib/netsuite/records/employee.rb +12 -4
- data/lib/netsuite/records/inventory_assignment.rb +1 -1
- data/lib/netsuite/records/inventory_assignment_list.rb +3 -1
- data/lib/netsuite/records/inventory_detail.rb +3 -3
- data/lib/netsuite/records/inventory_item.rb +4 -0
- data/lib/netsuite/records/invoice.rb +8 -4
- data/lib/netsuite/records/invoice_item_list.rb +4 -21
- data/lib/netsuite/records/job.rb +1 -1
- data/lib/netsuite/records/kit_item.rb +1 -1
- data/lib/netsuite/records/partner.rb +4 -2
- data/lib/netsuite/records/payment_method.rb +1 -1
- data/lib/netsuite/records/promotion_code.rb +1 -1
- data/lib/netsuite/records/rev_rec_template.rb +1 -1
- data/lib/netsuite/records/sales_order.rb +1 -1
- data/lib/netsuite/records/sales_order_item_list.rb +0 -1
- data/lib/netsuite/records/service_sale_item.rb +2 -2
- data/lib/netsuite/records/vendor_bill.rb +45 -0
- data/lib/netsuite/records/vendor_bill_expense.rb +40 -0
- data/lib/netsuite/records/vendor_bill_expense_list.rb +32 -0
- data/lib/netsuite/records/vendor_bill_item.rb +45 -0
- data/lib/netsuite/records/vendor_bill_item_list.rb +32 -0
- data/lib/netsuite/records/vendor_payment.rb +43 -0
- data/lib/netsuite/records/vendor_payment_apply.rb +16 -0
- data/lib/netsuite/records/vendor_payment_apply_list.rb +32 -0
- data/lib/netsuite/support/actions.rb +2 -2
- data/lib/netsuite/support/sublist.rb +13 -0
- data/lib/netsuite/version.rb +1 -1
- data/netsuite.gemspec +1 -1
- data/spec/netsuite/actions/delete_list_spec.rb +86 -0
- data/spec/netsuite/actions/login_spec.rb +21 -0
- data/spec/netsuite/records/cash_refund_spec.rb +1 -1
- data/spec/netsuite/records/cash_sale_item_list_spec.rb +27 -0
- data/spec/netsuite/records/cash_sale_item_spec.rb +23 -0
- data/spec/netsuite/records/credit_memo_apply_list_spec.rb +7 -8
- data/spec/netsuite/records/credit_memo_item_list_spec.rb +6 -8
- data/spec/netsuite/records/customer_payment_apply_list_spec.rb +25 -0
- data/spec/netsuite/records/customer_refund_apply_list_spec.rb +6 -8
- data/spec/netsuite/records/customer_spec.rb +6 -6
- data/spec/netsuite/records/employee_spec.rb +152 -0
- data/spec/netsuite/records/inventory_assignment_list_spec.rb +59 -0
- data/spec/netsuite/records/inventory_assignment_spec.rb +21 -0
- data/spec/netsuite/records/inventory_detail_spec.rb +13 -0
- data/spec/netsuite/records/invoice_spec.rb +3 -3
- data/spec/netsuite/records/job_spec.rb +4 -0
- data/spec/netsuite/records/vendor_bill_expense_list_spec.rb +36 -0
- data/spec/netsuite/records/vendor_bill_expense_spec.rb +72 -0
- data/spec/netsuite/records/vendor_bill_item_list_spec.rb +36 -0
- data/spec/netsuite/records/vendor_bill_item_spec.rb +118 -0
- data/spec/netsuite/records/vendor_bill_spec.rb +187 -0
- data/spec/netsuite/records/vendor_payment_apply_list_spec.rb +25 -0
- data/spec/netsuite/records/vendor_payment_apply_spec.rb +15 -0
- data/spec/netsuite/records/vendor_payment_spec.rb +164 -0
- data/spec/netsuite/support/sublist_spec.rb +6 -0
- data/spec/support/fixtures/delete_list/delete_list_customers.xml +26 -0
- data/spec/support/fixtures/delete_list/delete_list_customers_with_errors.xml +31 -0
- data/spec/support/fixtures/login.xml +35 -0
- metadata +58 -12
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjYyYWE4ZTFiZjRkZjc2ZGM0MmEyY2YzZjA1NGVkYzM2NjMwNWZiZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGZiNTNiN2YwNmM3MmM3Yzc1Yzc4Mjg4ZGNkYmM1NDRkYjRjYzI2Mw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDE4NDFiN2UxODAzNzcxNTQzMDQ2MWU5NWZiZGIyY2VlY2I4NmY0MjhmNmI1
|
10
|
+
NmU4NWI0ZGEwZmU4MGYzZmY5YzUzOTk1NDhkMDM2OWQ5MjdmNTQ2MjNmYmQ1
|
11
|
+
YTY0MGE1YzQ4NmNkZjY0ZmZlMTM5MjZjZGRkOTBmMmVhODI4ZDc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmJkY2ZlYTMxYTZiMGQwMGNjYzlkYjYwNWY4MzMwNTA3MTY0Njk2MWUyZDA3
|
14
|
+
YTEyYmMyNmNmNWY4ZDkzNDdiZTM2MGY5NjkyNGJjY2ZhMzhhYjA3OWUwMzM3
|
15
|
+
NDk2Y2VkMTNjM2I0NWU2NjJiZmY0MWE2NjE0ZGY1ZDdiM2JkMzE=
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
* This gem will act as a wrapper around the NetSuite SuiteTalk WebServices API. Wow, that is a mouthful.
|
6
6
|
* The gem does not cover the entire API, only the subset that we have found useful to cover so far.
|
7
|
-
* Extending the wrapper is pretty simple. Check out the [contribution help doc](https://github.com/
|
8
|
-
* NetSuite development is overall a pretty poor experience. We have a list of [NetSuite Development Resources](https://github.com/
|
7
|
+
* Extending the wrapper is pretty simple. Check out the [contribution help doc](https://github.com/NetSweet/netsuite/wiki/Contributing-to-the-Supported-NetSuite-API)
|
8
|
+
* NetSuite development is overall a pretty poor experience. We have a list of [NetSuite Development Resources](https://github.com/NetSweet/netsuite/wiki/NetSuite-Development-Resources) that might make things a bit less painful.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -21,13 +21,13 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
$ gem install netsuite
|
23
23
|
|
24
|
-
This gem is built for ruby 1.9.x, checkout the [1-8-stable](https://github.com/
|
24
|
+
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.
|
25
25
|
|
26
26
|
## Testing
|
27
27
|
Before contributing a patch make sure all existing tests pass.
|
28
28
|
|
29
29
|
```
|
30
|
-
git clone git://github.com/
|
30
|
+
git clone git://github.com/NetSweet/netsuite.git
|
31
31
|
cd netsuite
|
32
32
|
bundle
|
33
33
|
bundle exec rspec
|
@@ -41,23 +41,23 @@ Not sure how to find your account id? Search for "web service preferences" in th
|
|
41
41
|
```ruby
|
42
42
|
NetSuite.configure do
|
43
43
|
reset!
|
44
|
-
|
44
|
+
|
45
45
|
# optional, defaults to 2011_2
|
46
46
|
api_version '2012_1'
|
47
|
-
|
47
|
+
|
48
48
|
# optionally specify full wsdl URL (to switch to sandbox, for example)
|
49
49
|
wsdl "https://webservices.sandbox.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl"
|
50
|
-
|
50
|
+
|
51
51
|
# or specify the sandbox flag if you don't want to deal with specifying a full URL
|
52
52
|
sandbox true
|
53
|
-
|
53
|
+
|
54
54
|
# often the netsuite servers will hang which would cause a timeout exception to be raised
|
55
55
|
# if you don't mind waiting (e.g. processing NS via DJ), increasing the timeout should fix the issue
|
56
56
|
read_timeout 100000
|
57
|
-
|
57
|
+
|
58
58
|
# you can specify a file or file descriptor to send the log output to (defaults to STDOUT)
|
59
59
|
log File.join(Rails.root, 'log/netsuite.log')
|
60
|
-
|
60
|
+
|
61
61
|
# login information
|
62
62
|
email 'email@domain.com'
|
63
63
|
password 'password'
|
@@ -66,6 +66,8 @@ NetSuite.configure do
|
|
66
66
|
end
|
67
67
|
```
|
68
68
|
|
69
|
+
There is a [convenience method](https://github.com/NetSweet/netsuite/blob/56fe7fae92908a2e3d6812ecc56516f773cacd45/lib/netsuite.rb#L180) to configure NetSuite based on ENV variables.
|
70
|
+
|
69
71
|
### Examples
|
70
72
|
|
71
73
|
#### CRUD Operations
|
@@ -235,7 +237,7 @@ NetSuite::Records::Transaction.search({
|
|
235
237
|
Time.parse("30/07/2013").iso8601,
|
236
238
|
|
237
239
|
# or you can use a string. Note that the format below is different from the format of the above code
|
238
|
-
# but it matches exactly what NS returns
|
240
|
+
# but it matches exactly what NS returns
|
239
241
|
# "2012-01-01T22:00:00.000-07:00",
|
240
242
|
# "2013-07-30T22:00:00.000-07:00"
|
241
243
|
]
|
@@ -268,7 +270,7 @@ NetSuite::Records::Transaction.search({
|
|
268
270
|
}
|
269
271
|
]
|
270
272
|
},
|
271
|
-
|
273
|
+
|
272
274
|
# the column syntax is a WIP. This will change in the future
|
273
275
|
columns: {
|
274
276
|
'tranSales:basic' => [
|
data/lib/netsuite.rb
CHANGED
@@ -24,6 +24,7 @@ module NetSuite
|
|
24
24
|
autoload :TranGeneral, 'netsuite/namespaces/tran_general'
|
25
25
|
autoload :TranInvt, 'netsuite/namespaces/tran_invt'
|
26
26
|
autoload :TranSales, 'netsuite/namespaces/tran_sales'
|
27
|
+
autoload :TranPurch, 'netsuite/namespaces/tran_purch'
|
27
28
|
autoload :SetupCustom, 'netsuite/namespaces/setup_custom'
|
28
29
|
autoload :ListEmp, 'netsuite/namespaces/list_emp'
|
29
30
|
autoload :ListMkt, 'netsuite/namespaces/list_mkt'
|
@@ -45,6 +46,7 @@ module NetSuite
|
|
45
46
|
module Actions
|
46
47
|
autoload :Add, 'netsuite/actions/add'
|
47
48
|
autoload :Delete, 'netsuite/actions/delete'
|
49
|
+
autoload :DeleteList, 'netsuite/actions/delete_list'
|
48
50
|
autoload :Get, 'netsuite/actions/get'
|
49
51
|
autoload :GetAll, 'netsuite/actions/get_all'
|
50
52
|
autoload :GetList, 'netsuite/actions/get_list'
|
@@ -70,6 +72,8 @@ module NetSuite
|
|
70
72
|
autoload :BillingScheduleRecurrenceList, 'netsuite/records/billing_schedule_recurrence_list'
|
71
73
|
autoload :BinNumberList, 'netsuite/records/bin_number_list'
|
72
74
|
autoload :CashSale, 'netsuite/records/cash_sale'
|
75
|
+
autoload :CashSaleItem, 'netsuite/records/cash_sale_item'
|
76
|
+
autoload :CashSaleItemList, 'netsuite/records/cash_sale_item_list'
|
73
77
|
autoload :CashRefund, 'netsuite/records/cash_refund'
|
74
78
|
autoload :CashRefundItem, 'netsuite/records/cash_refund_item'
|
75
79
|
autoload :CashRefundItemList, 'netsuite/records/cash_refund_item_list'
|
@@ -168,6 +172,14 @@ module NetSuite
|
|
168
172
|
autoload :UnitsTypeUomList, 'netsuite/records/units_type_uom_list'
|
169
173
|
autoload :UnitsTypeUom, 'netsuite/records/units_type_uom'
|
170
174
|
autoload :Vendor, 'netsuite/records/vendor'
|
175
|
+
autoload :VendorBill, 'netsuite/records/vendor_bill'
|
176
|
+
autoload :VendorBillExpense, 'netsuite/records/vendor_bill_expense'
|
177
|
+
autoload :VendorBillExpenseList, 'netsuite/records/vendor_bill_expense_list'
|
178
|
+
autoload :VendorBillItem, 'netsuite/records/vendor_bill_item'
|
179
|
+
autoload :VendorBillItemList, 'netsuite/records/vendor_bill_item_list'
|
180
|
+
autoload :VendorPayment, 'netsuite/records/vendor_payment'
|
181
|
+
autoload :VendorPaymentApply, 'netsuite/records/vendor_payment_apply'
|
182
|
+
autoload :VendorPaymentApplyList, 'netsuite/records/vendor_payment_apply_list'
|
171
183
|
autoload :WorkOrder, 'netsuite/records/work_order'
|
172
184
|
autoload :WorkOrderItem, 'netsuite/records/work_order_item'
|
173
185
|
autoload :WorkOrderItemList, 'netsuite/records/work_order_item_list'
|
@@ -177,7 +189,7 @@ module NetSuite
|
|
177
189
|
NetSuite::Configuration.instance_eval(&block)
|
178
190
|
end
|
179
191
|
|
180
|
-
def self.configure_from_env
|
192
|
+
def self.configure_from_env(&block)
|
181
193
|
NetSuite.configure do
|
182
194
|
reset!
|
183
195
|
|
@@ -188,10 +200,12 @@ module NetSuite
|
|
188
200
|
api_version ENV['NETSUITE_API'] unless ENV['NETSUITE_API'].nil?
|
189
201
|
sandbox (ENV['NETSUITE_PRODUCTION'].nil? || ENV['NETSUITE_PRODUCTION'] != 'true')
|
190
202
|
wsdl ENV['NETSUITE_WSDL'] unless ENV['NETSUITE_WSDL'].nil?
|
191
|
-
silent (ENV['NETSUITE_SILENT']
|
203
|
+
silent (!ENV['NETSUITE_SILENT'].nil? && ENV['NETSUITE_SILENT'] == 'true')
|
192
204
|
|
193
205
|
read_timeout 100_000
|
194
206
|
end
|
207
|
+
|
208
|
+
self.configure(&block) if block
|
195
209
|
end
|
196
210
|
|
197
211
|
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Actions
|
3
|
+
class DeleteList
|
4
|
+
include Support::Requests
|
5
|
+
|
6
|
+
def initialize(klass, options = { })
|
7
|
+
@klass = klass
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def request(credentials={})
|
14
|
+
NetSuite::Configuration.connection(
|
15
|
+
{namespaces: {
|
16
|
+
'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com",
|
17
|
+
'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
|
18
|
+
}}, credentials
|
19
|
+
).call :delete_list, message: request_body
|
20
|
+
end
|
21
|
+
|
22
|
+
# <soap:Body>
|
23
|
+
# <platformMsgs:deleteList>
|
24
|
+
# <platformMsgs:baseRef internalId="1" type="customer" xsi:type="platformCore:RecordRef"/>
|
25
|
+
# <platformMsgs:baseRef internalId="2" type="customer" xsi:type="platformCore:RecordRef"/>
|
26
|
+
# </platformMsgs:deleteList>
|
27
|
+
# </soap:Body>
|
28
|
+
def request_body
|
29
|
+
list = @options.is_a?(Hash) ? @options[:list] : @options
|
30
|
+
|
31
|
+
formatted_list = if @options[:type_id]
|
32
|
+
type_id = @options[:type_id]
|
33
|
+
record_type = 'platformCore:CustomRecordRef'
|
34
|
+
|
35
|
+
list.map do |internal_id|
|
36
|
+
{
|
37
|
+
'@internalId' => internal_id,
|
38
|
+
'@typeId' => type_id,
|
39
|
+
'@xsi:type' => record_type
|
40
|
+
}
|
41
|
+
end
|
42
|
+
else
|
43
|
+
type = @klass.to_s.split('::').last.lower_camelcase
|
44
|
+
record_type = 'platformCore:RecordRef'
|
45
|
+
|
46
|
+
list.map do |internal_id|
|
47
|
+
{
|
48
|
+
'@internalId' => internal_id,
|
49
|
+
'@type' => type,
|
50
|
+
'@xsi:type' => record_type
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
{
|
56
|
+
baseRef: formatted_list
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def response_list
|
61
|
+
@response_list ||= @response.to_hash[:delete_list_response][:write_response_list][:write_response]
|
62
|
+
end
|
63
|
+
|
64
|
+
def success?
|
65
|
+
@success ||= response_errors.blank?
|
66
|
+
end
|
67
|
+
|
68
|
+
def response_errors
|
69
|
+
if response_list.any? { |r| r[:status][:@is_success] == 'false' }
|
70
|
+
@response_errors ||= errors
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def errors
|
75
|
+
errors = response_list.select { |r| r[:status] && r[:status][:status_detail] }.map do |obj|
|
76
|
+
error_obj = obj[:status][:status_detail]
|
77
|
+
error_obj = [error_obj] if error_obj.class == Hash
|
78
|
+
errors = error_obj.map do |error|
|
79
|
+
NetSuite::Error.new(error)
|
80
|
+
end
|
81
|
+
|
82
|
+
[obj[:base_ref][:@internal_id], errors]
|
83
|
+
end
|
84
|
+
Hash[errors]
|
85
|
+
end
|
86
|
+
|
87
|
+
def response_body
|
88
|
+
@response_body ||= response_list
|
89
|
+
end
|
90
|
+
|
91
|
+
module Support
|
92
|
+
def self.included(base)
|
93
|
+
base.extend(ClassMethods)
|
94
|
+
end
|
95
|
+
|
96
|
+
module ClassMethods
|
97
|
+
def delete_list(options = { }, credentials={})
|
98
|
+
response = NetSuite::Actions::DeleteList.call([self, options], credentials)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -1,13 +1,37 @@
|
|
1
1
|
# https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/login.html
|
2
|
+
|
2
3
|
module NetSuite
|
3
4
|
module Actions
|
4
5
|
class Login
|
5
6
|
|
7
|
+
# <userId xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com" internalId="460362">
|
8
|
+
# <platformCore:name>REDACTED ORG NAME</platformCore:name>
|
9
|
+
# </userId>
|
10
|
+
# <platformCore:wsRoleList xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com">
|
11
|
+
# <platformCore:wsRole>
|
12
|
+
# <platformCore:role internalId="1047">
|
13
|
+
# <platformCore:name>REDACTED ROLE</platformCore:name>
|
14
|
+
# </platformCore:role>
|
15
|
+
# <platformCore:isDefault>false</platformCore:isDefault>
|
16
|
+
# <platformCore:isInactive>false</platformCore:isInactive>
|
17
|
+
# <platformCore:isLoggedInRole>true</platformCore:isLoggedInRole>
|
18
|
+
# </platformCore:wsRole>
|
19
|
+
# <platformCore:wsRole>
|
20
|
+
# <platformCore:role internalId="1047">
|
21
|
+
# <platformCore:name>REDACTED ROLE</platformCore:name>
|
22
|
+
# </platformCore:role>
|
23
|
+
# <platformCore:isDefault>false</platformCore:isDefault>
|
24
|
+
# <platformCore:isInactive>false</platformCore:isInactive>
|
25
|
+
# <platformCore:isLoggedInRole>true</platformCore:isLoggedInRole>
|
26
|
+
# </platformCore:wsRole>
|
27
|
+
# </platformCore:wsRoleList>
|
28
|
+
|
6
29
|
def self.call(credentials)
|
7
30
|
passport = NetSuite::Configuration.auth_header.dup
|
8
31
|
passport['platformMsgs:passport']['platformCore:email'] = credentials[:email] || ''
|
9
32
|
passport['platformMsgs:passport']['platformCore:password'] = credentials[:password] || ''
|
10
33
|
passport['platformMsgs:passport']['platformCore:role'] = credentials[:role] || ''
|
34
|
+
passport['platformMsgs:passport']['platformCore:account'] = credentials[:account] if !credentials[:account].nil?
|
11
35
|
|
12
36
|
begin
|
13
37
|
response = NetSuite::Configuration.connection(soap_header: {}).call :login, message: passport
|
@@ -24,9 +48,10 @@ module NetSuite
|
|
24
48
|
)
|
25
49
|
end
|
26
50
|
|
51
|
+
# include more data in body; leave it up to the user to pull the data they are looking for
|
27
52
|
NetSuite::Response.new(
|
28
53
|
success: response.to_hash[:login_response][:session_response][:status][:@is_success] == 'true',
|
29
|
-
body: response.to_hash[:login_response][:session_response]
|
54
|
+
body: response.to_hash[:login_response][:session_response]
|
30
55
|
)
|
31
56
|
end
|
32
57
|
|
@@ -223,10 +223,14 @@ module NetSuite
|
|
223
223
|
@success ||= search_result[:status][:@is_success] == 'true'
|
224
224
|
end
|
225
225
|
|
226
|
-
|
227
|
-
|
228
|
-
|
226
|
+
# TODO need to figure out a way for the user to access this
|
227
|
+
def errors
|
228
|
+
error_obj = response_hash[:status][:status_detail]
|
229
|
+
error_obj = [error_obj] if error_obj.class == Hash
|
230
|
+
error_obj.map do |error|
|
231
|
+
NetSuite::Error.new(error)
|
229
232
|
end
|
233
|
+
end
|
230
234
|
|
231
235
|
module Support
|
232
236
|
def self.included(base)
|
@@ -33,10 +33,6 @@ module NetSuite
|
|
33
33
|
}
|
34
34
|
}
|
35
35
|
|
36
|
-
if @object.respond_to?(:internal_id) && @object.internal_id
|
37
|
-
hash['platformMsgs:record']['@platformMsgs:internalId'] = @object.internal_id
|
38
|
-
end
|
39
|
-
|
40
36
|
if @object.respond_to?(:external_id) && @object.external_id
|
41
37
|
hash['platformMsgs:record']['@platformMsgs:externalId'] = @object.external_id
|
42
38
|
end
|
@@ -96,6 +96,7 @@ module NetSuite
|
|
96
96
|
'xmlns:platformCommon' => "urn:common_#{api_version}.platform.webservices.netsuite.com",
|
97
97
|
'xmlns:listRel' => "urn:relationships_#{api_version}.lists.webservices.netsuite.com",
|
98
98
|
'xmlns:tranSales' => "urn:sales_#{api_version}.transactions.webservices.netsuite.com",
|
99
|
+
'xmlns:tranPurch' => "urn:purchases_#{api_version}.transactions.webservices.netsuite.com",
|
99
100
|
'xmlns:actSched' => "urn:scheduling_#{api_version}.activities.webservices.netsuite.com",
|
100
101
|
'xmlns:setupCustom' => "urn:customization_#{api_version}.setup.webservices.netsuite.com",
|
101
102
|
'xmlns:listAcct' => "urn:accounting_#{api_version}.lists.webservices.netsuite.com",
|
@@ -7,9 +7,9 @@ module NetSuite
|
|
7
7
|
include Support::Actions
|
8
8
|
include Namespaces::TranCust
|
9
9
|
|
10
|
-
actions :add, :get, :delete
|
10
|
+
actions :add, :get, :delete, :initialize, :upsert
|
11
11
|
|
12
|
-
fields :tran_date, :to_be_emailed
|
12
|
+
fields :tran_date, :to_be_emailed, :memo, :total
|
13
13
|
|
14
14
|
field :item_list, CashRefundItemList
|
15
15
|
field :custom_field_list, CustomFieldList
|
@@ -1,7 +1,47 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class CashSale
|
3
|
+
class CashSale
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::TranSales
|
4
9
|
|
10
|
+
actions :get, :add, :initialize, :delete, :update, :upsert, :search
|
11
|
+
|
12
|
+
fields :alt_handling_cost, :alt_shipping_cost, :auth_code, :bill_address, :cc_approved, :cc_expire_date, :cc_is_purchase_card_bin,
|
13
|
+
:cc_name, :cc_number, :cc_process_as_purchas_card, :cc_security_code, :cc_street, :cc_zip_code, :charge_it, :contrib_pct, :created_date,
|
14
|
+
:currency_name, :debit_card_issue_no, :deferred_revenue, :discount_rate, :discount_total, :email, :end_date, :est_gross_profit,
|
15
|
+
:est_gross_profit_percent, :exchange_rate, :exclude_commission, :exp_cost_disc_amount, :exp_cost_discount, :exp_cost_discprint,
|
16
|
+
:exp_cost_disc_rate, :exp_cost_disc_tax1_amt, :exp_cost_disc_taxable, :exp_cost_tax_rate1, :exp_cost_tax_rate2, :fax, :fob,
|
17
|
+
:gift_cert_applied, :handling_cost, :handling_tax1_rate, :handling_tax2_rate, :ignore_avs, :is_recurring_payment, :is_taxable,
|
18
|
+
:item_cost_disc_amount, :item_cost_disc_print, :item_cost_disc_rate, :item_cost_disc_tax1_amt, :item_cost_disc_taxable, :item_cost_tax_rate1,
|
19
|
+
:item_cost_tax_rate2, :last_modified_date, :linked_tracking_numbers, :memo, :message, :other_ref_num, :paypal_auth_id, :paypal_process,
|
20
|
+
:pay_pal_status, :pay_pay_tran_id, :pn_ref_num, :recognized_revenue, :rev_rec_end_date, :rev_rec_on_rev_commitment, :rev_rec_state_date,
|
21
|
+
:sales_effective_date, :ship_address, :ship_date, :shipping_cost, :shipping_tax1_rate, :shipping_tax2_rate, :source, :start_date, :status,
|
22
|
+
:sub_total, :sync_partners_teams, :sync_sales_teams, :tax2_total, :tax_rate, :tax_total, :three_d_status_code, :time_disc_amount, :time_disc_print,
|
23
|
+
:time_disc_rate, :time_disc_tax1_amt, :time_disc_taxable, :time_tax_rate1, :time_tax_rate2, :to_be_emailed, :to_be_faxed, :total,
|
24
|
+
:total_cost_estimate, :tracking_numbers, :tran_date, :tran_id, :tan_is_vsoe_bundle, :undep_funds, :valid_from, :vat_reg_num, :vsoe_auto_calc
|
25
|
+
|
26
|
+
|
27
|
+
field :transaction_ship_address, ShipAddress
|
28
|
+
field :transaction_bill_address, BillAddress
|
29
|
+
field :custom_field_list, CustomFieldList
|
30
|
+
field :item_list, CashSaleItemList
|
31
|
+
|
32
|
+
record_refs :account, :bill_address_list, :billing_schedule, :created_from, :credit_card, :credit_card_processor, :currency, :custom_form,
|
33
|
+
:department, :discount_item, :entity, :exp_cost_discount, :exp_cost_tax_code, :handling_tax_code, :item_cost_discount, :item_cost_tax_code,
|
34
|
+
:job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner, :payment_method, :posting_period, :promo_code, :rev_rec_schedule,
|
35
|
+
:sales_group, :sales_rep, :ship_address_list, :ship_method, :shipping_tax_code, :subsidiary, :tax_item, :time_discount, :time_tax_code
|
36
|
+
|
37
|
+
attr_reader :internal_id
|
38
|
+
attr_accessor :external_id
|
39
|
+
|
40
|
+
def initialize(attributes = {})
|
41
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
42
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
43
|
+
initialize_from_attributes_hash(attributes)
|
44
|
+
end
|
5
45
|
end
|
6
46
|
end
|
7
47
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CashSaleItem
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Namespaces::TranSales
|
8
|
+
|
9
|
+
fields :amount, :amount_ordered, :bin_numbers, :cost_estimate, :current_percent, :defer_rev_rec, :description, :exclude_from_rate_request,
|
10
|
+
:gift_cert_from, :gift_cert_message, :gift_cert_number, :gift_cert_recipient_email, :gift_cert_recipient_name, :gross_amt, :is_taxable,
|
11
|
+
:item_is_fulfilled, :license_code, :line, :order_line, :percent_complete, :quantity, :quantity_available, :quantity_fulfilled, :quantity_oh_hand,
|
12
|
+
:quantity_ordered, :quantity_remaining, :rate, :rev_rec_end_date, :rev_rec_start_date, :serial_numbers, :ship_group,
|
13
|
+
:tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_is_estimate, :vsoe_delivered, :vsoe_price
|
14
|
+
|
15
|
+
#field :charges_list, RecordRefList
|
16
|
+
#field :cost_estimate_type, ItemCostEstimateType
|
17
|
+
#field :vsoe_deferral, VsoeDeferral
|
18
|
+
#field :vsoe_permit_discount, VsoePermitDiscount
|
19
|
+
#field :vsoe_sop_group, VsoeSopGroup
|
20
|
+
field :custom_field_list, CustomFieldList
|
21
|
+
field :inventory_detail, InventoryDetail
|
22
|
+
field :options, CustomFieldList
|
23
|
+
|
24
|
+
record_refs :charge_type, :department, :item, :job, :klass, :location, :price, :rev_rec_schedule, :ship_address, :ship_method, :tax_code, :units
|
25
|
+
|
26
|
+
def initialize(attributes = {})
|
27
|
+
initialize_from_attributes_hash(attributes)
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_record
|
31
|
+
rec = super
|
32
|
+
if rec["#{record_namespace}:customFieldList"]
|
33
|
+
rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
|
34
|
+
end
|
35
|
+
rec
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|