Example #1
0
        public ProposedOrderResponse CreateProposedOrder(string accessToken, int locationId, string qrPaymentData,
                                                         int totalOutstandingAmountCents, int spendAmountCents,
                                                         int?taxAmountCents, int exemptionAmountCents, string register,
                                                         string cashier, string identifierFromMerchant,
                                                         string receiptMessageHtml, bool partialAuthorizationAllowed,
                                                         bool discountOnly, IList <Item> items)
        {
            // Adjust spend/tax/exemption amounts in situations where there are multiple payments on a single check.
            var adjustmentsForPartialPayments = ProposedOrderCalculator.CalculateCreateProposedOrderValues(
                totalOutstandingAmountCents, taxAmountCents ?? 0, exemptionAmountCents, spendAmountCents);

            CreateProposedOrderRequest request = new CreateProposedOrderRequest(accessToken, locationId, qrPaymentData,
                                                                                adjustmentsForPartialPayments.SpendAmount,
                                                                                adjustmentsForPartialPayments.TaxAmount,
                                                                                adjustmentsForPartialPayments.ExemptionAmount,
                                                                                register, cashier, identifierFromMerchant,
                                                                                receiptMessageHtml, partialAuthorizationAllowed,
                                                                                discountOnly, items);

            return(_restWrapper.Post <CreateProposedOrderRequestBody, ProposedOrderResponse>(
                       request.Body,
                       uri: BuildUri(request.ApiVersion, "proposed_orders"),
                       accessTokenHeader: FormatAccessTokenString(merchantUserAccessToken: request.AccessToken),
                       actions: null));
        }
        public ProposedOrderResponse CreateProposedOrder(string accessToken, int locationId, string qrPaymentData,
                                                         int totalOutstandingAmountCents, int spendAmountCents,
                                                         int?taxAmountCents, int exemptionAmountCents, string register,
                                                         string cashier, string identifierFromMerchant,
                                                         string receiptMessageHtml, bool partialAuthorizationAllowed,
                                                         IList <Item> items)
        {
            // Adjust spend/tax/exemption amounts in situations where there are multiple payments on a single check.
            var adjustmentsForPartialPayments = ProposedOrderCalculator.CalculateCreateProposedOrderValues(
                totalOutstandingAmountCents, taxAmountCents ?? 0, exemptionAmountCents, spendAmountCents);

            CreateProposedOrderRequest request = new CreateProposedOrderRequest(accessToken, locationId, qrPaymentData,
                                                                                adjustmentsForPartialPayments.SpendAmount,
                                                                                adjustmentsForPartialPayments.TaxAmount,
                                                                                adjustmentsForPartialPayments.ExemptionAmount,
                                                                                register, cashier, identifierFromMerchant,
                                                                                receiptMessageHtml, partialAuthorizationAllowed, items);

            return(request.Accept(_engine) as ProposedOrderResponse);
        }