无法通过Poynt

时间:2018-05-24 15:31:16

标签: java android sdk pos

我正在开发Poynt POS系统的应用程序,我正在尝试集成自定义付款,如他们的示例所示here

在该示例中,在PaymentActivity.java中,有一些代码在收集付款时创建了一个意图,向其添加了一些额外的数据并发送它:

@Override
public void onFragmentInteraction(Transaction transaction, PoyntError error) {
    // Create intent to deliver some kind of result data
    Intent result = new Intent(Intents.ACTION_COLLECT_PAYMENT_RESULT);
    result.putExtra("transaction", transaction);
    result.putExtra("error", error);
    result.putExtra("test", true);
    if (error == null) {
        setResult(Activity.RESULT_OK, result);
    }else{
        setResult(Activity.RESULT_CANCELED, result);
    }
    finish();
}

回到开始Poynt Payment Fragment的活动中,有一个活动结果处理程序。此处理程序接受一个intent作为参数,但看起来这个intent与PaymentActivity中创建的意图不同:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        if (data != null) {
            Payment payment = data.getParcelableExtra(Intents.INTENT_EXTRAS_PAYMENT);
            Log.d("ConfigurationTest", "Received onPaymentAction from PaymentFragment w/ Status:" + payment.getStatus());

            if (payment.getTransactions() != null && payment.getTransactions().size() > 0) {
                Transaction transaction = payment.getTransactions().get(0);
                Gson gson = new GsonBuilder().setPrettyPrinting().create();
                Type transactionType = new TypeToken<Transaction>() {
                }.getType();
                //logReceivedMessage(gson.toJson(transaction, transactionType));
            }
        }
    }

    Boolean test = data.getBooleanExtra("test", false);
    Log.d("Sample", test.toString());   // this value will be false
}

数据参数没有test个额外字段。它也没有transactionerror。知道为什么会这样吗?

0 个答案:

没有答案