Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

@@ -71,10 +71,11 @@ try
$transaction->billing_agreement = $billingAgreement;
$transaction->save();
/* Just save that we're waiting for the webhook */
/* Just save that we're waiting for the webhook, but also try again in a few minutes because PayPal is flakey */
$transaction->status = \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING;
$transaction->save();
$transaction->sendNotification();
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), "`key`='gatewayPending'" );
\IPS\Output::i()->redirect( $transaction->url() );
}
@@ -101,11 +102,49 @@ try
$billingAgreement->save();
$transaction->billing_agreement = $billingAgreement;
$transaction->save();
/* Get the initial setup transaction if possible */
$haveInitialTransaction = FALSE;
$transactions = $transaction->method->api( "payments/billing-agreements/{$billingAgreement->gw_id}/transactions?start_date=" . date( 'Y-m-d', time() - 86400 ) . '&end_date=' . date( 'Y-m-d' ), NULL, 'get' );
foreach ( $transactions['agreement_transaction_list'] as $t )
{
if ( $t['status'] == 'Completed' )
{
$transaction->gw_id = $t['transaction_id'];
$transaction->save();
if ( $fraudResult and $fraudResult !== \IPS\nexus\Transaction::STATUS_PAID )
{
$transaction->executeFraudAction( $fraudResult, TRUE );
}
else
{
$transaction->member->log( 'transaction', array(
'type' => 'paid',
'status' => $transaction::STATUS_PAID,
'id' => $transaction->id,
'invoice_id' => $transaction->invoice->id,
'invoice_title' => $transaction->invoice->title,
) );
$memberJustCreated = $transaction->approve();
if ( $memberJustCreated )
{
\IPS\Session::i()->setMember( $memberJustCreated );
\IPS\Member\Device::loadOrCreate( $memberJustCreated, FALSE )->updateAfterAuthentication( NULL );
}
}
$transaction->sendNotification();
\IPS\Output::i()->redirect( $transaction->url() );
}
}
/* Just save that we're waiting for the webhook */
$transaction->status = \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING;
$transaction->save();
$transaction->sendNotification();
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), "`key`='gatewayPending'" );
\IPS\Output::i()->redirect( $transaction->url() );
}