From 36c9bb4b774ecd53025955875c8fd6e9fa03acc3 Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Thu, 15 Jul 2021 00:00:49 +0200 Subject: [PATCH] Update type of cents_usd response fields (#33) * Update type of cents_usd * Update test * Update changelog --- .mocharc.yml | 2 +- CHANGELOG.md | 6 ++++ package-lock.json | 2 +- package.json | 2 +- src/api/EstimatesApi.js | 35 +++++++++-------------- src/api/OrdersApi.js | 5 ++-- src/api/PreferencesApi.js | 20 ++++++------- src/api/ProjectsApi.js | 10 +++---- src/model/CreateBitcoinEstimateRequest.js | 5 ++-- src/model/Order.js | 4 +-- test/integration/orders.test.js | 4 +-- 11 files changed, 42 insertions(+), 53 deletions(-) diff --git a/.mocharc.yml b/.mocharc.yml index b62a52e..b9ac7d8 100644 --- a/.mocharc.yml +++ b/.mocharc.yml @@ -1,2 +1,2 @@ require: '@babel/register' -recursive: true \ No newline at end of file +recursive: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 98b80b4..b2fe5b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.7.0] - 2021-07-14 + +### Changed + +- [BREAKING] Changed `order.price_cents_usd` and `order.patch_fee_cents_usd` from string to integer. + ## [1.6.0] - 2021-07-14 ### Added diff --git a/package-lock.json b/package-lock.json index 44087ab..2e0db26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "1.6.0", + "version": "1.7.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 66aa457..03b53c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "1.6.0", + "version": "1.7.0", "description": "JavaScript wrapper for the Patch API", "license": "MIT", "repository": { diff --git a/src/api/EstimatesApi.js b/src/api/EstimatesApi.js index 1664543..c7173a7 100644 --- a/src/api/EstimatesApi.js +++ b/src/api/EstimatesApi.js @@ -19,33 +19,26 @@ export default class EstimatesApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; this.createBitcoinEstimate = this.createBitcoinEstimate.bind(this); - this.createBitcoinEstimateWithHttpInfo = this.createBitcoinEstimateWithHttpInfo.bind( - this - ); + this.createBitcoinEstimateWithHttpInfo = + this.createBitcoinEstimateWithHttpInfo.bind(this); this.createFlightEstimate = this.createFlightEstimate.bind(this); - this.createFlightEstimateWithHttpInfo = this.createFlightEstimateWithHttpInfo.bind( - this - ); + this.createFlightEstimateWithHttpInfo = + this.createFlightEstimateWithHttpInfo.bind(this); this.createMassEstimate = this.createMassEstimate.bind(this); - this.createMassEstimateWithHttpInfo = this.createMassEstimateWithHttpInfo.bind( - this - ); + this.createMassEstimateWithHttpInfo = + this.createMassEstimateWithHttpInfo.bind(this); this.createShippingEstimate = this.createShippingEstimate.bind(this); - this.createShippingEstimateWithHttpInfo = this.createShippingEstimateWithHttpInfo.bind( - this - ); + this.createShippingEstimateWithHttpInfo = + this.createShippingEstimateWithHttpInfo.bind(this); this.createVehicleEstimate = this.createVehicleEstimate.bind(this); - this.createVehicleEstimateWithHttpInfo = this.createVehicleEstimateWithHttpInfo.bind( - this - ); + this.createVehicleEstimateWithHttpInfo = + this.createVehicleEstimateWithHttpInfo.bind(this); this.retrieveEstimate = this.retrieveEstimate.bind(this); - this.retrieveEstimateWithHttpInfo = this.retrieveEstimateWithHttpInfo.bind( - this - ); + this.retrieveEstimateWithHttpInfo = + this.retrieveEstimateWithHttpInfo.bind(this); this.retrieveEstimates = this.retrieveEstimates.bind(this); - this.retrieveEstimatesWithHttpInfo = this.retrieveEstimatesWithHttpInfo.bind( - this - ); + this.retrieveEstimatesWithHttpInfo = + this.retrieveEstimatesWithHttpInfo.bind(this); } createBitcoinEstimateWithHttpInfo(createBitcoinEstimateRequest) { diff --git a/src/api/OrdersApi.js b/src/api/OrdersApi.js index 7b0fc6f..710e2c5 100644 --- a/src/api/OrdersApi.js +++ b/src/api/OrdersApi.js @@ -23,9 +23,8 @@ export default class OrdersApi { this.retrieveOrder = this.retrieveOrder.bind(this); this.retrieveOrderWithHttpInfo = this.retrieveOrderWithHttpInfo.bind(this); this.retrieveOrders = this.retrieveOrders.bind(this); - this.retrieveOrdersWithHttpInfo = this.retrieveOrdersWithHttpInfo.bind( - this - ); + this.retrieveOrdersWithHttpInfo = + this.retrieveOrdersWithHttpInfo.bind(this); } cancelOrderWithHttpInfo(id) { diff --git a/src/api/PreferencesApi.js b/src/api/PreferencesApi.js index 5d2bc82..ec20fda 100644 --- a/src/api/PreferencesApi.js +++ b/src/api/PreferencesApi.js @@ -15,21 +15,17 @@ export default class PreferencesApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; this.createPreference = this.createPreference.bind(this); - this.createPreferenceWithHttpInfo = this.createPreferenceWithHttpInfo.bind( - this - ); + this.createPreferenceWithHttpInfo = + this.createPreferenceWithHttpInfo.bind(this); this.deletePreference = this.deletePreference.bind(this); - this.deletePreferenceWithHttpInfo = this.deletePreferenceWithHttpInfo.bind( - this - ); + this.deletePreferenceWithHttpInfo = + this.deletePreferenceWithHttpInfo.bind(this); this.retrievePreference = this.retrievePreference.bind(this); - this.retrievePreferenceWithHttpInfo = this.retrievePreferenceWithHttpInfo.bind( - this - ); + this.retrievePreferenceWithHttpInfo = + this.retrievePreferenceWithHttpInfo.bind(this); this.retrievePreferences = this.retrievePreferences.bind(this); - this.retrievePreferencesWithHttpInfo = this.retrievePreferencesWithHttpInfo.bind( - this - ); + this.retrievePreferencesWithHttpInfo = + this.retrievePreferencesWithHttpInfo.bind(this); } createPreferenceWithHttpInfo(createPreferenceRequest) { diff --git a/src/api/ProjectsApi.js b/src/api/ProjectsApi.js index ff7d56b..c714d11 100644 --- a/src/api/ProjectsApi.js +++ b/src/api/ProjectsApi.js @@ -14,13 +14,11 @@ export default class ProjectsApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; this.retrieveProject = this.retrieveProject.bind(this); - this.retrieveProjectWithHttpInfo = this.retrieveProjectWithHttpInfo.bind( - this - ); + this.retrieveProjectWithHttpInfo = + this.retrieveProjectWithHttpInfo.bind(this); this.retrieveProjects = this.retrieveProjects.bind(this); - this.retrieveProjectsWithHttpInfo = this.retrieveProjectsWithHttpInfo.bind( - this - ); + this.retrieveProjectsWithHttpInfo = + this.retrieveProjectsWithHttpInfo.bind(this); } retrieveProjectWithHttpInfo(id) { diff --git a/src/model/CreateBitcoinEstimateRequest.js b/src/model/CreateBitcoinEstimateRequest.js index a469a32..010f22d 100644 --- a/src/model/CreateBitcoinEstimateRequest.js +++ b/src/model/CreateBitcoinEstimateRequest.js @@ -49,9 +49,8 @@ class CreateBitcoinEstimateRequest { CreateBitcoinEstimateRequest.prototype['timestamp'] = undefined; -CreateBitcoinEstimateRequest.prototype[ - 'transaction_value_btc_sats' -] = undefined; +CreateBitcoinEstimateRequest.prototype['transaction_value_btc_sats'] = + undefined; CreateBitcoinEstimateRequest.prototype['project_id'] = undefined; diff --git a/src/model/Order.js b/src/model/Order.js index 477d571..1531d4c 100644 --- a/src/model/Order.js +++ b/src/model/Order.js @@ -90,14 +90,14 @@ class Order { if (data.hasOwnProperty('price_cents_usd')) { obj['price_cents_usd'] = ApiClient.convertToType( data['price_cents_usd'], - 'String' + 'Number' ); } if (data.hasOwnProperty('patch_fee_cents_usd')) { obj['patch_fee_cents_usd'] = ApiClient.convertToType( data['patch_fee_cents_usd'], - 'String' + 'Number' ); } diff --git a/test/integration/orders.test.js b/test/integration/orders.test.js index 09a0fa4..9995668 100644 --- a/test/integration/orders.test.js +++ b/test/integration/orders.test.js @@ -23,9 +23,7 @@ describe('Orders Integration', function () { project_id: biomass_test_project_id }); - expect(parseFloat(data.price_cents_usd)).to.be.closeTo(91, 1); - expect(parseFloat(data.patch_fee_cents_usd)).to.be.closeTo(9, 1); - expect(parseFloat(data.mass_g)).to.be.closeTo(91000, 2000); + expect(data.price_cents_usd + data.patch_fee_cents_usd).to.eq(100); }); it('supports placing orders in a `draft` state', async function () {