Skip to content

Conversation

@wsbrunson
Copy link

@wsbrunson wsbrunson commented Jun 26, 2023

Two big changes

  • the existing advanced-integration moved to advanced-integration-legacy (Old hosted card fields)
  • The new CardFields example took over advanced-integration

In addition

  • two test pages for advanced integration, one for purchase and one for vault
  • added endpoints for the vault api in paypal-api.js

Copy link
Contributor

@jshawl jshawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I did not yet run this locally but can if you want - just lmk. I also left a few non-blocking comments for where I think some error handling can be removed. I think it would be helpful to include a readme in advanced-integration and also a deprecation notice in advance-integration-legacy <- just food for thought! Otherwise, :shipit: !


## Instructions

1. Rename `.env.example` to `.env` and update `CLIENT_ID` and `APP_SECRET`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is an .env.example in this directory (advanced-integration-legacy)

throw new Error(errorMessage);
}
const error = new Error (await response.text())
error.status = response.status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL 🆒

res.render("checkout", { clientId, clientToken });
res.render("index", { clientId });
} catch (err) {
handleError(res, err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will res.render ever throw?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its possible. I think that try/catch was there for paypa.generateClientToken but its possible there could be an issue rendering index.ejs or finding the file if the filesystem changes

});

app.get("/purchase", async (req, res) => {
const clientId = process.env.CLIENT_ID;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option to add this to const { PORT = 8888 } = process.env; above

@@ -1 +0,0 @@
package-lock=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to keep the .npmrc file and have it contain the following setting:

registry=https://registry.npmjs.org

That way we can always ensure any package-lock urls point to the public npm registry and not our private paypal registry.

I'm fine with adding lock files. Just want to make sure they always point to public npm.

@gregjopa
Copy link
Contributor

gregjopa commented Jun 27, 2023

This PR looks good! I do think we should keep it as a draft PR until the public docs are upgraded with the new card fields. Right now, the current advanced integration doc has a link to this "advanced integration" folder inside this repo and that will break if we merge this PR: https://developer.paypal.com/docs/checkout/advanced/integrate#link-generateclienttoken
Screen Shot 2023-06-27 at 9 48 29 AM

@wsbrunson
Copy link
Author

This PR looks good! I do think we should keep it as a draft PR until the public docs are upgraded with the new card fields. Right now, the current advanced integration doc has a link to this "advanced integration" folder inside this repo and that will break if we merge this PR: https://developer.paypal.com/docs/checkout/advanced/integrate#link-generateclienttoken

agreed! I've looped in Lance Han from the devrel team, they are going to give this a look and spin it up. I'll work with them to possibly take over the merging of this PR to coincide with their docs changes

@gregjopa
Copy link
Contributor

gregjopa commented Oct 3, 2023

I have a draft PR for adding the new card-fields component here in #84

@wsbrunson wsbrunson closed this Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants