Skip to content

Commit 0a19f31

Browse files
authored
adds patch_fee_cents_usd field (#14)
* adds patch_fee field to orders * bump version to 1.3.0
1 parent b4e9c86 commit 0a19f31

File tree

7 files changed

+40
-4
lines changed

7 files changed

+40
-4
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010

1111
- [ ] Have you added an integration test for the changes?
1212
- [ ] Have you built the gem locally and made queries against it successfully?
13+
- [ ] Did you update the changelog?
14+
- [ ] Did you bump the package version?
15+
- [ ] For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production?

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.3] - 2020-09-28
11+
12+
### Added
13+
14+
- `patch_fee_cents_usd` field to `orders`
15+
1016
## [1.2.2] - 2020-09-18
1117

1218
### Added

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SHELL = /bin/bash
2+
3+
build:
4+
npx prettier --write . && \
5+
npm run build
6+
7+
test:
8+
npm run test
9+
10+
.PHONY: build test

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.2.2",
3+
"version": "1.2.3",
44
"description": "Javascript wrapper for the Patch API",
55
"license": "MIT",
66
"repository": {

src/model/Order.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Order {
1616
state,
1717
allocationState,
1818
priceCentsUsd,
19+
patchFeeCentsUsd,
1920
allocations,
2021
metadata
2122
) {
@@ -27,6 +28,7 @@ class Order {
2728
state,
2829
allocationState,
2930
priceCentsUsd,
31+
patchFeeCentsUsd,
3032
allocations,
3133
metadata
3234
);
@@ -40,6 +42,7 @@ class Order {
4042
state,
4143
allocationState,
4244
priceCentsUsd,
45+
patchFeeCentsUsd,
4346
allocations,
4447
metadata
4548
) {
@@ -49,6 +52,7 @@ class Order {
4952
obj['state'] = state;
5053
obj['allocation_state'] = allocationState;
5154
obj['price_cents_usd'] = priceCentsUsd;
55+
obj['patch_fee_cents_usd'] = patchFeeCentsUsd;
5256
obj['allocations'] = allocations;
5357
obj['metadata'] = metadata;
5458
}
@@ -90,6 +94,13 @@ class Order {
9094
);
9195
}
9296

97+
if (data.hasOwnProperty('patch_fee_cents_usd')) {
98+
obj['patch_fee_cents_usd'] = ApiClient.convertToType(
99+
data['patch_fee_cents_usd'],
100+
'String'
101+
);
102+
}
103+
93104
if (data.hasOwnProperty('allocations')) {
94105
obj['allocations'] = ApiClient.convertToType(data['allocations'], [
95106
Allocation
@@ -116,6 +127,8 @@ Order.prototype['allocation_state'] = undefined;
116127

117128
Order.prototype['price_cents_usd'] = undefined;
118129

130+
Order.prototype['patch_fee_cents_usd'] = undefined;
131+
119132
Order.prototype['allocations'] = undefined;
120133

121134
Order.prototype['metadata'] = undefined;

src/model/Photo.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import ApiClient from '../ApiClient';
99

1010
class Photo {
11-
constructor() {
12-
Photo.initialize(this);
11+
constructor(url) {
12+
Photo.initialize(this, url);
1313
}
1414

15-
static initialize(obj) {}
15+
static initialize(obj, url) {
16+
obj['url'] = url;
17+
}
1618

1719
static constructFromObject(data, obj) {
1820
if (data) {

test/integration/orders.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ describe('Orders Integration', function () {
2525

2626
const placeOrderResponse = await patch.orders.placeOrder(orderId);
2727
expect(placeOrderResponse.data.state).to.equal('placed');
28+
expect(placeOrderResponse.data.price_cents_usd).to.equal('1.0');
29+
expect(placeOrderResponse.data.patch_fee_cents_usd).to.equal('0.0');
2830
});
2931

3032
it('supports cancelling orders in a `draft` state', async function () {

0 commit comments

Comments
 (0)