Skip to content

Update type of cents_usd response fields #33

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

Merged
merged 3 commits into from
Jul 14, 2021
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
2 changes: 1 addition & 1 deletion .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require: '@babel/register'
recursive: true
recursive: true
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
35 changes: 14 additions & 21 deletions src/api/EstimatesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions src/api/OrdersApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
20 changes: 8 additions & 12 deletions src/api/PreferencesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 4 additions & 6 deletions src/api/ProjectsApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions src/model/CreateBitcoinEstimateRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/model/Order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
}

Expand Down
4 changes: 1 addition & 3 deletions test/integration/orders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down