Authorize.net Maven 依赖与 YaHP Pdf 创建者冲突

Authorize.net maven dependency conflict with YaHP Pdf creator

我正在做一个使用的项目:

  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 初始化的片段代码:

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 !

令人惊讶,但事实确实如此。

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

我注意到一个奇怪的场景是更改实际工作的 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>