Back to project page Java-Yandex.Money-API-SDK.
The source code is released under:
MIT License
If you think the Android project Java-Yandex.Money-API-SDK 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 ru.yandex.money.api.response; /*ww w . j av a 2s. c om*/ import ru.yandex.money.api.enums.MoneySource; import ru.yandex.money.api.enums.Status; import ru.yandex.money.api.response.util.RequestPaymentError; import ru.yandex.money.api.response.util.money.PaymentMethods; import java.io.Serializable; import java.math.BigDecimal; import java.util.Map; /** * <p>??????? ???? ???????? ?????????? ?????? requestPayment</p> * <b>????????</b>: ??? ??????????? ?????????? ???????? ???? ?????, ????? error ? * status (????? ??????? ??????????????), ????? null * @author dvmelnikov */ public class RequestPaymentResponse implements Serializable { private static final long serialVersionUID = -2187147998780277482L; private Status status; private String error; private String error_description; private PaymentMethods moneySource; private String requestId; private String contract; private BigDecimal balance; private Boolean recipient_identified; private String recipient_account_type; private Boolean test_payment; private Map<String, String> contract_details; private String ext_action_uri; private RequestPaymentResponse() { } /** * ????? ?????????? ?? ??????? ??? ?????? ? ?????????? ???????? * @return ???? ??????? ??????????? ???????? */ public Boolean isSuccess() { return status == Status.success; } /** * ????? ???????? ???????????? ??????: ?? ???????? ??? ?? ???????????? ? ?????? * ??????????? ????? * @param moneySource ???????? ?????????????? {@link MoneySource} * @return ???????? ?? ?????? ?????????? ????????? ? ?????????? ?????????? */ public boolean isPaymentMethodAvailable(MoneySource moneySource) { if (moneySource == null) { throw new IllegalArgumentException("Money source is empty"); } if (getMoneySource() == null) { return false; } switch (moneySource) { case card: return getMoneySource().getCard() != null && getMoneySource().getCard().getAllowed(); case wallet: return getMoneySource().getWallet() != null && getMoneySource().getWallet().getAllowed(); default: return false; } } /** * ??? ?????????? ??????????? ????????. * @return ????????????? {@link Status} */ public Status getStatus() { return status; } public String getErrorDescription() { return error_description; } public Boolean isTestPayment() { return test_payment; } /** * @return ??? ?????? ??? ???????? ???????. ????????? ?????????: * <ul> * <li>illegal_params ? ????????????? ??? ????? ????????????? ????????? * ????????????? ????????? ???????;</li> * <li>payment_refused ? ??????? ??????? ? ?????? ??????? (???????? * ???????????? ?????????? ????????? ?? ?????, ???????? ??? ? ????????).</li> * <li>???? ?????? ?????????: ????????????? ??????, ????????? ?????? * ????? ?????????? ?????.</li> * </ul> */ public RequestPaymentError getError() { return RequestPaymentError.getByCode(error); } /** * ?????????? ???? ??????????? ?????? ??????????? ??????? (wallet ??? card). * ?????????????? ?????? ??? ????????? ?????????? ?????? requestPayment*. * @return ?????? {@link ru.yandex.money.api.response.util.money.PaymentMethods} */ public PaymentMethods getMoneySource() { return moneySource; } /** * @return ????????????? ???????? ???????, * ???????????????? ??????????. ?????????????? ?????? ??? ????????? * ?????????? ?????? requestPayment*. */ public String getRequestId() { return requestId; } /** * @return ?????? ?????????? ??????? (????????). * ?????????????? ?????? ??? ????????? ?????????? ?????? requestPayment*. */ public String getContract() { return contract; } /** * @return ??????? ???????? ?? ?????? ?????????????. * ?????????????? ?????? ??? ????????? ?????????? ?????? requestPayment ? ??? ??????? ? ?????? ????? account-info */ public BigDecimal getBalance() { return balance; } /** * @return ??? ?????? <u>???????????</u>. ("personal" ???? "professional") * ?????????????? ?????? ??? ????????? ?????????? ?????? requestPayment ??? p2p ???????? */ public String getRecipientAccountType() { return recipient_account_type; } /** * @return ??????? ????????????????????? <u>???????????</u> * ?????????????? ?????? ??? ????????? ?????????? ?????? requestPayment ??? p2p ???????? */ public Boolean getRecipientIdentified() { return recipient_identified; } /** * ???. ????????? ?????????. * ?????????????? ??? ??????? ? ???????, ????? ? ???????? ??????????????? ???????? show_contract_details=true * @return */ public Map<String, String> getContractDetails() { return contract_details; } /** * Uri, ?? ???????? ????? ????????? ????????????? ? ???????, * ????? ?? request-payment ?????????? ?????? "ext_action_required" * @return */ public String getExtActionUri() { return ext_action_uri; } @Override public String toString() { return "RequestPaymentResponse{" + "status=" + status + ", error='" + error + '\'' + ", error_description='" + error_description + '\'' + ", moneySource=" + moneySource + ", requestId='" + requestId + '\'' + ", contract='" + contract + '\'' + ", contract_details='" + contract_details + '\'' + ", balance=" + balance + ", test_payment=" + test_payment + ", recipient_identified=" + recipient_identified + ", recipient_account_type='" + recipient_account_type + '\'' + '}'; } }