Skip to content

Commit dba8d80

Browse files
authored
Add created_at on orders (#44)
1 parent 1d8d5bb commit dba8d80

File tree

7 files changed

+18
-6
lines changed

7 files changed

+18
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.12.0] - 2021-09-08
9+
10+
### Added
11+
12+
- Adds a `created_at` attribute in all order responses
13+
814
## [1.11.1] - 2021-09-07
915

1016
### Changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@patch-technology/patch",
3-
"version": "1.11.1",
3+
"version": "1.12.0",
44
"description": "Node.js wrapper for the Patch API",
55
"license": "MIT",
66
"repository": {

src/ApiClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ApiClient {
1616
};
1717

1818
this.defaultHeaders = {
19-
'User-Agent': 'patch-node/1.11.1'
19+
'User-Agent': 'patch-node/1.12.0'
2020
};
2121

2222
/**

src/model/CreateBitcoinEstimateRequest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CreateBitcoinEstimateRequest {
1919
obj = obj || new CreateBitcoinEstimateRequest();
2020

2121
if (data.hasOwnProperty('timestamp')) {
22-
obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'String');
22+
obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'Date');
2323
}
2424

2525
if (data.hasOwnProperty('transaction_value_btc_sats')) {

src/model/Order.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ class Order {
6565
obj['id'] = ApiClient.convertToType(data['id'], 'String');
6666
}
6767

68+
if (data.hasOwnProperty('created_at')) {
69+
obj['created_at'] = ApiClient.convertToType(data['created_at'], 'Date');
70+
}
71+
6872
if (data.hasOwnProperty('mass_g')) {
6973
obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number');
7074
}
@@ -124,6 +128,8 @@ class Order {
124128

125129
Order.prototype['id'] = undefined;
126130

131+
Order.prototype['created_at'] = undefined;
132+
127133
Order.prototype['mass_g'] = undefined;
128134

129135
Order.prototype['production'] = undefined;

test/integration/orders.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('Orders Integration', function () {
3434
expect(estimateResponse.data.order.state).to.equal('draft');
3535

3636
const placeOrderResponse = await patch.orders.placeOrder(orderId);
37-
expect(placeOrderResponse.data.state).to.equal('placed');
37+
expect(placeOrderResponse.data.created_at).to.be.an.instanceOf(Date);
3838
expect(placeOrderResponse.data.production).to.equal(false);
3939
expect(placeOrderResponse.data.mass_g).to.equal(100);
4040
});

0 commit comments

Comments
 (0)