Pending resolution process¶
Pending resolution is done by going through the list of payments and checking the status of each payment. If there is a payment with a pending status, an attempt is made to resolve this pending issue and at the end, inform the result. More details can be found in demo-payments-android.
Example¶
private void doSolvePend(PaymentClient paymentClient) {
try {
List<Payment> paymentList;
Boolean pendingsFound = false;
PaymentProviderRequest request = new PaymentProviderRequest(CredentialsUtils.getMyAppInfo(this.getPackageManager(), this.getPackageName()), new Date());
request.setColumns(new String[]{
PaymentContract.column.ID,
PaymentContract.column.PAYMENT_STATUS
});
paymentList = PaymentProviderApi.create(this).findAll(request);
for (final Payment payment : paymentList) {
if (payment.getPaymentStatus() == PaymentStatus.PENDING) {
pendingsFound = true;
PaymentDomain pd = new PaymentDomain(paymentClient, this);
pd.doConfirmPayment(payment.getPaymentId());
}
}
if (pendingsFound) {
Toast.makeText(getApplicationContext(), getString("Todas as pendencias foram resolvidas!"), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), getString("Nenhuma pendencia encontrada!"), Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
}
}