您好我正在尝试使用accept sdk从authorize.net获取令牌。
当我输入错误的信用卡号onEncryptionFailed被调用但是当一切正常时,onEncryptionFinished没有被调用。
我从https://github.com/AuthorizeNet/accept-sample-android
获取了代码给出了androidstudio。但我在日食中这样做。我从图书馆拿了罐子并将它们安装在maven中。
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);
/*
build an Accept SDK Api client to make API calls.
parameters:
1) Context - current context
2) AcceptSDKApiClient.Environment - Authorize.net ENVIRONMENT
*/
try {
apiClient = new AcceptSDKApiClient.Builder(this,
AcceptSDKApiClient.Environment.SANDBOX).connectionTimeout(
4000) // optional connection time out in milliseconds
.build();
} catch (NullPointerException e) {
e.printStackTrace();
}
progressDialog = ProgressDialog.show(this, "Loading",
"Progress", true);
try {
EncryptTransactionObject transactionObject = prepareTransactionObject();
/*
Make a call to get Token API
parameters:
1) EncryptTransactionObject - The transactionObject for the current transaction
2) callback - callback of transaction
*/
apiClient.getTokenWithRequest(transactionObject, this);
} catch (NullPointerException e) {
// Handle exception transactionObject or callback is null.
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
if (progressDialog.isShowing()) progressDialog.dismiss();
e.printStackTrace();
}