Authorize.net支持GraalVM吗?
创始人
2024-09-22 16:01:02
0

暂无官方文档显示Authorize.net直接支持GraalVM,但是可以通过使用支持Java的GraalVM,将Authorize.net Java SDK添加到GraalVM项目中,从而实现与Authorize.net的交互。以下是附加到GraalVM项目的Java代码示例:

import net.authorize.sim.MessageHandler;
import net.authorize.Environment;
import net.authorize.api.contract.v1.*;
import net.authorize.api.controller.*;
import net.authorize.api.controller.base.*;
import net.authorize.data.xml.reporting.TransactionDetails;
import net.authorize.reporting.reportingapi.*;

import java.math.BigDecimal;

public class AuthorizeNetExample {

    public static void main(String[] args) {

        final String apiLoginID = "YOUR_API_LOGIN_ID";
        final String transactionKey = "YOUR_TRANSACTION_KEY";

        // COMMON API VARIABLES
        String apiEndPoint = Environment.SANDBOX.getXmlValue();
        ApiOperationBase.setEnvironment(Environment.SANDBOX);

        // CREATE CUSTOMER PROFILE
        CreateCustomerProfileResponseType responseCreateCustomer = createAuthorizeNetCustomerProfile(apiLoginID, transactionKey, apiEndPoint);

        if (responseCreateCustomer != null) {

            String customerProfileId = responseCreateCustomer.getCustomerProfileId();
            String customerPaymentProfileId = responseCreateCustomer.getCustomerPaymentProfileIdList().get(0);

            // PROCESS CREDIT CARD CHARGE
            ChargeCreditCardResponseType responseChargeCreditCard = chargeAuthorizeNetCreditCard(apiLoginID, transactionKey, customerProfileId, customerPaymentProfileId, new BigDecimal("1.00"), apiEndPoint);

            if (responseChargeCreditCard != null) {

                String transactionId = responseChargeCreditCard.getTransactionResponse().getTransId();

                // GET TRANSACTION DETAILS WITH REPORTING API
                ReportTransactionResponseType responseReportTransaction = reportTransaction(apiLoginID, transactionKey, transactionId, apiEndPoint);

                if (responseReportTransaction != null) {
                    TransactionDetails transactionDetails = responseReportTransaction.getTransaction().getTransactionDetails();

                    // OUTPUT TRANSACTION DETAILS
                    System.out.println("Transaction Id: " + transactionDetails.getTransId());
                    System.out.println("Transaction Status: " + transactionDetails.getTransactionStatus());
                    System.out.println("Amount Charged: " + transactionDetails.getSettleAmount().toString());
                    System.out.println("Approval Code: " + transactionDetails.getAuthCode());
                }
            }
        }
    }

    public static CreateCustomerProfileResponseType createAuthorizeNetCustomerProfile(String apiLoginID, String transactionKey, String apiEndPoint) {
        MerchantAuthenticationType merchantAuthenticationType  = getMerchantAuthenticationType(apiLoginID, transactionKey);

        CustomerProfileType customerProfileType = new CustomerProfileType();
        customerProfileType.setDescription("Java SDK Example");

        CreateCustomerProfile

相关内容

热门资讯

第8分钟实锤!德扑之星有猫腻(... 第8分钟实锤!德扑之星有猫腻(来玩德州app)一贯真的有挂(详细辅助2025新版教程)1、完成德扑之...
第六分钟实锤!德州之星辅助挂(... 第六分钟实锤!德州之星辅助挂(德扑之星)真是真的有挂(详细辅助透明教程)1、许多玩家不知道德州之星辅...
两分钟实锤!德扑之星辅助器购买... 两分钟实锤!德扑之星辅助器购买(德州扑克)其实存在有挂(详细辅助透明挂教程)1、进入游戏-大厅左侧-...
第9分钟实锤!智星德州菠萝有挂... 第9分钟实锤!智星德州菠萝有挂吗(来玩德州app)总是是有挂(详细辅助揭秘攻略)1、智星德州菠萝有挂...
第9分钟实锤!德州之星外挂(德... 第9分钟实锤!德州之星外挂(德州app)果然有挂(详细辅助规律教程)1、德州之星外挂透视辅助简单,德...
四分钟实锤!智星德州菠萝有挂吗... 四分钟实锤!智星德州菠萝有挂吗(手机德州)切实是有挂(详细辅助力荐教程)1、点击下载安装,智星德州菠...
第五分钟实锤!德州之星辅助挂(... 第五分钟实锤!德州之星辅助挂(德扑)果然存在有挂(详细辅助我来教教你)1、德州之星辅助挂系统规律教程...
9分钟实锤!德州AI智能辅助机... 9分钟实锤!德州AI智能辅助机器人(德州俱乐部)好像真的有挂(详细辅助必赢方法)1、点击下载安装,德...
六分钟实锤!德州AI智能辅助机... 六分钟实锤!德州AI智能辅助机器人(线上wpk德州)真是是真的有挂(详细辅助玩家教你)1、德州AI智...
6分钟实锤!德州ai辅助软件(... 6分钟实锤!德州ai辅助软件(德扑之星)都是存在有挂(详细辅助教你攻略)1、6分钟实锤!德州ai辅助...