如何通过QBMS Java API在托管模式下处理信用卡

时间:2014-04-11 05:04:11

标签: intuit-partner-platform

我修改了提供的示例here,但它不适用于托管应用。 显然问题是连接票,不应该从我的理解中使用。

以下是java类:

public class MyPayment {
    public static void main(String[] args) throws Exception{
        QbmsConfiguration qbmsConfiguration =new QbmsConfiguration("/qbmsconnector.properties");

        // Create a JAXB-backed QbmsConnector
        QbmsConnector qbmsConnector =new JaxbQbmsConnector(qbmsConfiguration);

        // Build a charge request...
        CreditCardChargeRequest request =new CreditCardChargeRequest();
        request.setCreditCardNumber("4111111111111111");
        request.setNameOnCard("John Doe");
        request.setExpirationMonth(12);
        request.setExpirationYear(2014);
        request.setAmount(130.00);

        // ...define a connection ticket...
        String connectionTicket ="TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX";

        // ...and make the payment.
        try{
          CreditCardChargeResponse response = qbmsConnector.creditCardCharge(connectionTicket, request);
          System.out.println(response);
        }catch(QbmsOperationException e){
          System.out.println("Payment failed: "+ e.getMessage());
          e.printStackTrace();
        }
    }
}

这是qbmsconnector.properties

qbmsconnector.applicationLogin=loginidxxxxxx
qbmsconnector.applicationId=123456789
qbmsconnector.environment=ptc
qbmsconnector.model=hosted
qbmsconnector.keyStoreLocation=/qbms
qbmsconnector.keyStorePassword=password111
qbmsconnector.certPassword=password111
qbmsconnector.certAlias=alias_abc

它会引发以下错误:

Payment failed: Application agent not found TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX
com.intuit.qbmsconnector.response.QbmsResponseStatusException: Application agent not found TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX
    at com.intuit.qbmsconnector.jaxb.JaxbResponseExtractor.processSignonNode(Unknown Source)
    at com.intuit.qbmsconnector.jaxb.JaxbResponseExtractor.unmarshal(Unknown Source)
    at com.intuit.qbmsconnector.jaxb.JaxbResponseExtractor.extractCreditCardChargeResponse(Unknown Source)
    at com.intuit.qbmsconnector.jaxb.JaxbQbmsConnector.creditCardCharge(Unknown Source)
    at qbo.MyPayment.main(MyPayment.java:30)

1 个答案:

答案 0 :(得分:0)

此错误:

Application agent not found TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX

通常表示1或2件事:

  • 您没有使用有效的连接票证(是您正在使用的实际连接票证,还是您的XXX连接票证?)

OR

  • 您正在使用有效的连接票证,但是您在错误的环境中使用它。在PTC环境中生成的连接票证与生产环境不起作用,反之亦然。您是否为PTC或生产生成了连接票证?