@frontend_royalties
@lambda_documents
@documents
@lambda_documents_payee
@ows_payment
@ows-payee
@graphql_tax_payment
Feature: Abacus custom payment

  Background:
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in

  @id_748fe6217d90c0b28fa57e054c779fd3a03681cf19dc1a5b957a42866334214c
  Scenario: Create/delete a custom payment for eligible account and must NOT be able to generate Custom Payments for Accounts that are not eligible
    Given I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-UK                 |
      | agreementType    | AWAL Core               |
      | currency         | GBP                     |
      | owner            | awal                    |
      | paymentMinimum   | 100                     |
      | paymentSchedule  | 45 days after month end |
    And I create a new account via API
    And I have a Distribution runcontroller created
    And I have a new Distribution contract lifecycle created with accounts created for AWAL Recordings Licensing Ltd
    And I update account_payee and account_tax_info tables
    And I update payoneer id in DB to 100246490
    When I should not be able to add a custom payment for specific account
    And I complete the account to create payment in payment entity 100 and update tax_eligibility to complete
    When I should be able to add a custom payment for specific account
    And I should be redirected to custom generated Payment
    And I should be able to review and approve the Custom payment
    And I should be able to delete custom payment

  @id_bd154c932a824f15c6f247aaf78710bdd2c35f8787e4d9e764d0a47d1d532451
  Scenario: Create a custom payment for account AWAL-UK with 0% taxes then a row have not to be created in the ledger.
    Given I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-UK                 |
      | agreementType    | AWAL Core               |
      | currency         | GBP                     |
      | owner            | awal                    |
      | paymentMinimum   | 100                     |
      | paymentSchedule  | 45 days after month end |
    And I create 1 new active accounts via API
    And I have a Distribution runcontroller created
    And I have a new Distribution contract lifecycle created with accounts created for AWAL Recordings Licensing Ltd
    And I update account_payee and account_tax_info tables
    And I update payoneer id in DB to 100246490
    And I should be able to put account's Payment Eligibility on hold
    When I should be able to add a custom payment for specific account without taxes
    And I should be redirected to custom generated Payment
    And I should be able to review and approve the Custom payment
    Then I send payment to Payoneer
    When I should be able to open account details
    Then I check that Account Activity has event Custom Payment
    Then I trigger webhook to make Custom payment canceled from payoneer
    Then I should see that payment status is Cancelled
    Then ledger_vat_summary has no records
