/*
         * Helper method for singlePurchase() to handle usage of real CC and
         * storageTokenId specifier.
         */
        private CreditCardReceipt singlePurchaseHelper(String orderId, Object creditCardSpecifier, long amount, VerificationRequest verificationRequest, PurchaseCardRequest purchaseCard, bool isActualCreditCard, bool addToStorage, String secureTokenId)
        {
            if (orderId == null)
            {
                return new CreditCardReceipt(REQ_INVALID_REQUEST, "orderId is required", null);
            }

            // create the request string
            StringBuilder req = new StringBuilder();
            try {
                this.appendHeader(req, "singlePurchase");
                this.appendOrderId(req, orderId);

                // real CC, or using storage token
                if (isActualCreditCard) {
                    if (addToStorage) {
                        this.appendStorageFlag(req, true);
                        this.appendStorageTokenId(req, secureTokenId);
                    }

                    this.appendCreditCard(req, (CreditCard) creditCardSpecifier);
                } else {
                    this.appendStorageTokenId(req, creditCardSpecifier.ToString());
                }
                this.appendAmount(req, amount);
                this.appendVerificationRequest(req, verificationRequest);
                this.appendPurchaseCard(req, purchaseCard);

                // render indicator
                foreach (CreditCardIndicator indicator in indicatorList) {
                    this.appendIndicator(req, indicator);
                }
            } catch (Exception e) {
                return new CreditCardReceipt(REQ_INVALID_REQUEST, e.ToString(), null);
            }
            return this.send(req);
        }
 /*
  *
  *
  * @see com.admeris.creditcard.api.CreditCardService#singlePurchase(
  * java.lang.String, java.lang.String, long,
  * com.admeris.creditcard.api.VerificationRequest,
  * com.admeris.creditcard.api.PurchaseCardRequest)
  */
 public CreditCardReceipt singlePurchase(String orderId, String storageTokenId, long amount, VerificationRequest verificationRequest, PurchaseCardRequest purchaseCard)
 {
     if (storageTokenId == null || storageTokenId.Length <= 0)
     {
         return new CreditCardReceipt(REQ_INVALID_REQUEST, "storageTokenId is required", null);
     }
     return this.singlePurchaseHelper(orderId, storageTokenId, amount, verificationRequest, purchaseCard, false, false, null);
 }
 private void appendPurchaseCard(StringBuilder req, PurchaseCardRequest purchaseCard)
 {
     if (purchaseCard != null)
     {
         this.appendParam(req, "pcii_indicator", "true");
         this.appendParam(req, "pcii_customerCode", purchaseCard.getCustomerCode());
         this.appendParam(req, "pcii_salesTax", purchaseCard.getSalesTax().ToString());
         if (purchaseCard.getInvoice() != null)
         {
             this.appendParam(req, "pcii_invoice", purchaseCard.getInvoice());
         }
         if (purchaseCard.getSkuNumber() != null)
         {
             this.appendParam(req, "pcii_skuNumber", purchaseCard.getSkuNumber());
         }
         if (purchaseCard.getTranCode() != null)
         {
             this.appendParam(req, "pcii_tranCode", purchaseCard.getTranCode());
         }
     }
 }
 // Make single purchase and add credit card to secure storage with
 // secureTokenId
 public CreditCardReceipt singlePurchase(String orderId, CreditCard creditCard, long amount, VerificationRequest verificationRequest, PurchaseCardRequest purchaseCard, String secureTokenId)
 {
     if (creditCard == null)
     {
         return new CreditCardReceipt(REQ_INVALID_REQUEST, "creditCard is required", null);
     }
     return this.singlePurchaseHelper(orderId, creditCard, amount, verificationRequest, purchaseCard, true, true, secureTokenId);
 }