Discussions
Adding to Open Credit
2 days ago by Nicholas B Wimsatt
I'm using ComboOrder to apply a payment to the invoice and would like to apply any remaining balance left over as an Open Credit. Below is just a sample.
{
"$type": "Asi.Soa.Commerce.DataContracts.ComboOrderData, Asi.Contracts",
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2,
"ExtensionData": {
"$type": "System.Runtime.Serialization.ExtensionDataObject, System.Runtime.Serialization"
}
},
"Order":{},
"Invoices": {
"$type": "Asi.Soa.Commerce.DataContracts.InvoiceSummaryDataCollection, Asi.Contracts",
"$values": [
{
"$type": "Asi.Soa.Commerce.DataContracts.LegacyInvoiceSummaryData, Asi.Contracts",
"BillingLogKey": "2ed92ffa-514f-47d7-b255-9ab78642dbb9",
"LockedEffectiveDate": "2025-02-01T00:00:00",
"InvoiceId": "CASH:97189:2ED92FFA-514F-47D7-B255-9AB78642DBB9-1",
"FinancialEntity": {
"$type": "Asi.Soa.Commerce.DataContracts.FinancialEntitySummaryData, Asi.Contracts",
"FinancialEntityId": "ABC",
"Name": "ABC Corp",
"EntityCode": "ABC",
"IsDefault": true
},
"InvoiceNumber": "Cash-97189",
"InvoiceDate": "2023-11-21T00:00:00",
"BillToParty": {
"$type": "Asi.Soa.Membership.DataContracts.PartySummaryData, Asi.Contracts",
"CityName": "Halifax",
"CountryName": "United States",
"CountrySubEntityName": "MA",
"Email": "",
"Phone": "",
"PartyId": "97189",
"Id": "97189",
"UniformId": "ee90f1b0-8005-4edf-ae60-5fae724ea53d",
"Status": {
"$type": "Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
"PartyStatusId": "A",
"Name": "Active",
"Description": "Active"
},
"Name": "John Doe",
"Sort": "DOE, JOHN",
"IsMarkedForDelete": false
},
"SoldToParty": {
"$type": "Asi.Soa.Membership.DataContracts.PartySummaryData, Asi.Contracts",
"CityName": "Halifax",
"CountryName": "United States",
"CountrySubEntityName": "MA",
"Email": "",
"Phone": "",
"PartyId": "97189",
"Id": "97189",
"UniformId": "ee90f1b0-8005-4edf-ae60-5fae724ea53d",
"Status": {
"$type": "Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
"PartyStatusId": "A",
"Name": "Active",
"Description": "Active"
},
"Name": "John J. Doe",
"Sort": "DOE, JOHN",
"IsMarkedForDelete": false
},
"Description": "Renewal Fees",
"InvoicePurpose": 9,
"InvoiceAmount": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Amount": 1075.44,
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2
},
"IsAmountDefined": true
},
"OriginalInvoiceAmount": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Amount": 1075.44,
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2
},
"IsAmountDefined": true
},
"PaymentAmount": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Amount": 310.2000,
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2
},
"IsAmountDefined": true
},
"PendingPaymentAmount": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2
},
"IsAmountDefined": true
},
"AdjustmentAmount": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2
},
"IsAmountDefined": true
},
"Balance": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Amount": 765.24,
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2
},
"IsAmountDefined": true
},
"PreviousBalance": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2
},
"IsAmountDefined": true
},
"AdditionalAttributes": {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
"$values": [
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "BillingMemberType",
"Value": "M"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "SourceSystem",
"Value": "DUES"
}
]
}
}
]
},
"Payments": {
"$type": "Asi.Soa.Commerce.DataContracts.RemittanceDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Commerce.DataContracts.RemittanceData, Asi.Contracts",
"Amount": {
"$type": "Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
"Amount": 1000.00,
"Currency": {
"$type": "Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
"CurrencyCode": "USD",
"DecimalPositions": 2,
"ExtensionData": {
"$type": "System.Runtime.Serialization.ExtensionDataObject, System.Runtime.Serialization"
}
},
"IsAmountDefined": true
},
"PaymentToken": "",
"PaymentTokenSummary": "",
"PaymentMethod": {
"$type": "Asi.Soa.Commerce.DataContracts.PaymentMethodData, Asi.Contracts",
"Name": "PayRoll Deduction",
"PaymentMethodId": "PAYROLL",
"PaymentType": "Cash",
"Message": "Cash"
},
"PayorParty": {
"$type": "Asi.Soa.Commerce.DataContracts.CustomerPartyData, Asi.Contracts",
"PartyId": "97189"
},
"ReferenceNumber": "123456789",
"Message": "Cash",
"Note":"Notes"
}]
}
}
When I POST to ComboOrder I get the following 400 validation error.
{"$type":"Asi.Soa.Core.DataContracts.ValidationResultsData, Asi.Contracts","Errors":{"$type":"Asi.Soa.Core.DataContracts.ValidationResultDataCollection, Asi.Contracts","$values":[{"$type":"Asi.Soa.Core.DataContracts.ValidationResultData, Asi.Contracts","Message":" \r\n Object reference not set to an instance of an object."}]},"Warnings":{"$type":"Asi.Soa.Core.DataContracts.ValidationResultDataCollection, Asi.Contracts","$values":[]}}
If I change the payment to below the balance of the invoice it works. Does the credit need to be its own separate call?