Skip to content

Magento_CompanyCredit (Hyvä Checkout)

Magento Modules:

  • Magento_CompanyCredit

Adobe Commerce Packages

  • magento/module-company-credit

Repository

Note: this repo is only accessible with a Hyvä Enterprise license or as a contributor.

For more details, see: https://www.hyva.io/hyva-enterprise.html.

https://gitlab.hyva.io/hyva-enterprise/b2b/magento2-ee-hyva-enterprise-checkout-b2b

Features

All points are rated according to priority as P1 (critical), P2 (important), P3 (minor).

  • basic - does not break layout/design
  • All built-in checkout layouts supported (default, one page, mobile)

Note: this issue is for features related to the checkout only. See #99 for details on Hyvä Theme compatibility.

Payment Method Section

Note: Credit Limit settings are managed per company within 'Customer > Companies' under the 'Company Credit' tab and available payment methods under the 'Advanced Settings' tab. The 'Payment on Account' payment method must also be enabled in 'Stores > Configuration' under 'Sales > Payment Methods'.

  • [P1] Add support for 'Payment on Account' payment method
    • i.e. the method displays, and orders can be placed
  • [P1] Customer can add a 'Custom Reference Number' (optional)
  • [P1] Customer can see the available credit they have

Note: 'You will be charged for' in totals. This always matches the order total, regardless of discounts, gift cards, store credit or reward points applied

Conditions

  • [P1] Only display 'Payment on Account' payment method if all the below are true
    • The customer is logged in and is part of a company
    • Company accounts are enabled in 'Stores > Configuration' under 'General > B2B Features' (btob/website_configuration/company_active)
    • A credit limit is set for the company
    • The 'Payment on Account' payment method is enabled for the company
      • Either per company or by default in Stores > Configuration' under 'General > B2B Features' (btob/website_configuration/default_b2b_payment_methods_applicable_payment_methods)
  • [P1] Disable 'Payment on Account' payment method if the company is not allowed to exceed their credit limit and the current cart total is higher than their available credit
    • The payment method is still visible but cannot be used (the 'place order' button is disabled)
    • An error message displays: 'Payment On Account cannot be used for this order because your order amount exceeds your credit amount.'
  • [P2] Display a warning message if the company is allowed to exceed their credit limit and the current cart total is higher than their available credit
    • The order can still be placed
    • A warning message displays: ''
Credit can't be exceed error/placement disable
Credit will (can) be exceeded warning

image

Order Summary Panel

  • [P3] Add 'You will be charged for' item in the totals section that outlines the amount of credit that will need to be reimbursed in future

    This should only display when the 'Payment on Account' payment method is selected (see above screenshot)

This has been marked as not required as adds no real value

Order Placement

  • [P1] The order is successfully created
  • [P1] The company credit limit is updated/adjusted from the order total
  • [P1] The balance history records are updated (visible via /company_credit/history/)

Additional Admin Screenshots (for guidance)

Company credit per company configuration

From navigation menu: Customer > Companies

Note: while it should not affect implementation, it is worth noting that credit is only available in the currency set against the company.

B2B payment methods configuration

From navigation menu: Stores > Configuration (under General > B2B Features in the submenu)

Contributors

Voting

Use 👍 to cast your vote.

Edited by John Hughes
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information