Transfers transaction details into Millennium.
The following examples show how to transfer details of a gift certificate or package sale into Millennium.
| 
 Millennium.SDK.Client.SoapClient sdkClient = new Millennium.SDK.Client.SoapClient(); 
 sdkClient.Init("http://ServerDNSNameOrIP/MillenniumSDK/Millenniumsdk.asmx", "DA3DC70B-143F-477d-A26D-8103D8712B4F"); 
 Millennium.SDK.Objects.TransactionHeader transactionHeader = new Millennium.SDK.Objects.TransactionHeader(); Millennium.SDK.Objects.Transaction transaction = default(Millennium.SDK.Objects.Transaction); Millennium.SDK.Objects.GiftCertificate gc = default(Millennium.SDK.Objects.GiftCertificate); Millennium.SDK.Objects.PackageHeader packHeader = default(Millennium.SDK.Objects.PackageHeader); Millennium.SDK.Objects.PackageDetail packdetail = default(Millennium.SDK.Objects.PackageDetail); Millennium.SDK.Objects.PaymentType payment = default(Millennium.SDK.Objects.PaymentType); decimal transAmount = 0; decimal pkgAmount = 0; transactionHeader.AllowPoints = true; // This means we want this transaction to calculate lpoints when saved. transactionHeader.ClientId = clientId; transactionHeader.DrawerId = drawerId; transactionHeader.ExchangeRate = 1; // The exchange rate to the main currency transactionHeader.GSTTaxAmount = 0; // The amount of GST tax charged (if applicable). transactionHeader.HasNoGstTax = true; // True if the sale doesn't have GST tax, otherwise False. transactionHeader.HasNoPstTax = true; //True if the sale doesn't have GST tax, otherwise False. transactionHeader.IsMailOrder = False; // True if this sale is a mail order, otherwise False. If True, then the MailOrder property should be set to a mail order object. transactionHeader.PSTTaxAmount = 0; // The amount of PST tax charged (if applicable). transactionHeader.TransactionDateTime = null; // Setting this to nothing will instruct the Millennium.SDK to use current server datetime when saving the transaction. gc = new Millennium.SDK.Objects.GiftCertificate(); gc.AmountLeft = totalAmount; gc.EmployeeId = employeeId; // The id of the employee selling this GC (used for reporting reasons). gc.Expiration = gcExpirationDate; gc.GiftCertificateNumber = "#AUTO#"; // #AUTO# instruct Millennium.SDK to auto generate the GC number. gc.GiftTypeId = gcTypeId; // The id of the GC type (used for reporting reasons). gc.Notes = "My GC notes"; gc.OriginAmount = totalAmount; gc.Price = totalAmount; gc.PurchasedByClientId = clientId; gc.PurchasedForClientId = clientId; gc.ReferralId = referralId; // The Referral Type Id, 0 displays if no referral type was used (used for reporting reasons). gc.TipAmount = tip; gc.TipRemaining = tip; gc.ValidFrom = System.DateTime.Now; transAmount += gc.OriginAmount; transactionHeader.GiftCertificates.Add(gc); packdetail = new Millennium.SDK.Objects.PackageDetail(); packdetail.ClientId = clientId; packdetail.IsTaxable = False; // True if this package should be taxable. packdetail.ItemType = "P"; // P-Product, S-Service packdetail.ItemId = productId; // If ItemType = S then this should be the service id. packdetail.ItemPrice = 100; // The price for each item packdetail.ItemValue = 100; // The value for each item, which can be different from the price. packdetail.MembershipSaleDetailId = 0; // If this package comes from a membership sale, then put the membership sale id in here. packdetail.Quantity = 1; // How many items the package detail has. packdetail.QuantityRemaining = 1; pkgAmount += packdetail.Quantity * packdetail.ItemValue; packHeader = new Millennium.SDK.Objects.PackageHeader(); packHeader.Amount = pkgAmount; packHeader.EmployeeId = employeeId; // The id of the employee selling this GC (used for reporting reasons). packHeader.Expiration = System.DateTime.Now.AddYears(1); packHeader.HouseChargeAmount = 0; packHeader.IsSeries = False; // True if this package is a series, otherwise False. packHeader.MembershipSaleDetailId = 0; // If this package comes from a membership sale, then put the membership sale id in here. packHeader.PackageId = servPackageId; // The id of the service package (used for reporting reasons). packHeader.PackageNotes = "notes that I will like to add to this package."; packHeader.PackageNumber = "#AUTO#"; // #AUTO# instruct Millennium.SDK to auto generate the pkg number. packHeader.PackageValue = pkgAmount; packHeader.PurchasedByClientId = clientId; packHeader.PurchasedForClientId = clientId; packHeader.ReferralId = referralId; // The Referral Type Id, 0 displays if no referral type was used (used for reporting reasons). packHeader.TipAmount = tip; packHeader.TipRemaining = tip; packHeader.ValidFrom = System.DateTime.Now; packHeader.PackageDetails.Add(packdetail); transAmount += packHeader.PackageValue; transactionHeader.PackagesSeries.Add(packHeader); transaction = new Millennium.SDK.Objects.Transaction(); transaction.AppointmentTypeId = 0; // If this transaction was for a service that was booked, then it should have appointment type id. transaction.ClientId = clientId; transaction.EmployeeId = employeeId; // The id of the employee selling the product/service (used for reporting reasons). transaction.IsOnLineAppt = False; // True if the service performed was from an appointment that was booked via Millennium.NET, otherwise False. transaction.IsPreBookedService = False; // True if this service was pre-booked, otherwise False. transaction.PackageDetailId = 0; // If this transaction was created by using a package, then you should enter the package detail id here. transaction.TransactionType = "P"; // P-Product, S-Service transaction.ProductServiceId = productId; // If TransactionType = S then here should be the service id. transaction.Quantity = 1; transaction.UnitEmployeeCharge = 0; transaction.UnitHouseCharge = 0; transaction.UnitPrice = productPrice; transAmount += transaction.Quantity * transaction.UnitPrice; transactionHeader.Transactions.Add(transaction); payment = new Millennium.SDK.Objects.PaymentType(); payment.Amount = transAmount; payment.Notes = "any payment notes I would like to add."; payment.PaymentTypeId = 8; // The id of the payment type. transactionHeader.PaymentTypes.Add(payment); try { sdkClient.ValidateTransaction(transactionHeader); } catch (Exception ex) { // If an exception is raised, this means that there is something wrong with this transaction and that it cannot be transferred into Millennium. // Please see the exception for more details. return; } Millennium.SDK.Objects.CreditCardAuthorization ccAuth = default(Millennium.SDK.Objects.CreditCardAuthorization); try { //ccAuth = sdkClient.CreditCardProcessElement( clientId - the Client Id for the entire transaction. merchantAccountId - the merchant account id can be located by selecting Data > Business Information > Preferences > Credit Card/EFT tab. ccNumber - the credit card number. ccExpirationDate - The credit card expiration date in MMYY format. amountToCharge - The amount to be charged to the credit card. clientAddress - The client's address, clientZipCode - The client's zip code, cvvCode - The CVV/CID code on the credit card, nameOnCard - The name on the credit card, myReferenceNumber - Reference number used to identify this process with Element PS, clerckNumber - The clerck number as a string, can be empty. track2Data - The credit card track 2 data, if the cc was swiped then pass the track 2 data, otherwise pass an empty string . drawerId - The Drawer Id of the cash drawer used to process credit card payments. False) - If the merchaccountid has test credentials then pass True, otherwise False //ccAuth = sdkClient.CreditCardProcessElement(clientId, merchantAccountId, ccNumber, ccExpirationDate, amountToCharge, clientAddress, clientZipCode, cvvCode, nameOnCard, myReferenceNumber, clerckNumber, track2Data, drawerId, False) } catch (Exception ex) { // If an exception is raised, this means that the credit card processing failed. See the exception details for more info. return; } transactionHeader.PaymentTypes(0).CreditAuthorizationId = ccAuth.AuthorizationId; int transId = 0; try { transId = sdkClient.PutTransaction(transactionHeader); } catch (Exception ex) { // If an exception is raised, this means that the PutTransaction failed. See the exception details for more info. return; }  | 
| 
 Dim sdkClient As New Millennium.SDK.Client.SoapClient() 
 sdkClient.Init("http://ServerDNSNameOrIP/MillenniumSDK/Millenniumsdk.asmx", "DA3DC70B-143F-477d-A26D-8103D8712B4F") 
 Dim transactionHeader As New Millennium.SDK.Objects.TransactionHeader() Dim transaction As Millennium.SDK.Objects.Transaction = Nothing Dim gc As Millennium.SDK.Objects.GiftCertificate = Nothing Dim packHeader As Millennium.SDK.Objects.PackageHeader = Nothing Dim packdetail As Millennium.SDK.Objects.PackageDetail = Nothing Dim payment As Millennium.SDK.Objects.PaymentType = Nothing Dim transAmount As Decimal = 0 Dim pkgAmount As Decimal = 0 transactionHeader.AllowPoints = True ' This means we want this transaction to calculate lpoints when saved. transactionHeader.ClientId = clientId transactionHeader.DrawerId = drawerId transactionHeader.ExchangeRate = 1 ' The exchange rate to the main currency transactionHeader.GSTTaxAmount = 0 ' The amount of GST tax charged (if applicable). transactionHeader.HasNoGstTax = True ' True if the sale doesn't have GST tax, otherwise False. transactionHeader.HasNoPstTax = True ' True if the sale doesn't have GST tax, otherwise False. transactionHeader.IsMailOrder = False ' True if this sale is a mail order, otherwise False. If True then the MailOrder property should be set to a mail order object. transactionHeader.PSTTaxAmount = 0 ' The amount of PST tax charged (if applicable). transactionHeader.TransactionDateTime = Nothing ' Setting this to nothing will instruct the Millennium.SDK to use current server datetime when saving the transaction. gc = New Millennium.SDK.Objects.GiftCertificate() gc.AmountLeft = totalAmount gc.EmployeeId = employeeId ' The id of the employee selling this GC, used form reporting reasons. gc.Expiration = gcExpirationDate gc.GiftCertificateNumber = "#AUTO#" ' #AUTO# instruct Millennium.SDK to auto generate the GC number. gc.GiftTypeId = gcTypeId 'The id of the GC type (used for reporting reasons). gc.Notes = "My GC notes" gc.OriginAmount = totalAmount gc.Price = totalAmount gc.PurchasedByClientId = clientId gc.PurchasedForClientId = clientId gc.ReferralId = referralId ' The Referral Type Id, 0 displays if no referral type was used (used for reporting reasons). gc.TipAmount = tip gc.TipRemaining = tip gc.ValidFrom = System.DateTime.Now transAmount += gc.OriginAmount transactionHeader.GiftCertificates.Add(gc) packdetail = New Millennium.SDK.Objects.PackageDetail() packdetail.ClientId = clientId packdetail.IsTaxable = False ' True if this package should be taxable. packdetail.ItemType = "P" ' P-Product, S-Service packdetail.ItemId = productId ' If ItemType = S then this should be the Service id. packdetail.ItemPrice = 100 ' The price for each item packdetail.ItemValue = 100 ' The value for each item, which can be different from the price. packdetail.MembershipSaleDetailId = 0 ' If this package comes from a membership sale, then put the membership sale id in here. packdetail.Quantity = 1 ' How many items the package detail has. packdetail.QuantityRemaining = 1 pkgAmount += packdetail.Quantity * packdetail.ItemValue packHeader = New Millennium.SDK.Objects.PackageHeader() packHeader.Amount = pkgAmount packHeader.EmployeeId = employeeId ' The id of the employee selling this GC (used for reporting reasons). packHeader.Expiration = System.DateTime.Now.AddYears(1) packHeader.HouseChargeAmount = 0 packHeader.IsSeries = False ' True if this package is a series, otherwise False. packHeader.MembershipSaleDetailId = 0 ' If this package comes from a membership sale, then put the membership sale id in here. packHeader.PackageId = servPackageId ' The id of the service package (used for reporting reasons). packHeader.PackageNotes = "notes that I will like to add to this package." packHeader.PackageNumber = "#AUTO#" ' #AUTO# instruct Millennium.SDK to auto generate the pkg number. packHeader.PackageValue = pkgAmount packHeader.PurchasedByClientId = clientId packHeader.PurchasedForClientId = clientId packHeader.ReferralId = referralId ' The Referral Type Id, 0 displays if no referral type was used (used for reporting reasons). packHeader.TipAmount = tip packHeader.TipRemaining = tip packHeader.ValidFrom = System.DateTime.Now packHeader.PackageDetails.Add(packdetail) transAmount += packHeader.PackageValue transactionHeader.PackagesSeries.Add(packHeader) transaction = New Millennium.SDK.Objects.Transaction() transaction.AppointmentTypeId = 0 ' If this transaction was for a service that was booked, then put the appointment type id in here. transaction.ClientId = clientId transaction.EmployeeId = employeeId ' The id of the employee selling the product/service (used for reporting reasons). transaction.IsOnLineAppt = False ' True if the service performed was from an appointment that was booked via Millennium.NET, otherwise False. transaction.IsPreBookedService = False ' True if this service was pre-booked, otherwise False. transaction.PackageDetailId = 0 ' If this transaction was created using a package, then put the package detail id in here. transaction.TransactionType = "P" ' P-Product, S-Service transaction.ProductServiceId = productId ' If TransactionType = S then this should be the service id. transaction.Quantity = 1 transaction.UnitEmployeeCharge = 0 transaction.UnitHouseCharge = 0 transaction.UnitPrice = productPrice transAmount += transaction.Quantity * transaction.UnitPrice transactionHeader.Transactions.Add(transaction) payment = New Millennium.SDK.Objects.PaymentType() payment.Amount = transAmount payment.Notes = "any payment notes I would like to add." payment.PaymentTypeId = 8 ' The id of the payment type. transactionHeader.PaymentTypes.Add(payment) Try sdkClient.ValidateTransaction(transactionHeader) Catch ex As Exception ' If an exception is raised it means there is something wrong with this transaction and that it cannot be transferred into Millennium. ' Please see the exception for more details. Return End Try Dim ccAuth As Millennium.SDK.Objects.CreditCardAuthorization = Nothing Try ' ccAuth = sdkClient.CreditCardProcessElement( clientId - The Client Id for the entire transaction. merchantAccountId - The merchant account id can be located by selecting Data > Business Information > Preferences > Credit Card/EFT tab. ccNumber - The credit card number. ccExpirationDate - The credit card expiration date in MMYY format. amountToCharge - The amount to be charged to the credit card. clientAddress - The client's address. clientZipCode - The client's zip code. cvvCode - The CVV/CID code on the credit card. nameOnCard - The name on the credit card. myReferenceNumber - Reference number used to identify this process with Element PS. clerckNumber - The clerck number as a string, can be empty. track2Data - The credit card track 2 data, if the cc was swiped then pass the track 2 data, otherwise pass an empty string . drawerId - The Drawer Id of the cash drawer used to process credit card payments. False) - If the merchaccountid has test credentials then pass True, otherwise False. ccAuth = sdkClient.CreditCardProcessElement(clientId merchantAccountId, ccNumber, ccExpirationDate, amountToCharge, clientAddress, clientZipCode, cvvCode, nameOnCard, myReferenceNumber, clerckNumber, track2Data, drawerId, False) Catch ex As Exception ' If an exception is raised, this means that the credit card processing failed. See the exception details for more info. Return End Try transactionHeader.PaymentTypes(0).CreditAuthorizationId = ccAuth.AuthorizationId Dim transId As Integer = 0 Try transId = sdkClient.PutTransaction(transactionHeader) Catch ex As Exception ' If an exception is raised, this means that the PutTransaction failed. See the exception details for more info. Return End Try  | 
© 2016 Millennium by Harms Software Inc. All rights reserved.