-
Notifications
You must be signed in to change notification settings - Fork 3
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 #20 from thecodeteam/enhancement-131-configurable-…
…catalog-price-currency Configurable catalog price currency + Jar release 2.0.0
- Loading branch information
Showing
4 changed files
with
85 additions
and
21 deletions.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
exports.migrate = function (input) { | ||
var current_version = getCurrentProductVersion(); | ||
|
||
// prints out all properties as json in the description field | ||
// input['properties']['.properties.catalog_services_0_long_description']['value'] = JSON.stringify(input['properties']); | ||
|
||
if (current_version.startsWith("1.")) { | ||
// cost currency field added since 2.0 | ||
console.log('upgrade needed for currency fields in plan definitions'); | ||
|
||
addCurrencyDefaults(input['properties']); | ||
} | ||
|
||
return input; | ||
}; | ||
|
||
function addCurrencyDefaults(props) { | ||
for (var plan_collection_index = 0; plan_collection_index < 5; plan_collection_index++) { | ||
var plan_coll = ".properties.catalog_plan_collection" + plan_collection_index; | ||
|
||
if (typeof props[plan_coll] !== "undefined" && props[plan_coll] !== null) { | ||
var plans = props[plan_coll]['value']; | ||
for (let plan of plans) { | ||
plan['cost_value'] = plan['cost_usd']; | ||
plan['cost_currency'] = {'value': 'USD', 'type': 'string'}; | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
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 |
---|---|---|
|
@@ -11,4 +11,4 @@ history: | |
- 1.2.2 | ||
- 1.2.3 | ||
- 1.2.4 | ||
version: 1.2.5-dev1 | ||
version: 2.0.0 |
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