Skip to content

Commit

Permalink
Add created_at on orders (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcothenet authored Sep 8, 2021
1 parent 1d8d5bb commit dba8d80
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
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.12.0] - 2021-09-08

### Added

- Adds a `created_at` attribute in all order responses

## [1.11.1] - 2021-09-07

### Changed
Expand Down
4 changes: 2 additions & 2 deletions 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.11.1",
"version": "1.12.0",
"description": "Node.js wrapper for the Patch API",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ApiClient {
};

this.defaultHeaders = {
'User-Agent': 'patch-node/1.11.1'
'User-Agent': 'patch-node/1.12.0'
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/model/CreateBitcoinEstimateRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CreateBitcoinEstimateRequest {
obj = obj || new CreateBitcoinEstimateRequest();

if (data.hasOwnProperty('timestamp')) {
obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'String');
obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'Date');
}

if (data.hasOwnProperty('transaction_value_btc_sats')) {
Expand Down
6 changes: 6 additions & 0 deletions src/model/Order.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class Order {
obj['id'] = ApiClient.convertToType(data['id'], 'String');
}

if (data.hasOwnProperty('created_at')) {
obj['created_at'] = ApiClient.convertToType(data['created_at'], 'Date');
}

if (data.hasOwnProperty('mass_g')) {
obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number');
}
Expand Down Expand Up @@ -124,6 +128,8 @@ class Order {

Order.prototype['id'] = undefined;

Order.prototype['created_at'] = undefined;

Order.prototype['mass_g'] = undefined;

Order.prototype['production'] = undefined;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/orders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Orders Integration', function () {
expect(estimateResponse.data.order.state).to.equal('draft');

const placeOrderResponse = await patch.orders.placeOrder(orderId);
expect(placeOrderResponse.data.state).to.equal('placed');
expect(placeOrderResponse.data.created_at).to.be.an.instanceOf(Date);
expect(placeOrderResponse.data.production).to.equal(false);
expect(placeOrderResponse.data.mass_g).to.equal(100);
});
Expand Down

0 comments on commit dba8d80

Please sign in to comment.