申请开通功能

@param accessToken     accessToken
@param accountRegister accountRegister
@return result
548503
public static AccountRegisterResult accountRegister(String accessToken,
                                                        AccountRegister accountRegister) {
        return accountRegister(accessToken,
                JsonUtil.toJSONString(accountRegister));
    }
827414
private RegistryAuth authForAccessToken(final AccessToken accessToken) {
    return RegistryAuth.builder()
        .username("oauth2accesstoken")
        .password(accessToken.getTokenValue())
        .build();
  }
1165040
public static UpdateResult update(String accessToken,
			UpdateGroupon updateGroupon) {
		return update(accessToken, JsonUtil.toJSONString(updateGroupon));
	}
436542
public ServerAccessToken createAccessToken(AccessTokenRegistration reg)
		throws OAuthServiceException {
		ServerAccessToken token = new BearerAccessToken(reg.getClient(), 3600L);
		
		List<String> scope = reg.getApprovedScope().isEmpty() ? reg.getRequestedScope() 
				                                              : reg.getApprovedScope();
		token.setScopes(convertScopeToPermissions(reg.getClient(), scope));
		token.setSubject(reg.getSubject());
		token.setGrantType(reg.getGrantType());
		
		at = token;
		
		return token;
	}
1133870
public Credential setAccessToken(String accessToken) {
    lock.lock();
    try {
      this.accessToken = accessToken;
    } finally {
      lock.unlock();
    }
    return this;
  }
28825
public static UpdateResult update(String accessToken,
			UpdateGeneralCoupon updateGeneralCoupon) {
		return update(accessToken, JsonUtil.toJSONString(updateGeneralCoupon));
	}
863748
public DConnection findByAccessToken(java.lang.String accessToken) {
    return queryUniqueByField(null, DConnectionMapper.Field.ACCESSTOKEN.getFieldName(), accessToken);
  }
565045
@SuppressWarnings("boxing")
    public OAuth1Token getAccessToken(OAuth1RequestToken oAuthRequestToken, String verifier) {
        OAuth10aService service = new ServiceBuilder(apiKey)
                .apiSecret(sharedSecret)
                .build(FlickrApi.instance());

        // Flickr seems to return invalid token sometimes so retry a few times.
        // See http://www.flickr.com/groups/api/discuss/72157628028927244/
        OAuth1Token accessToken = null;
        boolean success = false;
        for (int i = 0; i < maxGetTokenRetries && !success; i++) {
            try {
                accessToken = service.getAccessToken(oAuthRequestToken, verifier);
                success = true;
            } catch (OAuthException | IOException | InterruptedException | ExecutionException e) {
                if (i == maxGetTokenRetries - 1) {
                    logger.error(String.format("OAuthService.getAccessToken failing after %d tries, re-throwing exception", i), e);
                    throw new FlickrRuntimeException(e);
                } else {
                    logger.warn(String.format("OAuthService.getAccessToken failed, try number %d: %s", i, e.getMessage()));
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException ie) {
                        // Do nothing
                    }
                }
            }
        }

        return accessToken;
    }
1308502
public static CreateResult create(String accessToken, CashCard cashCard) {
		Create<CashCard> card = new Create<CashCard>();
		card.setCard(cashCard);
		return create(accessToken, card);
	}
565342
public synchronized void refreshWithToken(String clientToken, String accessToken) throws AuthenticationException {
		authResult = authenticationService.refresh(Objects.requireNonNull(clientToken), Objects.requireNonNull(accessToken));
	}
749462
public static CreateResult create(String accessToken, DiscountCard discountCard) {
		Create<DiscountCard> card = new Create<DiscountCard>();
		card.setCard(discountCard);
		return create(accessToken, card);
	}
1245133
public static UserGetCardListResult userGetCardList(String accessToken,
			UserGetCardList userGetCardList) {
		return userGetCardList(accessToken,
				JsonUtil.toJSONString(userGetCardList));
	}
715604
public static GetResult<?> getByCardId(String accessToken, String cardId) {
		return get(accessToken, String.format("{\"card_id\": \"%s\"}", cardId));
	}
308414
public static GetResult<?> get(String accessToken, String postJson) {
		HttpUriRequest httpUriRequest = RequestBuilder
				.post()
				.setHeader(jsonHeader)
				.setUri(BASE_URI + "/card/get")
				.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(accessToken))
				.setEntity(new StringEntity(postJson, Charset.forName("utf-8")))
				.build();
		AbstractResult abs = LocalHttpClient.executeJsonResult(httpUriRequest, AbstractResult.class);
		if (!abs.isSuccess()) {
			return abs;
		}

		GetResult<?> result = abs;
		CardType cardType = CardType.valueOf(abs.getCard().getCardType().toUpperCase());
		Class<? extends GetResult<?>> clazz = null;
		switch (cardType) {
		case CASH:
			clazz = GetCashResult.class;
			break;
		case DISCOUNT:
			clazz = GetDiscountResult.class;
			break;
		case GENERAL_COUPON:
			clazz = GetGeneralCouponResult.class;
			break;
		case GROUPON:
			clazz = GetGrouponResult.class;
			break;
		// ...其它卡券类型
		default:
			break;
		}
		if (null != clazz) {
			result = LocalHttpClient.executeJsonResult(httpUriRequest, clazz);
		}
		return result;
	}
965538
public static BatchGetResult batchGet(String accessToken, BatchGet batchget) {
		return batchGet(accessToken, JsonUtil.toJSONString(batchget));
	}
774037
public static ShopGetResult shopGet(String accessToken, ShopInfo shopInfo) {
        return shopGet(accessToken, JsonUtil.toJSONString(shopInfo));
    }
545531
private String getRefreshToken(Token accessToken) {
    JSONObject rawJson = JSONObject.fromObject(accessToken.getRawResponse());
    return rawJson.getString("refresh_token");
  }