updated plugin Easy Digital Downloads version 3.1.1.2

This commit is contained in:
2023-03-17 22:34:04 +00:00
committed by Gitium
parent e8a66564bd
commit 19e086d1c4
647 changed files with 20986 additions and 27305 deletions

View File

@ -115,6 +115,7 @@ function listen_for_ipn() {
'post' => '/cgi-bin/webscr HTTP/1.1',
),
'user-agent' => 'Easy Digital Downloads/' . EDD_VERSION . '; ' . get_bloginfo( 'name' ),
);
// Get response.
@ -244,14 +245,29 @@ function listen_for_ipn() {
ipn_debug_log( 'subscription ' . $subscription->id . ': preparing to insert renewal payment' );
// when a user makes a recurring payment.
$payment_id = $subscription->add_payment(
array(
'amount' => $amount,
'transaction_id' => $transaction_id,
)
// Build the array for adding a subscription order.
$subscription_payment_args = array(
'amount' => $amount,
'transaction_id' => $transaction_id,
);
// Create a DateTime object of the payment_date, so we can adjust as needed.
$subscription_payment_date = new \DateTime( $posted['payment_date'] );
// To make sure we don't inadverntatly fail, make sure the date was parsed correctly before working with it.
if ( $subscription_payment_date instanceof \DateTime ) {
/**
* Convert to GMT, as that is what EDD 3.0 expects the times to be in.
*/
$subscription_payment_date->setTimezone( new \DateTimeZone( 'GMT' ) );
// Now add the date into the arguments for creating the renewal payment.
$subscription_payment_args['date'] = $subscription_payment_date->format( 'Y-m-d H:i:s' );
}
// when a user makes a recurring payment.
$payment_id = $subscription->add_payment( $subscription_payment_args );
if ( ! empty( $payment_id ) ) {
ipn_debug_log( 'subscription ' . $subscription->id . ': renewal payment was recorded successfully, preparing to renew subscription' );
$subscription->renew( $payment_id );