Skip to content

Commit

Permalink
Merge pull request #34 from Boulevard/CXP-1983-fix-delete-guest
Browse files Browse the repository at this point in the history
removing `guest` from `deleteGuest` mutation fields
  • Loading branch information
patsissons authored Feb 10, 2025
2 parents a2cc6f1 + 039e321 commit 449b8e8
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
</p>
</div>


<details>
<summary>Table of Contents</summary>
<ol>
Expand All @@ -29,7 +28,7 @@

## About the project

[Boulevard](https://joinblvd.com) is an intelligent scheduling solution and comprehensive point of sale system that increases revenue and lowers costs for salons, spas, and other appointment-based businesses.
[Boulevard](https://joinblvd.com) is an intelligent scheduling solution and comprehensive point of sale system that increases revenue and lowers costs for salons, spas, and other appointment-based businesses.

With this software development kit (SDK) you can create your own custom booking experiences for your business using Boulevard.

Expand Down Expand Up @@ -94,7 +93,7 @@ await cart.addCardPaymentMethod({
number: "4242424242424242",
cvv: "111",
exp_month: 1,
exp_year: 2025,
exp_year: 2028,
address_postal_code: "90210"
}
});
Expand All @@ -111,6 +110,7 @@ To see available API operations browse the methods tied to class definitions. [E
## Development

### Refresh Sched bindings

This will fetch the graphql schema from Sched and generate the typescript bindings and mocks.

```
Expand All @@ -123,7 +123,7 @@ yarn run gen

### Run tests

To be able to run tests you need `ts-node` installed globaly
To be able to run tests you need `ts-node` installed globaly

```
npm -g install ts-node
Expand Down Expand Up @@ -157,6 +157,7 @@ yarn run typedoc
Then Commit and push (inc tags).

## Contributing

Pull requests are welcome. See the [contribution guidelines](https://github.com/Boulevard/book-sdk/blob/master/CONTRIBUTING.md) for more information.

## Issues
Expand Down
3 changes: 2 additions & 1 deletion config.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import 'jest-ts-auto-mock';
import "jest-ts-auto-mock";
import "dotenv/config";
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@boulevard/blvd-book-sdk",
"version": "2.0.8",
"version": "2.0.9",
"description": "A JS client for the Boulevard API",
"main": "lib/blvd.js",
"typings": "lib/blvd.js",
Expand Down Expand Up @@ -39,6 +39,7 @@
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-typescript": "^8.3.0",
"@types/jest": "^26.0.22",
"dotenv": "^16.4.7",
"graphql-codegen-typescript-mock-data": "^2.0.0",
"jest": "^26.6.3",
"jest-ts-auto-mock": "^2.0.0",
Expand Down
19 changes: 18 additions & 1 deletion src/cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,24 @@ class Cart extends Node<Graph.Cart> {
body: JSON.stringify(details)
}
);
const { token } = await response.json();

const result = await response.json();

if (response.status !== 200) {
let reason: string

switch (result.type) {
case "validation":
reason = "validation error";
break;
default:
reason = "unknown error";
}

throw new Error(`Failed to tokenize card details: ${reason}`);
}

const { token } = result;
return token;
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/carts/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,6 @@ export const deleteGuestMutation = gql`
cart {
...CartProperties
}
guest {
...CartGuestProperties
}
}
}
`;
Expand Down
6 changes: 3 additions & 3 deletions tests/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe("carts", () => {
// number: "4242424242424242",
// cvv: "111",
// exp_month: 1,
// exp_year: 2025
// exp_year: 2028
// }
// });

Expand Down Expand Up @@ -211,7 +211,7 @@ describe("carts", () => {
number: "4242424242424242",
cvv: "111",
exp_month: 1,
exp_year: 2025,
exp_year: 2028,
address_postal_code: "90210"
}
});
Expand Down Expand Up @@ -253,7 +253,7 @@ function generateToken(): string {
const clientId = "f9d25e50-c5f0-4879-ae20-026303e23405";

const payload = `${prefix}${businessId}${clientId}${timestamp}`;
const key = Buffer.from(process.env.API_SECRET_KEY, "base64");
const key = Buffer.from(apiKey, "base64");
const signature = createHmac("sha256", key)
.update(payload)
.digest("base64");
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,11 @@ dot-case@^3.0.4:
no-case "^3.0.4"
tslib "^2.0.3"

dotenv@^16.4.7:
version "16.4.7"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.7.tgz#0e20c5b82950140aa99be360a8a5f52335f53c26"
integrity sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==

dotenv@^8.2.0:
version "8.6.0"
resolved "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz"
Expand Down

0 comments on commit 449b8e8

Please sign in to comment.