Version 5.0.13

This commit is contained in:
Neo committed 2025-12-19 19:04:57 -08:00
1 parent b89858b2ff
commit 5efe744c5f
1407 files changed
+69690 -30177

No files matched your search

@@ -271,7 +271,7 @@ abstract class Gateway extends Model
$return = array();
foreach ( static::roots() as $gateway )
{
if ( $gateway->canStoreCards( $adminCreatableOnly ) )
if ( $gateway->canStoreCards( $adminCreatableOnly ) and $gateway->active )
{
$return[ $gateway->id ] = $gateway;
}
@@ -308,7 +308,7 @@ abstract class Gateway extends Model
$return = array();
foreach ( static::roots() as $gateway )
{
if ( $gateway->billingAgreements() )
if ( $gateway->billingAgreements() and $gateway->active )
{
$return[ $gateway->id ] = $gateway;
}
@@ -362,7 +362,7 @@ class Stripe extends Gateway
'data-zip' => $invoice->billaddress?->postalCode,
'data-country' => $invoice->billaddress?->country,
'data-email' => $member ? $member->email : $invoice->member->email,
'data-phone' => isset( $member->cm_phone ) ? $member->cm_phone : NULL,
'data-phone' => isset( $member->cm_phone ) ? $member->cm_phone : ( $invoice->member->cm_phone ?? null ),
'data-amount' => static::_amountAsCents( $amount ),
'data-currency' => $amount->currency,
'data-setupIntent' => $setupIntent ? $setupIntent['id'] : NULL,
@@ -469,47 +469,47 @@ class Stripe extends Gateway
}
}
if ( !isset( $data['customer'] ) )
{
if ( $member->member_id )
{
$response = $this->api( 'customers', array(
'name' => $member->cm_name,
'email' => $member->email,
'metadata' => array(
"Customer ID" => $member->member_id
)
) );
$profiles[ $this->id ] = $response['id'];
$member->cm_profiles = $profiles;
$member->save();
}
else
{
$response = $this->api( 'customers', array(
'name' => $invoice->member->cm_name,
'email' => $invoice->member->email,
) );
$profiles[ $this->id ] = $response['id'];
$guestData = $invoice->guest_data;
$guestData['member']['cm_profiles'] = $profiles;
$guestData['cards'][] = array(
'card_method' => $this->id,
'card_data' => $paymentMethod
);
$invoice->guest_data = $guestData;
$invoice->save();
}
$data['customer'] = $profiles[ $this->id ];
}
if ( $savePaymentMethod )
{
$data['save_payment_method'] = 'true';
$data['setup_future_usage'] = 'off_session';
if ( !isset( $data['customer'] ) )
{
if ( $member->member_id )
{
$response = $this->api( 'customers', array(
'name' => $member->cm_name,
'email' => $member->email,
'metadata' => array(
"Customer ID" => $member->member_id
)
) );
$profiles[ $this->id ] = $response['id'];
$member->cm_profiles = $profiles;
$member->save();
}
else
{
$response = $this->api( 'customers', array(
'name' => $invoice->member->cm_name,
'email' => $invoice->member->email,
) );
$profiles[ $this->id ] = $response['id'];
$guestData = $invoice->guest_data;
$guestData['member']['cm_profiles'] = $profiles;
$guestData['cards'][] = array(
'card_method' => $this->id,
'card_data' => $paymentMethod
);
$invoice->guest_data = $guestData;
$invoice->save();
}
$data['customer'] = $profiles[ $this->id ];
}
}
$response = $this->api( 'payment_intents', $data );
@@ -24,6 +24,7 @@ use IPS\nexus\Money;
use IPS\nexus\Transaction;
use LogicException;
use function defined;
use const IPS\NEXUS_TEST_GATEWAYS;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{