我正在尝试使用Ruby条带API添加银行帐户。但它会出现条带错误"缺少必需的参数:类型"。
我正在使用以下ruby代码:
public class MultiselectAdapter extends ArrayAdapter<String> implements CompoundButton.OnCheckedChangeListener{
private final LayoutInflater mInflater;
private final Context mContext;
private final List<TeamModel> items = null;
private final int mResource;
SparseBooleanArray mCheckStates;
public String[] teamIDValues;
ArrayList<Object> ListObject;
public MultiselectAdapter(@NonNull Context context, @LayoutRes int resource,
@NonNull ArrayList objects ){
super(context, resource, 0, objects);
mContext = context;
mInflater = LayoutInflater.from(context);
mResource = resource;
ListObject = objects;
mCheckStates = new SparseBooleanArray(ListObject.size());
System.out.println("teh size vaooo --"+mCheckStates.size());
System.out.println("teh objects vaooo --"+objects.size());
}
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
mCheckStates.put((Integer) compoundButton.getTag(), isChecked);
}
static class ViewHolder {
protected TextView name;
protected TextView id;
protected CheckBox check;
}
@Override
public @NonNull View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
convertView = mInflater.inflate(mResource, null);
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.id = (TextView) convertView.findViewById(R.id.idval);
holder.check = (CheckBox) convertView.findViewById(R.id.choseboxes);
convertView.setTag(holder);
convertView.setTag(R.id.name, holder.name);
convertView.setTag(R.id.idval, holder.id);
convertView.setTag(R.id.choseboxes, holder.check);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.check.setTag(position);
holder.check.setChecked(mCheckStates.get(position, false));
holder.check.setOnCheckedChangeListener(this);
if(ListObject.get(position) instanceof TeamModel.Data)
{
// System.out.println("teh valus are--"+((TeamModel.Data) ListObject.get(position)).getDescription());
holder.name.setText(((TeamModel.Data) ListObject.get(position)).getDescription());
holder.id.setText(Integer.toString(((TeamModel.Data) ListObject.get(position)).getId()));
}
else if(ListObject.get(position) instanceof TeamModel.GroupData)
{
// System.out.println("teh valus are-geroup name--"+((TeamModel.GroupData) ListObject.get(position)).getCceTeamName());
holder.name.setText(((TeamModel.GroupData) ListObject.get(position)).getCceTeamName());
holder.id.setText(Integer.toString(((TeamModel.GroupData) ListObject.get(position)).getId()));
}
// holder.check.setChecked(items.get(position).isSelected());
return convertView;
}
public boolean isChecked(int position) {
return mCheckStates.get(position, false);
}
public void setChecked(int position, boolean isChecked) {
mCheckStates.put(position, isChecked);
}
public void toggle(int position) {
setChecked(position, !isChecked(position));
}
}
答案 0 :(得分:1)
您没有将适当的参数传递给API。
请查看此文档,了解Stripe返回的正确请求和响应。
https://stripe.com/docs/api?lang=ruby#create_account
require "stripe"
Stripe.api_key = "sk_test_bcd1234"
Stripe::Account.create(
:type => 'standard',
:country => 'US',
:email => 'bob@example.com'
)
指出你没有在外部哈希中传递:type
param。你需要把它移到第一级。
account = Stripe::Account.create(
{
:country => 'US',
:managed => true,
:type => 'individual', # Move this from nested to first level
:transfer_schedule => {
:interval => 'weekly',
:weekly_anchor => 'friday'
},
:legal_entity => {
:dob => {
:day => birthday.day,
:month => birthday.month,
:year => birthday.year
},
:first_name => first_name,
:last_name => last_name
},
:tos_acceptance => {
:date => Time.now.to_i,
:ip => request.remote_ip
}
}
)