-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #240 from barakj/barak/change-idempotency-gen-to-uuid
Change idempotency key generation to official UUID library
- Loading branch information
Showing
15 changed files
with
9,904 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ limitations under the License. | |
|
||
const { Client, Environment } = require("square"); | ||
const readline = require("readline"); | ||
const crypto = require("crypto"); | ||
const { v4: uuidv4 } = require("uuid"); | ||
const { program } = require("commander"); | ||
require('dotenv').config() | ||
|
||
|
@@ -43,7 +43,7 @@ async function addCustomers() { | |
try { | ||
// Create first customer with card on file | ||
const { result : { customer } } = await customersApi.createCustomer({ | ||
idempotencyKey: crypto.randomBytes(32).toString("hex"), | ||
idempotencyKey: uuidv4(), | ||
givenName: "Ryan", | ||
familyName: "Nakamura", | ||
emailAddress: "[email protected]" // it is a fake email | ||
|
@@ -55,7 +55,7 @@ async function addCustomers() { | |
|
||
// create second customer with no card on file | ||
await customersApi.createCustomer({ | ||
idempotencyKey: crypto.randomBytes(32).toString("hex"), | ||
idempotencyKey: uuidv4(), | ||
givenName: "Kaitlyn", | ||
familyName: "Spindel", | ||
emailAddress: "[email protected]" // it is a fake email | ||
|
Oops, something went wrong.