Skip to content

Commit

Permalink
Merge pull request #240 from barakj/barak/change-idempotency-gen-to-uuid
Browse files Browse the repository at this point in the history
Change idempotency key generation to official UUID library
  • Loading branch information
barakj authored May 11, 2021
2 parents c4c8daa + 8392644 commit fd43422
Show file tree
Hide file tree
Showing 15 changed files with 9,904 additions and 46 deletions.
6 changes: 3 additions & 3 deletions connect-examples/v2/node_invoices/bin/script/seed-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit fd43422

Please sign in to comment.