【问题标题】:authorize net error 39 using cim library in codeigniter在 codeigniter 中使用 cim 库授权网络错误 39
【发布时间】:2015-03-28 08:22:22
【问题描述】:

每次我创建客户资料 ID 时,我都会从授权网获得以下响应,但没有重复,因为它是新创建的客户资料。由于我正在检索用户的电子邮件以创建 authorizenet 配置文件 ID,因此我已经检查了 mysql 数据库中的重复行,但没有。我正在使用 authorize.net 最新的 php sdk。

AuthorizeNetCIM_Response Object
(
    [xml] => SimpleXMLElement Object
        (
            [messages] => SimpleXMLElement Object
                (
                    [resultCode] => Error
                    [message] => SimpleXMLElement Object
                        (
                            [code] => E00039
                            [text] => A duplicate record with ID 31985206 already exists.
                        )

            )

        [customerPaymentProfileIdList] => SimpleXMLElement Object
            (
            )

        [customerShippingAddressIdList] => SimpleXMLElement Object
            (
            )

        [validationDirectResponseList] => SimpleXMLElement Object
            (
            )

    )

[response] => 

我在 Codeigniter 中使用电子邮件确认来创建 Authorizenet 客户 ID

 public function email_confirmation(){

    //passes the post user id variable to a local variable  
    $username=$this->uri->segment(3);

    //activate user account when confirmed
    $confirmation=$this->register_customer_model->user_confirms_email($username);
    //$confirmation = TRUE;

                         if($confirmation==TRUE){

                                 //load authorizenet model
                                 $this->load->model('authorizenet_model');

                                 //create authorizenet profile id
                                 $response=$this->authorizenet_model->create_authorizenet_profile_id($username);

                                 print_r($response);

}

这是使用用户名创建配置文件ID的授权网络模型

public function create_authorizenet_profile_id($username){

    //get email from username    
    $query=$this->db->query("
    SELECT email
    FROM   users
    WHERE  username='$username'");

   foreach ($query->result() as $row){
    $email                = $row->email;
                                     }

                                  //creates authorizenet profile id                                    
                                  $request                      = new AuthorizeNetCIM;
                                  $customerProfile              = new AuthorizeNetCustomer;
                                  $customerProfile->description = "Bar Express Customer";
                                  $customerProfile->email       = $email;

                                  $response = $request->createCustomerProfile($customerProfile);

                                  return $response;                                
                                                     }

【问题讨论】:

    标签: php mysql codeigniter authorize.net


    【解决方案1】:

    问题在于发出请求的顺序。应该是

    // Create new customer profile
    $customerProfile                     = new AuthorizeNetCustomer;
    $customerProfile->description        = "Description of customer";
    $customerProfile->merchantCustomerId = time();
    $customerProfile->email              = "test@domain.com";
    $response = $request->createCustomerProfile($customerProfile);
    if ($response->isOk()) {
        $customerProfileId = $response->getCustomerProfileId();
    }
    

    【讨论】:

      猜你喜欢
      • 2017-08-25
      • 2016-03-23
      • 1970-01-01
      • 2011-10-01
      • 2016-03-30
      • 1970-01-01
      • 1970-01-01
      • 2017-12-29
      • 2020-02-02
      相关资源
      最近更新 更多