Skip to content

Commit

Permalink
adds patch_fee_cents_usd field (#14)
Browse files Browse the repository at this point in the history
* adds patch_fee field to orders
* bump version to 1.3.0
  • Loading branch information
thdaraujo authored Oct 5, 2020
1 parent b4e9c86 commit 0a19f31
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@

- [ ] Have you added an integration test for the changes?
- [ ] Have you built the gem locally and made queries against it successfully?
- [ ] Did you update the changelog?
- [ ] Did you bump the package version?
- [ ] For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production?
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.2.3] - 2020-09-28

### Added

- `patch_fee_cents_usd` field to `orders`

## [1.2.2] - 2020-09-18

### Added
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SHELL = /bin/bash

build:
npx prettier --write . && \
npm run build

test:
npm run test

.PHONY: build test
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.2.2",
"version": "1.2.3",
"description": "Javascript wrapper for the Patch API",
"license": "MIT",
"repository": {
Expand Down
13 changes: 13 additions & 0 deletions src/model/Order.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Order {
state,
allocationState,
priceCentsUsd,
patchFeeCentsUsd,
allocations,
metadata
) {
Expand All @@ -27,6 +28,7 @@ class Order {
state,
allocationState,
priceCentsUsd,
patchFeeCentsUsd,
allocations,
metadata
);
Expand All @@ -40,6 +42,7 @@ class Order {
state,
allocationState,
priceCentsUsd,
patchFeeCentsUsd,
allocations,
metadata
) {
Expand All @@ -49,6 +52,7 @@ class Order {
obj['state'] = state;
obj['allocation_state'] = allocationState;
obj['price_cents_usd'] = priceCentsUsd;
obj['patch_fee_cents_usd'] = patchFeeCentsUsd;
obj['allocations'] = allocations;
obj['metadata'] = metadata;
}
Expand Down Expand Up @@ -90,6 +94,13 @@ class Order {
);
}

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

if (data.hasOwnProperty('allocations')) {
obj['allocations'] = ApiClient.convertToType(data['allocations'], [
Allocation
Expand All @@ -116,6 +127,8 @@ Order.prototype['allocation_state'] = undefined;

Order.prototype['price_cents_usd'] = undefined;

Order.prototype['patch_fee_cents_usd'] = undefined;

Order.prototype['allocations'] = undefined;

Order.prototype['metadata'] = undefined;
Expand Down
8 changes: 5 additions & 3 deletions src/model/Photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import ApiClient from '../ApiClient';

class Photo {
constructor() {
Photo.initialize(this);
constructor(url) {
Photo.initialize(this, url);
}

static initialize(obj) {}
static initialize(obj, url) {
obj['url'] = url;
}

static constructFromObject(data, obj) {
if (data) {
Expand Down
2 changes: 2 additions & 0 deletions test/integration/orders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ describe('Orders Integration', function () {

const placeOrderResponse = await patch.orders.placeOrder(orderId);
expect(placeOrderResponse.data.state).to.equal('placed');
expect(placeOrderResponse.data.price_cents_usd).to.equal('1.0');
expect(placeOrderResponse.data.patch_fee_cents_usd).to.equal('0.0');
});

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

0 comments on commit 0a19f31

Please sign in to comment.