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

Introduce public subscription view page for cancel, renew and mandate actions #201

Open
remcotolsma opened this issue Sep 1, 2021 · 4 comments

Comments

@remcotolsma
Copy link
Member

remcotolsma commented Sep 1, 2021

https://github.com/pronamic/wp-pay-core/blob/5ec06f5d31a3125d6912aecae6934c7f5e221009/src/Subscriptions/SubscriptionsModule.php#L105-L151

Something like: http://pay.local/?subscription=XXX&key=subscr_XXX&view=subscription or should we implement some rewrite rules?

http://pay.local/abonnement-inzien/{secret_40_chars_sha_1_hash}
http://pay.local/abonnement-inzien/9cf95dacd226dcf43da376cdb6cbba7035218921

Tools like Google Drive, Dropbox, Payt (https://factuurinzien.nl/) also use secrets in their public links.

<?php

echo $subscription->get_id();

foreach ( $subscription->get_phases() as $phase ) {
	echo $phase->get_id();

	foreach ( $phase->get_created_periods() as $period ) {
		echo $period->get_id();

		foreach ( $period->get_payments() as $payment ) {
			echo $payment->get_id();

		}
	}
}

The $phase->get_created_periods() and $period->get_payments() methods currently don't exist.


Cancel

pay local__subscription=804 key=subscr_612cce42198a4 action=cancel

Renew

pay local__subscription=804 key=subscr_612cce42198a4 action=renew

Mandate

pay local__subscription=804 key=subscr_612cce42198a4 action=mandate


Use wp_hash( $subscription->get_id() ) for an unique hash in a public URL, if users generate new salts (https://api.wordpress.org/secret-key/1.1/salt/) the old public links will also no longer work.

@remcotolsma
Copy link
Member Author

In internal HelpScout ticket https://secure.helpscout.net/conversation/1637278281/22756?folderId=1425710 we have a customer that doesn't see any payments attached to a subscription.

Vernieuwing zichtbaar

This could indicate an issue in the $periods = $subscription->get_payments_by_period(); method. This may be a reason to implement the following:

<?php

echo $subscription->get_id();

foreach ( $subscription->get_phases() as $phase ) {
	echo $phase->get_id();

	foreach ( $phase->get_created_periods() as $period ) {
		echo $period->get_id();

		foreach ( $period->get_payments() as $payment ) {
			echo $payment->get_id();

		}
	}
}

CC @rvdsteege

@remcotolsma
Copy link
Member Author

remcotolsma commented Jan 12, 2022

it is possible that the cancel, renew and mandate actions will no longer function properly after the 8.0 update. I think it would be good to test this again for 8.1 and possibly revise it. Also see internal HelpScout ticket: https://secure.helpscout.net/conversation/1692642890/22994/.

@rvdsteege
Copy link
Member

What issues are we running into with these actions? Users use these action URL's in their customer communication, so I'd expect they function properly in a plugin release.

@rvdsteege
Copy link
Member

Received an issue at support with the period dates moving forward on pending/incomplete renewals. This could be improved/resolved with better user subscription management functionality.

Internal Help Scout ticket: https://secure.helpscout.net/conversation/2165411530/25264/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants