Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
@@ -179,7 +179,25 @@ class _generateRenewalInvoices extends \IPS\Task
|
||||
/* Charge to card */
|
||||
if ( $invoice->status !== $invoice::STATUS_PAID )
|
||||
{
|
||||
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_customer_cards', array( 'card_member=?', $member->member_id ) ), 'IPS\nexus\Customer\CreditCard' ) as $card )
|
||||
/* Figure out which payment methods are allowed in this invoice */
|
||||
$allowedPaymentMethods = array();
|
||||
foreach( $invoice->items as $item )
|
||||
{
|
||||
if( \is_array( $item->paymentMethodIds ) and !\in_array( '*', $item->paymentMethodIds ) )
|
||||
{
|
||||
$allowedPaymentMethods = array_merge( $allowedPaymentMethods, $item->paymentMethodIds );
|
||||
}
|
||||
}
|
||||
|
||||
$cardWhere = array(
|
||||
array( 'card_member=?', $member->member_id )
|
||||
);
|
||||
if( \count( $allowedPaymentMethods ) )
|
||||
{
|
||||
$cardWhere[] = array( \IPS\Db::i()->in( 'card_method', $allowedPaymentMethods ) );
|
||||
}
|
||||
|
||||
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_customer_cards', $cardWhere ), 'IPS\nexus\Customer\CreditCard' ) as $card )
|
||||
{
|
||||
$log .= "Attempting card {$card->id}... ";
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ class _sendInvoiceWarnings extends \IPS\Task
|
||||
|
||||
/* Create a temporary invoice (we're not going to save this) so that we know what the charges will be */
|
||||
$invoice = new \IPS\nexus\Invoice;
|
||||
$invoice->currency = $currency;
|
||||
foreach ( $purchases as $purchase )
|
||||
{
|
||||
$invoice->addItem( \IPS\nexus\Invoice\Item\Renewal::create( $purchase ) );
|
||||
|
||||
Reference in new issue
Block a user