Exemple #1
0
        public CompletedOrderResponse CompleteProposedOrder(string accessToken, int locationId, string qrPaymentData,
                                                            string proposedOrderUuid, int totalOutstandingAmountCents,
                                                            int spendAmountCents, int?taxAmountCents, int exemptionAmountCents,
                                                            int?appliedDiscountAmountCents, 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.CalculateCompleteOrderValues(totalOutstandingAmountCents,
                                                                                                     taxAmountCents ?? 0, exemptionAmountCents, spendAmountCents, appliedDiscountAmountCents ?? 0);

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

            return(_restWrapper.Post <CompleteProposedOrderRequestBody, CompletedOrderResponse>(
                       request.Body,
                       uri: BuildUri(request.ApiVersion, "completed_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);
        }