Android Open Source - Java-Yandex.Money-API-SDK Yandex Money Impl






From Project

Back to project page Java-Yandex.Money-API-SDK.

License

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.

Java Source Code

package ru.yandex.money.api;
//from w  w w .ja v a  2 s  .c  om
import org.apache.http.client.HttpClient;
import ru.yandex.money.api.enums.OperationHistoryType;
import ru.yandex.money.api.response.*;
import ru.yandex.money.api.rights.IdentifierType;
import ru.yandex.money.api.rights.Permission;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.Set;

/**
 * <p>??????? ???? ?????? ?? API ???????.??????. ????????? ?????????? YandexMoney.</p>
 * <p>?? ???????????????? ?????? ?? ????????? ????????? ??????? Apache HttpClient.
 * ?? ?? ????????? ???????? ? ?????? BrowserCompatHostnameVerifier,
 * ????? ???????? ????????? ???????, ??? ????? ?????????? ??????? ?????????????
 * ???????? ???????.?????, ?? ??????? ?? ????????. ??? ????? ????????????? ?????????
 * ??????????? ???????.????? ?? ????? ????????, ??? ??? ? java ????????? ???????
 * ?????????? ?????????????????? ??????????? CA, ????? ??? GTE CyberTrust
 * Solutions, Inc.</p>
 *
 * @author dvmelnikov
 */
@Deprecated
public class YandexMoneyImpl implements YandexMoney {

    private final TokenRequester tokenRequester;
    private final ApiCommandsFacade apiCommandsFacade;

    /**
     * ??????? ??????????? ????????. ?????? ???????????? httpClient
     * ?? SingleClientConnManager ? ????????? 60 ???????. ??? ???? ???????? ?????
     * ?????? ??????????? ?????? ????????????.
     *
     * @param clientId ????????????? ??????????? ? ????????? ???????.??????
     */
    public YandexMoneyImpl(String clientId) {
        this(clientId, YamoneyApiClient.createHttpClient(60100));
    }

    /**
     * ??????? ??????????? ????????. ?????? ???????????? httpClient
     * ?? ??????????? ? ?????????? ConnectionManager ? HttpParams. ??? ?????
     * ???? ????? ???? ??????????? ????????????? ???????????.
     *
     * @param clientId ????????????? ??????????? ? ????????? ???????.??????
     * @param client   ???????????? httpClient ?? ??????????????? ?????? ???????? ? ?????????
     */
    public YandexMoneyImpl(final String clientId, HttpClient client) {
        this.tokenRequester = new TokenRequesterImpl(clientId, client);
        this.apiCommandsFacade = new ApiCommandsFacadeImpl(client);
    }

    @Override
    public String getClientId() {
        return tokenRequester.getClientId();
    }

    @Override
    public String authorizeUri(Collection<Permission> permissions, String redirectUri, Boolean mobileMode) {
        return tokenRequester.authorizeUri(permissions, redirectUri, mobileMode);
    }

    @Override
    public String authorizeUri(String scope, String redirectUri, Boolean mobileMode) {
        return tokenRequester.authorizeUri(scope, redirectUri, mobileMode);
    }

    @Override
    public ReceiveOAuthTokenResponse receiveOAuthToken(String code,
                                                       String redirectUri) throws IOException {
        return tokenRequester.receiveOAuthToken(code, redirectUri);
    }

    @Override
    public ReceiveOAuthTokenResponse receiveOAuthToken(String code,
                                                       String redirectUri, String clientSecret) throws IOException {
        return tokenRequester.receiveOAuthToken(code, redirectUri, clientSecret);
    }

    @Override
    public void revokeOAuthToken(String accessToken) throws InvalidTokenException, IOException {
        apiCommandsFacade.revokeOAuthToken(accessToken);
    }

    @Override
    public AccountInfoResponse accountInfo(String accessToken)
            throws IOException, InvalidTokenException, InsufficientScopeException {
        return apiCommandsFacade.accountInfo(accessToken);
    }

    @Override
    public OperationHistoryResponse operationHistory(String accessToken)
            throws IOException, InvalidTokenException, InsufficientScopeException {
        return apiCommandsFacade.operationHistory(accessToken);
    }

    @Override
    public OperationHistoryResponse operationHistory(String accessToken, Integer startRecord)
            throws IOException, InvalidTokenException, InsufficientScopeException {
        return operationHistory(accessToken, startRecord, null);
    }

    @Override
    public OperationHistoryResponse operationHistory(String accessToken,
                                                     Integer startRecord, Integer records) throws IOException,
            InvalidTokenException, InsufficientScopeException {
        return operationHistory(accessToken, startRecord, records, null);
    }

    @Override
    public OperationHistoryResponse operationHistory(String accessToken,
                                                     Integer startRecord, Integer records,
                                                     Set<OperationHistoryType> operationsType) throws IOException,
            InvalidTokenException, InsufficientScopeException {

        return apiCommandsFacade.operationHistory(accessToken, startRecord, records, operationsType);
    }

    @Override
    public OperationHistoryResponse operationHistory(String accessToken, Integer startRecord, Integer records,
                                                     Set<OperationHistoryType> operationsType, Boolean fetchDetails,
                                                     Date from, Date till, String label)
            throws IOException, InvalidTokenException, InsufficientScopeException {

        return apiCommandsFacade.operationHistory(accessToken, startRecord, records, operationsType, fetchDetails, from, till, label);
    }

    @Override
    public FundraisingStatsResponse fundraisingStats(String accessToken, String label) throws IOException, InvalidTokenException, InsufficientScopeException {
        return apiCommandsFacade.fundraisingStats(accessToken, label);
    }

    @Override
    public OperationDetailResponse operationDetail(String accessToken,
                                                   String operationId) throws IOException, InvalidTokenException,
            InsufficientScopeException {

        return apiCommandsFacade.operationDetail(accessToken, operationId);
    }

    @Override
    public RequestPaymentResponse requestPaymentP2PDue(String accessToken, String to, IdentifierType identifierType,
                                                       BigDecimal amountDue, String comment, String message, String label)
            throws IOException, InvalidTokenException, InsufficientScopeException {

        return apiCommandsFacade.requestPaymentP2PDue(accessToken, to, identifierType, amountDue, comment, message, label);
    }

    @Override
    public RequestPaymentResponse requestPaymentP2P(String accessToken, String to, IdentifierType identifierType,
                                                    BigDecimal amount, String comment, String message, String label)
            throws IOException, InvalidTokenException, InsufficientScopeException {

        return apiCommandsFacade.requestPaymentP2P(accessToken, to, identifierType, amount, comment, message, label);
    }

    @Override
    public RequestPaymentResponse requestPaymentP2P(String accessToken, String to, BigDecimal amount,
                                                    String comment, String message)
            throws IOException, InvalidTokenException, InsufficientScopeException {

        return apiCommandsFacade.requestPaymentP2P(accessToken, to, amount, comment, message);
    }

    @Override
    public RequestPaymentResponse requestPaymentToPhone(String accessToken, String phone, BigDecimal amount)
            throws InsufficientScopeException, InvalidTokenException, IOException {
        return apiCommandsFacade.requestPaymentToPhone(accessToken, phone, amount);
    }

    @Override
    public RequestPaymentResponse requestPaymentShop(String accessToken,
                                                     String patternId, Map<String, String> params) throws IOException,
            InvalidTokenException, InsufficientScopeException {

        return apiCommandsFacade.requestPaymentShop(accessToken, patternId, params);
    }

    @Override
    public ProcessPaymentResponse processPaymentByWallet(String accessToken,
                                                         String requestId) throws IOException, InsufficientScopeException,
            InvalidTokenException {
        return apiCommandsFacade.processPaymentByWallet(accessToken, requestId);
    }

    @Override
    public ProcessPaymentResponse processPaymentByCard(String accessToken, String requestId, String csc)
            throws IOException, InsufficientScopeException, InvalidTokenException {

        return apiCommandsFacade.processPaymentByCard(accessToken, requestId, csc);
    }

    @Override
    public String makeScope(Collection<Permission> permissions) {
        return tokenRequester.makeScope(permissions);
    }

    @Override
    public RequestPaymentResponse requestPaymentShop(String accessToken, String patternId,
                                                     Map<String, String> params,
                                                     boolean showContractDetails) throws IOException,
            InvalidTokenException, InsufficientScopeException {
        return apiCommandsFacade.requestPaymentShop(accessToken, patternId, params, showContractDetails);
    }
}




Java Source Code List

com.samples.client.Settings.java
com.samples.server.SampleIncomingTransferListener.java
com.samples.server.ServletListener.java
com.samples.yamodroid.Consts.java
com.samples.yamodroid.GreatAppActivity.java
ru.yandex.money.api.ApiCommandsFacadeImpl.java
ru.yandex.money.api.ApiCommandsFacade.java
ru.yandex.money.api.CommandUrlHolder.java
ru.yandex.money.api.InsufficientScopeException.java
ru.yandex.money.api.InternalServerErrorException.java
ru.yandex.money.api.InvalidTokenException.java
ru.yandex.money.api.ProtocolRequestException.java
ru.yandex.money.api.TestUrlHolder.java
ru.yandex.money.api.TokenRequesterImpl.java
ru.yandex.money.api.TokenRequester.java
ru.yandex.money.api.YamoneyAccount.java
ru.yandex.money.api.YamoneyApiClient.java
ru.yandex.money.api.YandexMoneyImpl.java
ru.yandex.money.api.YandexMoney.java
ru.yandex.money.api.enums.Destination.java
ru.yandex.money.api.enums.MoneyDirection.java
ru.yandex.money.api.enums.MoneySource.java
ru.yandex.money.api.enums.OperationHistoryType.java
ru.yandex.money.api.enums.Status.java
ru.yandex.money.api.notifications.IncomingTransferListener.java
ru.yandex.money.api.notifications.IncomingTransfer.java
ru.yandex.money.api.notifications.NotificationUtils.java
ru.yandex.money.api.notifications.NotificationsServlet.java
ru.yandex.money.api.response.AccountInfoResponse.java
ru.yandex.money.api.response.FundraisingStatsResponse.java
ru.yandex.money.api.response.OperationDetailResponse.java
ru.yandex.money.api.response.OperationHistoryResponse.java
ru.yandex.money.api.response.ProcessPaymentResponse.java
ru.yandex.money.api.response.ReceiveOAuthTokenResponse.java
ru.yandex.money.api.response.RequestPaymentResponse.java
ru.yandex.money.api.response.util.OperationHistoryError.java
ru.yandex.money.api.response.util.Operation.java
ru.yandex.money.api.response.util.PaymentErrorCode.java
ru.yandex.money.api.response.util.ProcessPaymentError.java
ru.yandex.money.api.response.util.RequestPaymentError.java
ru.yandex.money.api.response.util.money.PaymentMethods.java
ru.yandex.money.api.rights.AbstractLimitedPermission.java
ru.yandex.money.api.rights.AbstractPermission.java
ru.yandex.money.api.rights.AccountInfo.java
ru.yandex.money.api.rights.IdentifierType.java
ru.yandex.money.api.rights.MoneySource.java
ru.yandex.money.api.rights.OperationDetails.java
ru.yandex.money.api.rights.OperationHistory.java
ru.yandex.money.api.rights.PaymentP2P.java
ru.yandex.money.api.rights.PaymentShop.java
ru.yandex.money.api.rights.Payment.java
ru.yandex.money.api.rights.Permission.java
ru.yandex.money.droid.ActivityParams.java
ru.yandex.money.droid.AuthActivity.java
ru.yandex.money.droid.Consts.java
ru.yandex.money.droid.DetailHistoryActivity.java
ru.yandex.money.droid.HistoryActivity.java
ru.yandex.money.droid.HistoryAdapter.java
ru.yandex.money.droid.IntentCreator.java
ru.yandex.money.droid.LoadHistoryTask.java
ru.yandex.money.droid.PaymentActivity.java
ru.yandex.money.droid.PaymentConfirmActivity.java
ru.yandex.money.droid.PaymentShopParcelable.java
ru.yandex.money.droid.ProcessPaymentTask.java
ru.yandex.money.droid.Utils.java
ru.yandex.money.droid.YandexMoneyDroid.java