Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor rjs to resolve button reload error and add types #866

Merged
merged 2 commits into from Jan 16, 2024

Conversation

jsanderson1130
Copy link
Contributor

No description provided.

@jsanderson1130 jsanderson1130 force-pushed the amazon_pay_refactor branch 3 times, most recently from 6cf9412 to 48f3edd Compare January 11, 2024 15:26
Comment on lines 7 to 17
region: string;

/**
* The customer's locale. This is used to set the language rendered in the UI.
*/
locale: string;

/**
* The currency of the payment.
*/
currency: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't all of these options be optional like you have set gatewayCode to be?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it looks like currency and locale are set based on the region. They should not be included as options.

Copy link
Contributor

Choose a reason for hiding this comment

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

It also looks like there's a sandbox option that gets used in renderButton. I think that should be included as well as an optional option.

gatewayCode?: string
};

export type AmazonPayEvent = 'token' | 'error' | 'close';
Copy link
Contributor

Choose a reason for hiding this comment

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

The AmazonPay class directly emits a ready event.

The Frame class will emit error, done, and close. So you'll need to include done in this too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I add closed instead of close as the Frame emits closed?

types/lib/amazon-pay.d.ts Show resolved Hide resolved
@jsanderson1130 jsanderson1130 force-pushed the amazon_pay_refactor branch 2 times, most recently from 7f9ca03 to 04a975c Compare January 11, 2024 21:15
*/
sandbox?: boolean;

merchantId?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

The merchant_id is fetched from the API before emitting the ready event. I don't think that it can be passed in as an option.

/**
* 2 Digit Country Code
*/
region: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

region should be optional as well.

/**
* Renders Amazon Pay button to the page
*/
renderButton: (element: string | HTMLElement, amazonPayRenderButtonOptions: AmazonPayOptions & AmazonPayRenderButtonOptions) => AmazonPayInstance;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not seeing all of these additional parameters on the renderButton function. It looks to me like it only accepts a element parameter that is a string

Copy link
Contributor

Choose a reason for hiding this comment

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

The renderButton does not return anything.

* Attaches an Element to the DOM, as a child of the specified parent target.
*
*/
attach: (defaultEventName: string, gatewayCode?: string) => AmazonPayInstance;
Copy link
Contributor

Choose a reason for hiding this comment

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

The attach function does not accept any parameters and does not return anything.

/**
* Invokes the Amazon Payment Modal
*/
start: (amazonPayOptions: AmazonPayOptions) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

The start function does not accept any parameters.

@douglasmiller douglasmiller merged commit 42930a1 into master Jan 16, 2024
49 of 50 checks passed
@douglasmiller douglasmiller deleted the amazon_pay_refactor branch January 16, 2024 19:13
recurly-integrations pushed a commit that referenced this pull request Jan 24, 2024
[Full Changelog](v4.26.3...v4.26.4)

**Merged Pull Requests**

- Update ApplePayPaymentAuthorizedEvent type to match actual object shape [#867](#867) ([shin-](https://github.com/shin-))
- refactor rjs to resolve button reload error and add types [#866](#866) ([jsanderson1130](https://github.com/jsanderson1130))
- Instantiates events only on demand [#865](#865) ([chrissrogers](https://github.com/chrissrogers))

##### Minified MD5 Checksum
```
7d8f7e262dd874c99ecdea703abf881a ./build/recurly.min.js
```
##### [SRI Hash](https://www.srihash.org/)
```
jq8kexKDtApgMeyCW5VrVbH7aOP1s40MsXVBrT/BBReWGolXCFMGSE6qzN9rFLda
```
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.

None yet

2 participants