@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_5e9af489a7e21c3cd517fdbee24ab4568864a3f3b979778b249ebd2dc4bd3375
  Scenario: Create a custom payment for account Orchard-ES with 0% taxes then a row is still created in the ledger with 0.00 values.
    Given I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | ORCHARD-ES              |
      | agreementType    | Orchard                 |
      | paymentMethod    | payoneer_whitelabel     |
      | currency         | EUR                     |
      | owner            | orchard                 |
      | 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 Altafonte Network, S.L.U
    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
    And I check ledger_vat_summary has the following values:
      | column                    | value |
      | wht_rate                  | 0     |
      | wht_amount_vat_currency   | 0     |
      | wht_amount_payee_currency | 0     |
      | vat_rate                  | 0     |
      | vat_amount_vat_currency   | 0     |
      | vat_amount_payee_currency | 0     |
    When I should be able to open account details
    Then I check that Account Activity has event Custom Payment Returned
