Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version: 3.3.2 #530

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

*

## [3.3.2] - 2023-12-14

### Added

* Shipment API `refreshShippingShipment` and `createReturnWaybillShipment`

## [3.3.1] - 2023-10-30

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ripe-sdk",
"version": "3.3.1",
"version": "3.3.2",
"description": "The public SDK for RIPE Core",
"keywords": [
"js",
Expand Down
76 changes: 74 additions & 2 deletions src/js/api/shipment.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ ripe.Ripe.prototype.createWaybillShipment = function(number, options, callback)
*
* @param {Number} number The number of the shipment to create the waybill for.
* @param {Object} options An object of options to configure the request.
* @returns {Promise} The contents of the note instance that was created.
* @returns {Promise} The contents of the waybill instance that was created.
*/
ripe.Ripe.prototype.createWaybillShipmentP = function(number, options) {
return new Promise((resolve, reject) => {
Expand All @@ -810,6 +810,42 @@ ripe.Ripe.prototype.createWaybillShipmentP = function(number, options) {
});
};

/**
* Creates a return shipping waybill for the shipment with the provided number.
*
* @param {Number} number The number of the shipment to create the return waybill for.
* @param {Object} options An object of options to configure the request.
* @param {Function} callback Function with the result of the request.
* @returns {XMLHttpRequest} The XMLHttpRequest instance of the API request.
*/
ripe.Ripe.prototype.createReturnWaybillShipment = function(number, options, callback) {
callback = typeof options === "function" ? options : callback;
options = typeof options === "function" || options === undefined ? {} : options;
const url = `${this.url}shipments/${number}/return_waybill`;
options = Object.assign(options, {
url: url,
method: "POST",
auth: true
});
options = this._build(options);
return this._cacheURL(options.url, options, callback);
};

/**
* Creates a return shipping waybill for the shipment with the provided number.
*
* @param {Number} number The number of the shipment to create the return waybill for.
* @param {Object} options An object of options to configure the request.
* @returns {Promise} The contents of the waybill instance that was created.
*/
ripe.Ripe.prototype.createReturnWaybillShipmentP = function(number, options) {
return new Promise((resolve, reject) => {
this.createReturnWaybillShipment(number, options, (result, isValid, request) => {
isValid ? resolve(result) : reject(new ripe.RemoteError(request, null, result));
});
});
};

/**
* Creates an invoice for the shipment with the provided number.
*
Expand All @@ -836,7 +872,7 @@ ripe.Ripe.prototype.createInvoiceShipment = function(number, options, callback)
*
* @param {Number} number The number of the shipment to create the invoice for.
* @param {Object} options An object of options to configure the request.
* @returns {Promise} The contents of the note instance that was created.
* @returns {Promise} The contents of the invoice instance that was created.
*/
ripe.Ripe.prototype.createInvoiceShipmentP = function(number, options) {
return new Promise((resolve, reject) => {
Expand All @@ -846,6 +882,42 @@ ripe.Ripe.prototype.createInvoiceShipmentP = function(number, options) {
});
};

/**
* Manually trigger a shipment shipping status refresh.
*
* @param {Number} number The number of the shipment to refresh the shipping status.
* @param {Object} options An object of options to configure the request.
* @param {Function} callback Function with the result of the request.
* @returns {XMLHttpRequest} The XMLHttpRequest instance of the API request.
*/
ripe.Ripe.prototype.refreshShippingShipment = function(number, options, callback) {
callback = typeof options === "function" ? options : callback;
options = typeof options === "function" || options === undefined ? {} : options;
const url = `${this.url}shipments/${number}/refresh_shipping`;
options = Object.assign(options, {
url: url,
method: "POST",
auth: true
});
options = this._build(options);
return this._cacheURL(options.url, options, callback);
};

/**
* Manually trigger a shipment shipping status refresh.
*
* @param {Number} number The number of the shipment to refresh the shipping status.
* @param {Object} options An object of options to configure the request.
* @returns {Promise} The contents of the requested status update.
*/
ripe.Ripe.prototype.refreshShippingShipmentP = function(number, options) {
return new Promise((resolve, reject) => {
this.refreshShippingShipment(number, options, (result, isValid, request) => {
isValid ? resolve(result) : reject(new ripe.RemoteError(request, null, result));
});
});
};

/**
* @ignore
*/
Expand Down
2 changes: 1 addition & 1 deletion src/js/base/ripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ripe = base.ripe;
* The version of the RIPE SDK currently in load, should
* be in sync with the package information.
*/
ripe.VERSION = "3.3.1";
ripe.VERSION = "3.3.2";

/**
* Object that contains global (static) information to be used by
Expand Down