SavePurchasePayment - accountsIQ/API-Wiki GitHub Wiki
The SavePurchasePayment
function creates a payment in an Entity for the indicated supplier. It will create a movement between the supplier's bank and the supplier's creditor control account.
public WSResult2OfBoolean SavePurchasePayment(string token, PurchasesPayment PurchasesPayment)
Public Function SavePurchasePayment(ByVal token As String, ByVal PurchasesPayment As PurchasesPayment) As WSResult2OfBoolean
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
PurchasePayment | PurchasePayment | The Purchase payment to create. |
The SavePurchasePayment method will create a new Purchase payment (supplier payment).
The operation returns a WSResultStatus object.
When the operation is successful, the Status property is Success or Created.
When the operation is unsucessful, the ErrorCode property holds the precise error that happened.
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
PurchasesPayment PurchasesPayment = PurchasesPayment.CreatePurchasesPayment();
PurchasesPayment.BankAccountCode = "CASH";
PurchasesPayment.BankExchangeRate = 0.5M;
PurchasesPayment.CheckReference = "CHK1";
PurchasesPayment.SupplierCode = Supplier.GetSupplierList(entity)[0].Code;
PurchasesPayment.Description = "Test";
PurchasesPayment.ExchangeRate = 2M;
PurchasesPayment.PaymentAmount = 100M;
PurchasesPayment.PaymentDate = DateTime.Now;
OperationResult result = PurchasesPayment.Save(entity, PurchasesPayment);
Assert.AreEqual(OperationResult.OperationStatus.Success, result.Status);
}
Dim ws As New Integration
Dim auth As String = ws.Login(entityID, partnerKey, userKey)
If (Not Me.auth Is Nothing) Then
Dim PurchasesPayment As PurchasesPayment = PurchasesPayment.CreatePurchasesPayment
PurchasesPayment.BankAccountCode = "CASH"
PurchasesPayment.BankExchangeRate = 0.5
PurchasesPayment.CheckReference = "CHK1"
PurchasesPayment.SupplierCode = Supplier.GetSupplierList(entity)(0).Code
PurchasesPayment.Description = "Test"
PurchasesPayment.ExchangeRate = 2
PurchasesPayment.PaymentAmount = 100
PurchasesPayment.PaymentDate = DateTime.Now
Dim result As OperationResult = PurchasesPayment.Save(entity, PurchasesPayment)
Assert.AreEqual(OperationStatus.Success, result.Status)
End If