# Vânzătorul vinde marfa

Cand **Vanzatorul** întregistrează o linie de vânzare în interfața nouă și prețul din Moqui este diferit, **Sistemul** adaugă diferența de preț ca și o linie nouă de discount.

Cand **Vanzatorul** întregistrează o linie de vânzare în interfața nouă **și** închide bonul **și** furnizorul principal al produsului este Dunca **și** stocul intră în negativ, **Sistemul** trimite comandă la furnizor pentru produsul respectiv.

## Data statements

A POS sale is an OrderHeader with **salesChannelEnumId =** **POS** and Customer = **\_NA\_** and **CarrierShipmentMethod.shipmentMethodEnumId = ShMthPickUp**.

A POS cash payment is represented by an **Invoice** of type **InvoiceSimplified** with an attached payment of type **PtInvoicePayment** and **paymentInstrumentEnumId** = PiCash OR PiCod and **toPaymentMethodId** is a PaymentMethod with **paymentMethodTypeEnumId** = PmtCash and **ownerPartyId** = facility/store party id.

A POS card payment is represented by an **Invoice** of type **InvoiceSimplified** with an attached payment of type **PtInvoicePayment** and **paymentInstrumentEnumId** = PiDebitCard and **toPaymentMethodId** is a PaymentMethod with **paymentMethodTypeEnumId** = PmtBankAccount and **ownerPartyId** = facility/store party id, and an attached BankAccount(subtype of PaymentMethod).

NOTE: we use BankAccount for pos card payments because the money goes directly to our BankAccount and we don't store card details. The CreditCard payment method subtype with the type PmtCreditCard is only used for online card payments, where we need the card details.

```
Scenario A: Customer pays an invoice using store credit  
  paymentTypeEnumId    = PtInvoicePayment  
  paymentInstrumentEnumId = PiFinancialAccount  
  paymentMethodId      → PaymentMethod (PmtFinancialAccount)  
                              └─ finAccountId → FinancialAccount (CustomerCredit)  
  Payment.finAccountId → same FinancialAccount  
  finAccountAuthId     → FinancialAccountAuth (holds the funds)  
  finAccountTransId    → FinancialAccountTrans (the debit from the account)  
  
Scenario B: Loading money onto a gift card (funding the FinancialAccount)  
  paymentTypeEnumId    = PtFinancialAccount  
  paymentInstrumentEnumId = PiCreditCard  (how the customer pays to load it)  
  paymentMethodId      → PaymentMethod (PmtCreditCard)  
  Payment.finAccountId → FinancialAccount (GiftCard) being loaded  
```