public StorageReceipt(String response) : base(response) { // storage token ID this.storageTokenId = (String) this.responseParams["STORAGE_TOKEN_ID"]; // make sure profile available bool paymentProfileAvailable = this .parseBoolean("PAYMENT_PROFILE_AVAILABLE"); if (paymentProfileAvailable) { // parse the CreditCard CreditCard creditCard = null; bool creditCardAvailable = this.parseBoolean("CREDIT_CARD_AVAILABLE"); if (creditCardAvailable) { String sanitized = (String) this.responseParams["CREDIT_CARD_NUMBER"]; sanitized = sanitized.Replace("*", ""); creditCard = new CreditCard(long.Parse(sanitized), this.parseShort("EXPIRY_DATE")); } // parse the Customer Profile CustomerProfile profile = null; bool customerProfileAvailable = this.parseBoolean("CUSTOMER_PROFILE_AVAILABLE"); if (customerProfileAvailable) { profile = new CustomerProfile(); profile.setLegalName((String)this.responseParams["CUSTOMER_PROFILE_LEGAL_NAME"]); profile.setTradeName((String)this.responseParams["CUSTOMER_PROFILE_TRADE_NAME"]); profile.setWebsite((String)this.responseParams["CUSTOMER_PROFILE_WEBSITE"]); profile.setFirstName((String)this.responseParams["CUSTOMER_PROFILE_FIRST_NAME"]); profile.setLastName((String)this.responseParams["CUSTOMER_PROFILE_LAST_NAME"]); profile.setPhoneNumber((String)this.responseParams["CUSTOMER_PROFILE_PHONE_NUMBER"]); profile.setFaxNumber((String)this.responseParams["CUSTOMER_PROFILE_FAX_NUMBER"]); profile.setAddress1((String)this.responseParams["CUSTOMER_PROFILE_ADDRESS1"]); profile.setAddress2((String)this.responseParams["CUSTOMER_PROFILE_ADDRESS2"]); profile.setCity((String)this.responseParams["CUSTOMER_PROFILE_CITY"]); profile.setProvince((String)this.responseParams["CUSTOMER_PROFILE_PROVINCE"]); profile.setPostal((String)this.responseParams["CUSTOMER_PROFILE_POSTAL"]); profile.setCountry((String)this.responseParams["CUSTOMER_PROFILE_COUNTRY"]); } this.paymentProfile = new PaymentProfile(creditCard, profile); } else { this.paymentProfile = null; } }
private void appendCreditCard(StringBuilder req, CreditCard creditCard) { if (creditCard != null) { this.appendParam(req, "creditCardNumber", creditCard.getCreditCardNumber()); this.appendParam(req, "expiryDate", creditCard.getExpiryDate()); this.appendParam(req, "magneticData", creditCard.getMagneticData()); if (creditCard.getCvv2() != null) { this.appendParam(req, "cvv2", creditCard.getCvv2()); } this.appendParam(req, "street", creditCard.getStreet()); this.appendParam(req, "zip", creditCard.getZip()); this.appendParam(req, "secureCode", creditCard.getSecureCode()); this.appendParam(req, "cardHolderName", creditCard.getCardHolderName()); } }
// Verify credit card and add credit card to secure storage with // secureTokenId public CreditCardReceipt verifyCreditCard(CreditCard creditCard, VerificationRequest verificationRequest, String secureTokenId) { if (creditCard == null) { return new CreditCardReceipt(REQ_INVALID_REQUEST, "creditCard is required", null); } return this.verifyCreditCardHelper(creditCard, verificationRequest, true, true, secureTokenId); }
public CreditCardReceipt verifyCreditCard(CreditCard creditCard, VerificationRequest verificationRequest) { if (creditCard == null) { throw new ArgumentNullException("creditCard is required"); } if (verificationRequest == null) { throw new ArgumentNullException("verificationRequest is required"); } // create the request string StringBuilder req = new StringBuilder(); this.appendHeader(req, "verifyCreditCard"); this.appendCreditCard(req, creditCard); this.appendVerificationRequest(req, verificationRequest); return this.send(req); }
public CreditCardReceipt updateRecurringPurchase(PeriodicPurchaseInfo periodicPurchaseInfo, CreditCard creditCard, String storageTokenId, VerificationRequest verificationRequest) { if (storageTokenId == null && creditCard == null){ return new CreditCardReceipt(REQ_INVALID_REQUEST, "creditCard or storageTokenId is required", null); } else if (storageTokenId != null) { return this.updateRecurringPurchaseHelper(periodicPurchaseInfo, storageTokenId, verificationRequest, false); } else { return this.updateRecurringPurchaseHelper(periodicPurchaseInfo, creditCard, verificationRequest, true); } }
public CreditCardReceipt updateRecurringPurchase(long recurringPurchaseId, CreditCard creditCard, long perPaymentAmount, VerificationRequest verificationRequest) { return this.updateRecurringPurchaseHelper(new PeriodicPurchaseInfo(recurringPurchaseId, PeriodicPurchaseInfo.State.NULL, perPaymentAmount), creditCard, verificationRequest, true); }
// 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); }
// recurring purchase, CC ver public CreditCardReceipt recurringPurchase(String orderId, CreditCard creditCard, long perPaymentAmount, DateTime startDate, DateTime endDate, PeriodicPurchaseInfo.Schedule schedule, VerificationRequest verificationRequest) { if (creditCard == null) { return new CreditCardReceipt(REQ_INVALID_REQUEST, "creditCard is required", null); } return this.recurringPurchaseHelper(new PeriodicPurchaseInfo(0L, null, schedule, perPaymentAmount, orderId, null, startDate, endDate, DateTime.MinValue), creditCard, verificationRequest, true); }
//--------------------------------------------------------------------- // Service Methods //--------------------------------------------------------------------- public CreditCardReceipt installmentPurchase(String orderId, CreditCard creditCard, long perInstallmentAmount, DateTime startDate, int totalNumberInstallments, VerificationRequest verificationRequest) { if (orderId == null) { throw new ArgumentNullException("orderId is required"); } if (creditCard == null) { throw new ArgumentNullException("creditCard is required"); } // create the request string StringBuilder req = new StringBuilder(); this.appendHeader(req, "installmentPurchase"); this.appendOrderId(req, orderId); this.appendCreditCard(req, creditCard); this.appendAmount(req, perInstallmentAmount); this.appendStartDate(req, startDate); this.appendTotalNumberInstallments(req, totalNumberInstallments); this.appendVerificationRequest(req, verificationRequest); return this.send(req); }
public void setCreditCard(CreditCard newCreditCard) { this.creditCard = newCreditCard; }
public PaymentProfile(CreditCard creditCard, CustomerProfile customerProfile) { this.creditCard = creditCard; this.customerProfile = customerProfile; }
public CreditCardReceipt singlePurchase(String orderId, CreditCard creditCard, long amount, VerificationRequest verificationRequest) { if (orderId == null) { throw new ArgumentNullException("orderId is required"); } if (creditCard == null) { throw new ArgumentNullException("creditCard is required"); } // create the request string StringBuilder req = new StringBuilder(); this.appendHeader(req, "singlePurchase"); this.appendOrderId(req, orderId); this.appendCreditCard(req, creditCard); this.appendAmount(req, amount); this.appendVerificationRequest(req, verificationRequest); return this.send(req); }