Back to project page cloudmine-android.
The source code is released under:
Copyright (c) 2012 CloudMine LLC, http://cloudmine.me Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")...
If you think the Android project cloudmine-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cloudmine.api.rest.response; //from w w w . j a va 2 s .c o m import com.cloudmine.api.CMCreditCard; import com.cloudmine.api.rest.response.code.PaymentCode; import org.apache.http.HttpResponse; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; /** * <br>Copyright CloudMine LLC. All rights reserved * <br> See LICENSE file included with SDK for details. */ public class PaymentResponse extends ResponseBase<PaymentCode> { private List<CMCreditCard> creditCards; protected PaymentResponse(HttpResponse response) { super(response); } public PaymentResponse(String messageBody, int statusCode) { super(messageBody, statusCode); } @Override public PaymentCode getResponseCode() { return PaymentCode.codeForStatus(getStatusCode()); } public String getStep() { Object step = getObject("step"); return step == null ? "" : step.toString(); } public boolean wasCompleted() { return "completed".equals(getStep()); } public List<CMCreditCard> getCreditCards() { if(creditCards == null) { creditCards = new ArrayList<CMCreditCard>(); Object cards = getObject("card"); if(cards instanceof Collection) { for(Object card : (Collection)cards) { if(card instanceof Map) { Map<String, String> cardMap = (Map<String, String>) card; String nameOnCard = cardMap.get("nameOnCard"); String token = cardMap.get("token"); String expirationDate = cardMap.get("expirationDate"); String last4Digits = cardMap.get("last4Digits"); String type = cardMap.get("type"); creditCards.add(new CMCreditCard(nameOnCard, token, expirationDate,last4Digits,type)); } } } } return creditCards; } }