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

Feature / Rename refresh purchase function #1350

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/components/Settings/Subscribe/Subscribe.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ const propTypes = {
*/
email: PropTypes.string.isRequired,
/**
* Handle update store
* Handle refresh subscription
*/
onUpdateStore: PropTypes.func
onRefreshSubscription: PropTypes.func
};

const defaultProps = {
Expand All @@ -77,7 +77,7 @@ const Subscribe = ({
onSubmitPeople,
products,
subscription,
onUpdateStore
onRefreshSubscription
}) => {
const renderIncludedFeatures = () => {
return INCLUDED_FEATURES.map(feature => {
Expand Down Expand Up @@ -193,7 +193,11 @@ const Subscribe = ({
productStatus === NOT_SUBSCRIBED || productStatus === ERROR ? (
''
) : (
<Button color="inherit" size="small" onClick={onUpdateStore}>
<Button
color="inherit"
size="small"
onClick={onRefreshSubscription}
>
<RefreshIcon />
</Button>
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/Subscribe/Subscribe.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ export class SubscribeContainer extends PureComponent {

handleSubmit = async () => {};

handleUpdateStore = () => {
handleRefreshSubscription = () => {
const { comprobeSubscription } = this.props;

window.CdvPurchase.store.update();
window.CdvPurchase.store.restorePurchases();
comprobeSubscription();
};

Expand Down Expand Up @@ -178,7 +178,7 @@ export class SubscribeContainer extends PureComponent {
products={this.state.products}
subscription={this.props.subscription}
updateSubscriberId={this.props.updateSubscriberId}
onUpdateStore={this.handleUpdateStore}
onRefreshSubscription={this.handleRefreshSubscription}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function comprobeSubscription(payload) {
: expiryDateFormat;

if (isExpired) {
window.CdvPurchase.store.update();
window.CdvPurchase.store.restorePurchases();

const isBillingRetryPeriodFinished = () => {
console.log(
Expand Down