Skip to content

Commit

Permalink
Merge pull request #319 from ripe-tech/ns/209-fix_price
Browse files Browse the repository at this point in the history
#211 Fix `price` in `importOrderP()`
  • Loading branch information
joamag authored Oct 25, 2021
2 parents 3c95a92 + 0235888 commit e6c88ea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Support for the `Order` touch API endpoint
* Support for `scale` in import order
* Add test `should be able to set the price` in `#importOrder()` tests

### Changed

*

### Fixed

*
* Fix `price` not being corretly set in `importOrderP()`

## [2.7.1] - 2021-09-27

Expand Down
2 changes: 1 addition & 1 deletion src/js/api/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,7 @@ ripe.Ripe.prototype._importOrder = function(ffOrderId, options = {}) {
if (productId) contents.product_id = productId;
if (gender) contents.gender = gender;
if (scale) contents.scale = scale;
if (price) contents.price = price;
if (Object.keys(initialsExtra).length > 0) {
contents.initials_extra = initialsExtra;
} else if (initials && engraving) {
Expand All @@ -1328,7 +1329,6 @@ ripe.Ripe.prototype._importOrder = function(ffOrderId, options = {}) {
};
if (type) params.type = type;
if (country) params.country = country;
if (price) params.price = price;
if (currency) params.currency = currency;
if (meta) params.meta = meta;
if (notes) params.notes = notes;
Expand Down
26 changes: 26 additions & 0 deletions test/js/api/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,32 @@ describe("OrderAPI", function() {

await remote.deleteOrderP(result.number);
});

it("should be able to set the price", async () => {
let result = null;

const remote = ripe.RipeAPI();
const ffOrderId = uuid.v4();

result = await remote.authAdminP(config.TEST_USERNAME, config.TEST_PASSWORD);

assert.strictEqual(result.username, config.TEST_USERNAME);
assert.notStrictEqual(typeof result.sid, undefined);

result = await remote.importOrderP(ffOrderId, {
type: "buildless",
brand: "dummy",
model: "dummy",
price: 30
});
assert.strictEqual(result.ff_order_id, ffOrderId);
assert.strictEqual(result.type, "buildless");
assert.strictEqual(result.brand, "dummy");
assert.strictEqual(result.shoe, "dummy");
assert.strictEqual(result.price, 30);

await remote.deleteOrderP(result.number);
});
});

describe("#preCustomization()", function() {
Expand Down

0 comments on commit e6c88ea

Please sign in to comment.