Skip to content

Commit

Permalink
Merge pull request #93 from NipunaRanasinghe/u8-fix
Browse files Browse the repository at this point in the history
Fix compatibility issues with 2201.8.0
  • Loading branch information
NipunaRanasinghe authored Sep 24, 2023
2 parents 502eba4 + aaaa982 commit de71956
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-stg-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: 2201.3.1
version: 2201.8.0

# Build Ballerina Project
- name: Ballerina Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: 2201.3.1
version: 2201.8.0

# Build Ballerina Project
- name: Ballerina Build
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
distribution = "2201.3.1"
distribution = "2201.8.0"
org = "ballerinax"
name = "netsuite"
version = "3.1.0"
version = "3.3.0"
authors = ["Ballerina"]
repository = "https://github.com/ballerina-platform/module-ballerinax-netsuite"
keywords = ["Business Management/ERP", "Cost/Paid"]
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Invoice.bal
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ isolated function mapInvoiceRecord(xml response) returns Invoice|error {
recognizedRevenue: extractDecimalFromXML(response/**/<tranSales:recognizedRevenue>/*),
deferredRevenue: extractDecimalFromXML(response/**/<tranSales:deferredRevenue>/*),
subsidiary: extractRecordRefFromXML(response/**/<tranSales:subsidiary>),
classification:extractRecordRefFromXML(response/**/<tranSales:'class>),
classification: extractClassificationFromXML(response/**/<tranSales:'class>),
total:extractDecimalFromXML(response/**/<tranSales:total>/*),
department: extractRecordRefFromXML(response/**/<tranSales:department>),
createdDate: (response/**/<tranSales:createdDate>/*).toString(),
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This package provides the capability to access NetSuite and manipulate NetSuite
### Compatibility
| | Version |
|-------------------------------|---------------------------|
| Ballerina Language | Swan Lake 2201.3.1 |
| Ballerina Language | Swan Lake 2201.8.0 |
| SOAP API | SOAP 1.1 |
| WSDL | 2020.2.0 |

Expand Down
32 changes: 24 additions & 8 deletions ballerina/account.bal
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,39 @@ isolated function mapNewItemGroupRecordFields(NewItemGroup itemGroup) returns st
return finalResult;
}

isolated function getTranslationOrHierarchyVRecordsInXML(Translation translation) returns string {
isolated function getTranslationOrHierarchyVRecordsInXML(Translation|ItemGroupHierarchyVersions translationOrVersions) returns string {
string finalResult = EMPTY_STRING;
map<anydata>|error translationMap = translation.cloneWithType(MapAnyData);
if translationMap is map<anydata> {
string[] keys = translationMap.keys();
int position = 0;
foreach var item in translation {
map<anydata>|error translationMap = translationOrVersions.cloneWithType(MapAnyData);
if translationMap is error {
return finalResult;
}

string[] keys = translationMap.keys();
int position = 0;
if translationOrVersions is ItemGroupHierarchyVersions {
foreach anydata item in translationOrVersions {
if item is string|boolean|decimal {
finalResult += setSimpleType(keys[position], item, LIST_ACCT);
} else if item is RecordInputRef {
finalResult += getXMLRecordInputRef(<RecordInputRef>item);
finalResult += getXMLRecordInputRef(item);
} else if item is RecordRef {
finalResult += getXMLRecordRef(<RecordRef>item);
finalResult += getXMLRecordRef(item);
}
position += 1;
}
} else if translationOrVersions is Translation {
foreach anydata item in translationOrVersions {
if item is string|boolean|decimal {
finalResult += setSimpleType(keys[position], item, LIST_ACCT);
} else if item is RecordInputRef {
finalResult += getXMLRecordInputRef(item);
} else if item is RecordRef {
finalResult += getXMLRecordRef(item);
}
position += 1;
}
}

return finalResult;
}

Expand Down
8 changes: 8 additions & 0 deletions ballerina/commonUtils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ isolated function extractRecordRefFromXML(xml element) returns RecordRef {
};
}

isolated function extractClassificationFromXML(xml element) returns Classification {
return {
internalId: let var internalId = element.internalId in internalId is error ? EMPTY_STRING : (internalId.toString()),
name: extractStringFromXML(element/<name>/*),
"type": let var recordType = element.\'type in recordType is error ? EMPTY_STRING : (recordType.toString())
};
}

isolated function extractRecordInternalIdFromXMLAttribute(xml element) returns string {
return let var internalId = element.internalId in internalId is error ? EMPTY_STRING : internalId;
}
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ function testVendorBillGetOperation() {
recordType: "vendorBill"
};
VendorBill|error output = netsuiteClient->getVendorBillRecord(recordInfo);
if (output is Vendor) {
if output is VendorBill {
log:printInfo(output.toString());
} else {
test:assertFail(output.toString());
Expand Down
4 changes: 2 additions & 2 deletions ballerina/vendorBill.bal
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ isolated function wrapVendorBillElementsWithParentElement(string subElements, st
</urn:record>`;
}

isolated function getVendorBillResult(http:Response response) returns Vendor|error {
isolated function getVendorBillResult(http:Response response) returns VendorBill|error {
xml payload = check formatPayload(response);
if (response.statusCode == http:STATUS_OK) {
if response.statusCode == http:STATUS_OK {
xml output = payload/**/<status>;
boolean isSuccess = check extractBooleanValueFromXMLOrText(output.isSuccess);
if(isSuccess) {
Expand Down

0 comments on commit de71956

Please sign in to comment.