AnsweredAssumed Answered

how to get getCustomerPaymentProfileId from authorize.net

Question asked by Rodolfo Tuble on Jun 3, 2016

I am following this link https://github.com/AuthorizeNet/sample-code-php/blob/master/CustomerProfiles/get-customer-payment-profile.php

but it is meant for native PHP and I want to know how do I convert it to be suitable for SugarCRM?

 

This is my code at the moment:

 

<?php
require_once("include/MVC/View/views/view.detail.php");
use CB\Integrations\Provider\AuthorizeNet;

class CB_PaymentProfilesViewDetail extends ViewDetail
{
   var $contacts_warning;
   var $company_logo_path;
   var $company_tagline;
   var $provider;
   public function __construct()
   {
   global $sugar_config;
   $settings = $sugar_config["authorizenet_settings"];
   $this->provider = new AuthorizeNet();
   $this->provider->auth($settings["appName"], $settings["transactionKey"]);
   parent::ViewDetail();
   }
   function preDisplay() {
   $this->contacts_warning = 'Our contacts database is not for personal use. Please do not use it for things not strictly related to company business. You know who you are!';

   $this->company_tagline = 'Serving the biggest and brightest stars in Hollywood!';
   parent::preDisplay();
   }
   public function display()
   {

   $this->provider->setCustomerProfileId(40843288);
   echo '<div align="center" style="font-color: red">'.$this->provider->getCustomerPaymentProfileId() .'</div>';
   if ($this->bean->name) {
   $this->dv->defs['templateMeta']['form']['buttons'][] = array(
   "customCode" => '{$CUSTOMER_PROFILE}'
   );
   $this->ss->assign('CUSTOMER_PROFILE',
   $this->bean->provider->getHostedProfilePageButton($this->bean->name)
   );
   }
   parent::display();
   }
}

Outcomes