Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Set sandbox mode if environment is sandbox #291

Merged
merged 1 commit into from
Sep 2, 2021
Merged

Set sandbox mode if environment is sandbox #291

merged 1 commit into from
Sep 2, 2021

Conversation

alexblackie
Copy link
Contributor

Currently if environment is passed in the options, it is set to a
prototype field and then promptly ignored and never used. This
configures the paypal client instance to use sandbox mode (through
loading with client-id=sb as per the docs) if the caller has
specified the environment to be "sandbox."

Currently if environment is passed in the options, it is set to a
prototype field and then promptly ignored and never used. This
configures the paypal client instance to use sandbox mode (through
loading with client-id=sb [as per the docs][1]) if the caller has
specified the environment to be "sandbox."

[1]: https://developer.paypal.com/docs/checkout/reference/customize-sdk/#client-id
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, just left a question.

@@ -41,6 +41,7 @@ SolidusPaypalBraintree.PaypalButton.prototype.initializeCallback = function() {
this._paymentMethodId = this._client.paymentMethodId;

this._client.getPaypalInstance().loadPayPalSDK({
"client-id": this._environment === "sandbox" ? "sb" : null,
Copy link
Member

Choose a reason for hiding this comment

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

What about configuring this at _paypalOptions level instead? I see that a lot of other configurations are done this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this._environment does come from the paypalOptions, it just was never being used here.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see. I missed the definition at line 18:

this._environment = this._paypalOptions.environment || 'sandbox';

@kennyadsl kennyadsl merged commit d8e83cc into solidusio:master Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants