wp-pronamic-pay icon indicating copy to clipboard operation
wp-pronamic-pay copied to clipboard

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

Open remcotolsma opened this issue 3 years ago • 4 comments

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 avatar Sep 01 '21 14:09 remcotolsma

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 avatar Sep 23 '21 08:09 remcotolsma

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/.

remcotolsma avatar Jan 12 '22 09:01 remcotolsma

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 avatar Jan 12 '22 09:01 rvdsteege

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/

rvdsteege avatar Feb 27 '23 15:02 rvdsteege