Jump to content

Bug: Invoice with custom packages cannot be paid


Go to solution Solved by Stuart Silvester,

Recommended Posts

This was a fun one! I have a client who uses Custom Packages fairly often. Today they created an invoice for a client with a custom package, same way they always do. The client received a notification, logged in to pay the invoice, and when they hit "Pay Now", they received the following error message:

"Custom Enterprise License is not available for your account". Error code is 000/B.

It seems that as of version 4.6.9, there was a new check introduced to \IPS\nexus\modules\front\checkout\checkout::_pay(), which verifies that the user has permission to purchase the items in the invoice. 

\IPS\nexus\Package\Product::memberCanPurchase

if ( ! ( $this->member_groups == "*" or !empty( ( array_intersect( explode( ",", $this->member_groups ), $member->groups ) ) ) ) )
		{
			throw new \DomainException( $member->language()->addToStack( 'err_group_cant_purchase', FALSE, array( 'sprintf' => array( $member->language()->addToStack( "nexus_package_{$this->id}" ) ) ) ) );
		}

The above check always fails for custom packages, because nexus_packages.p_member_groups is empty - not null, not *, just empty. Therefore, when the user goes to pay the invoice, it tells them that they're not allowed to do so.

I would suggest an override for the memberCanPurchase method in \IPS\nexus\extensions\nexus\Item\CustomPackage to verify that the member purchasing matches the value in nexus_packages.p_custom.

Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...