public Webpay.Integration.CSharp.AdminWS.CancelOrderRowsResponse DoRequest() { var auth = new AdminWS.Authentication() { Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()), Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode()) }; var request = new AdminWS.CancelOrderRowsRequest() { Authentication = auth, SveaOrderId = _builder.Id, OrderType = ConvertPaymentTypeToOrderType(_builder.OrderType), ClientId = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()), OrderRowNumbers = _builder.RowIndexesToCancel.ToArray(), //NewCreditInvoiceRows = _builder.NewCreditOrderRows.Select( x => ConvertOrderRowBuilderToAdminWSOrderRow(x) ).ToArray() }; // make request to correct endpoint, return response object var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE); var adminWS = new AdminServiceClient("WcfAdminSoapService", endpoint); var response = adminWS.CancelOrderRows(request); return(response); }
public LowerAmountResponse DoRequest() { // calculate sum of cancelled order rows, applying RowsToCancel to passed in NumberedOrderRows var amountToLowerOrderBy = 0M; foreach (int rowIndex in _builder.RowIndexesToCancel) { var deliveredRow = _builder.NumberedOrderRows[(rowIndex - 1)]; // -1 as NumberedOrderRows is one-indexed amountToLowerOrderBy += GetRowAmountIncVatFromBuilderOrderRow( deliveredRow.GetVatPercent(), deliveredRow.GetAmountIncVat(), deliveredRow.GetAmountExVat(), deliveredRow.GetQuantity()); } // lower order by calculated amount var hostedActionRequest = new HostedAdmin(_builder.GetConfig(), _builder.GetCountryCode()) .LowerAmount(new LowerAmount( transactionId: _builder.Id, amountToLower: Decimal.ToInt64(amountToLowerOrderBy * 100) // centessimal )); return(hostedActionRequest.DoRequest <LowerAmountResponse>()); }