Program: 36263
Project: 36263
Buggy source:
private boolean initPaymentProcess(){
  String clientId=arguments.getClientId();
  OAuth2Session session=new OAuth2Session(new DefaultApiClient(clientId));
  process=new ExternalPaymentProcess(session,new ExternalPaymentProcess.ParameterProvider(){
    @Override public String getPatternId(){
      return arguments.getPatternId();
    }
    @Override public Map<String,String> getPaymentParameters(){
      return arguments.getParams();
    }
    @Override public MoneySource getMoneySource(){
      Fragment fragment=getCurrentFragment();
      return fragment instanceof CscFragment ? ((CscFragment)fragment).getMoneySource() : null;
    }
    @Override public String getCsc(){
      Fragment fragment=getCurrentFragment();
      return fragment instanceof CscFragment ? ((CscFragment)fragment).getCsc() : null;
    }
    @Override public String getExtAuthSuccessUri(){
      return PaymentArguments.EXT_AUTH_SUCCESS_URI;
    }
    @Override public String getExtAuthFailUri(){
      return PaymentArguments.EXT_AUTH_FAIL_URI;
    }
    @Override public boolean isRequestToken(){
      Fragment fragment=getCurrentFragment();
      return fragment instanceof SuccessFragment;
    }
  }
);
  final Prefs prefs=new Prefs(this);
  String instanceId=prefs.restoreInstanceId();
  if (TextUtils.isEmpty(instanceId)) {
    showProgressBar();
    try {
      session.enqueue(new InstanceId.Request(clientId),new OnResponseReady<InstanceId>(){
        @Override public void failure(        Exception exception){
          exception.printStackTrace();
          onOperationFailed();
        }
        @Override public void response(        InstanceId response){
          if (response.isSuccess()) {
            prefs.storeInstanceId(response.instanceId);
            process.setInstanceId(response.instanceId);
            proceed();
          }
 else {
            showError(response.error,response.status.code);
          }
          hideProgressBar();
        }
      }
);
    }
 catch (    IOException e) {
      onOperationFailed();
    }
    return false;
  }
  process.setInstanceId(instanceId);
  process.setCallbacks(new Callbacks());
  return true;
}

Fixed version (ground truth):
private boolean initPaymentProcess(){
  String clientId=arguments.getClientId();
  OAuth2Session session=new OAuth2Session(new DefaultApiClient(clientId));
  parameterProvider=new ExternalPaymentProcess.ParameterProvider(){
    @Override public String getPatternId(){
      return arguments.getPatternId();
    }
    @Override public Map<String,String> getPaymentParameters(){
      return arguments.getParams();
    }
    @Override public MoneySource getMoneySource(){
      return selectedCard;
    }
    @Override public String getCsc(){
      Fragment fragment=getCurrentFragment();
      return fragment instanceof CscFragment ? ((CscFragment)fragment).getCsc() : null;
    }
    @Override public String getExtAuthSuccessUri(){
      return PaymentArguments.EXT_AUTH_SUCCESS_URI;
    }
    @Override public String getExtAuthFailUri(){
      return PaymentArguments.EXT_AUTH_FAIL_URI;
    }
    @Override public boolean isRequestToken(){
      Fragment fragment=getCurrentFragment();
      return fragment instanceof SuccessFragment;
    }
  }
;
  process=new ExternalPaymentProcess(session,parameterProvider);
  final Prefs prefs=new Prefs(this);
  String instanceId=prefs.restoreInstanceId();
  if (TextUtils.isEmpty(instanceId)) {
    showProgressBar();
    try {
      session.enqueue(new InstanceId.Request(clientId),new OnResponseReady<InstanceId>(){
        @Override public void failure(        Exception exception){
          exception.printStackTrace();
          onOperationFailed();
        }
        @Override public void response(        InstanceId response){
          if (response.isSuccess()) {
            prefs.storeInstanceId(response.instanceId);
            process.setInstanceId(response.instanceId);
            proceed();
          }
 else {
            showError(response.error,response.status.code);
          }
          hideProgressBar();
        }
      }
);
    }
 catch (    IOException e) {
      onOperationFailed();
    }
    return false;
  }
  process.setInstanceId(instanceId);
  process.setCallbacks(new Callbacks());
  return true;
}