0

我正在开发一个使用以下项目的项目:

  1. Authorize.net 作为支付网关和
  2. YaHP 转换器将 HTML 页面转换为 PDF

    以下是我的 pom 部分 YaHP 依赖项:

    <dependency>
        <groupId>com.google.code.maven-play-plugin.org.allcolor.yahp</groupId>
        <artifactId>yahp-internal</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>org.xhtmlrenderer</groupId>
        <artifactId>core-renderer</artifactId>
        <version>R8pre2</version>
    </dependency>
    <dependency>
        <groupId>com.lowagie</groupId>
        <artifactId>itext</artifactId>
        <version>2.1.7</version>
    </dependency>
    <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>net.sf.jtidy</groupId>
        <artifactId>jtidy</artifactId>
        <version>r938</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.maven-play-plugin.org.allcolor.shanidom</groupId>
        <artifactId>shani-parser</artifactId>
        <version>1.4.17-patched-yahp-1.3</version>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>2.0.2</version>
    </dependency>
    
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.11.0</version>
    </dependency> 
    

这是 Authorize.net 依赖项:

    <dependency>
        <groupId>net.authorize</groupId>
        <artifactId>anet-java-sdk</artifactId>
        <version>1.9.3</version>
    </dependency>

我面临的问题是,YaHP 特定的库在 Authorize.net 初始化中造成了一些未知的问题。

这是 Authorize.net 的片段代码 ff 初始化:

GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
    apiRequest.setTransactionRequest(txnRequest);
    apiRequest.setHostedPaymentSettings(alist);

    GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
    controller.execute();

    GetHostedPaymentPageResponse response = new GetHostedPaymentPageResponse();
    response = controller.getApiResponse();
    if (response != null) {
        if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {

            System.out.println(response.getMessages().getMessage().get(0).getCode());
            System.out.println(response.getMessages().getMessage().get(0).getText());
            System.out.println("Payment request token :" + response.getToken());
            return response.getToken();
        } else {
            System.out.println("Failed to get hosted payment page " + response.getMessages().getResultCode());

        }
    } else {
        System.out.println("ess" + response);
    }

每当我在 pom.xml 中评论 YaHP 相关的特定部分时,我都会在我的GetHostedPaymentPageResponse 响应对象中获得一个响应令牌。但是当我取消注释这些依赖项时,它会抛出一个null

令人惊讶,但这确实是事实。

谁能告诉我如何使两者兼容或至少找到解决方法?

4

1 回答 1

0

我注意到一个奇怪的场景是改变实际工作的 Maven 依赖项的顺序并提供所需的令牌。

除此之外,iText 依赖版本也引起了问题。调整它使一切都走上了幸福的道路。

这是我的 pom.xml

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
</dependency>
<dependency>
    <groupId>net.sf.jtidy</groupId>
    <artifactId>jtidy</artifactId>
    <version>r938</version>
</dependency>
<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.11.0</version>
</dependency>
<dependency>
    <groupId>jaxen</groupId>
    <artifactId>jaxen</artifactId>
    <version>1.1.1</version>
</dependency>
<dependency>
    <groupId>com.lowagie</groupId>
    <artifactId>itext</artifactId>
    <version>2.0.1</version>
</dependency>
<dependency>
    <groupId>org.xhtmlrenderer</groupId>
    <artifactId>core-renderer</artifactId>
    <version>R8pre2</version>
</dependency>
<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>2.0.2</version>
</dependency>
<dependency>
    <groupId>com.google.code.maven-play-plugin.org.allcolor.shanidom</groupId>
    <artifactId>shani-parser</artifactId>
    <version>1.4.17-patched-yahp-1.3</version>
</dependency>
<dependency>
    <groupId>com.google.code.maven-play-plugin.org.allcolor.yahp</groupId>
    <artifactId>yahp-internal</artifactId>
    <version>1.3</version>
</dependency>
于 2018-03-16T11:32:31.763 回答