Skip to content

Commit a16abcf

Browse files
flatsL-Burtnessshanag
authored
Status detail of after_submit_failed is not error (#550)
Addresses issue #444, where some successful requests return an empty error object. See https://system.netsuite.com/help/helpcenter/en_US/WSDiff/2018_2/FolderComparisonReport_files/FileComparisonReport24.html, line 914 for the change to the platformCore schema, https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4407992281.html for a description of afterSubmit scripts, and https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3536574.html#bridgehead_1515748728 for a discussion of error reporting for these scripts. Also added a line for File requests in the add action spec b/c the existing fixture already includes the `after_submit_failed` field. Co-authored-by: Lily Burtness <[email protected]> Co-authored-by: Shana Schundler <[email protected]> Co-authored-by: Lily Burtness <[email protected]> Co-authored-by: Shana Schundler <[email protected]>
1 parent 1ee5527 commit a16abcf

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

lib/netsuite/actions/add.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ def errors
7070
error_obj = response_hash[:status][:status_detail]
7171
error_obj = [error_obj] if error_obj.class == Hash
7272
error_obj.map do |error|
73+
next if error.keys == [:after_submit_failed]
7374
NetSuite::Error.new(error)
74-
end
75+
end.compact
7576
end
7677

7778
module Support

spec/netsuite/actions/add_spec.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@
5353
NetSuite::Actions::Add.call([invoice])
5454
end
5555

56-
it 'returns a valid Response object' do
56+
it 'returns a valid Response object with no errors' do
5757
response = NetSuite::Actions::Add.call([invoice])
5858
expect(response).to be_kind_of(NetSuite::Response)
5959
expect(response).to be_success
60+
expect(response.errors).to be_empty
6061
end
6162
end
6263

@@ -136,10 +137,11 @@
136137
NetSuite::Actions::Add.call([file])
137138
end
138139

139-
it 'returns a valid Response object' do
140+
it 'returns a valid Response object with no errors' do
140141
response = NetSuite::Actions::Add.call([file])
141142
expect(response).to be_kind_of(NetSuite::Response)
142143
expect(response).to be_success
144+
expect(response.errors).to be_empty
143145
end
144146

145147
it 'properly extracts internal ID from response' do

spec/support/fixtures/add/add_invoice.xml

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
33
<soapenv:Header>
4-
<platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2011_2.platform.webservices.netsuite.com">
4+
<platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2018_2.platform.webservices.netsuite.com">
55
<platformMsgs:nsId>WEBSERVICES_3392464_1220201115821392011296470399_67055c545d0</platformMsgs:nsId>
66
</platformMsgs:documentInfo>
77
</soapenv:Header>
88
<soapenv:Body>
9-
<addResponse xmlns="urn:messages_2_5.platform.webservices.netsuite.com">
10-
<writeResponse xmlns="urn:messages_2_5.platform.webservices.netsuite.com">
11-
<ns1:status isSuccess="true" xmlns:ns1="urn:core_2_5.platform.webservices.netsuite.com"/>
12-
<baseRef internalId="999" type="invoice" xsi:type="ns2:RecordRef" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:core_2_5.platform.webservices.netsuite.com"/>
9+
<addResponse xmlns="urn:messages_2018_2.platform.webservices.netsuite.com">
10+
<writeResponse>
11+
<platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com">
12+
<platformCore:statusDetail>
13+
<platformCore:afterSubmitFailed>false</platformCore:afterSubmitFailed>
14+
</platformCore:statusDetail>
15+
</platformCore:status>
16+
<baseRef internalId="999" type="invoice" xsi:type="platformCore:RecordRef" xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com"/>
1317
</writeResponse>
1418
</addResponse>
1519
</soapenv:Body>

0 commit comments

Comments
 (0)