0

I am using Drupal Commerce and the Commerce_authnet module to connected to Authorize.net. I have custom functionality which requires me to make a separate call to the Authorize.net CIM API. I have done so sucessfully by adding a submit handler to the Checkout button, catching the API Login and Key, and used those in my API calls.

$login = $form_state['values']['commerce_payment']['payment_methods']['authnet_aim|rules_authorize_net_aim_credit_card_test_association']['settings']['login'];
$key = $form_state['values']['commerce_payment']['payment_methods']['authnet_aim|rules_authorize_net_aim_credit_card_test_association']['settings']['tran_key'];
define("AUTHORIZENET_API_LOGIN_ID", $login);
define("AUTHORIZENET_TRANSACTION_KEY", $key);

However, I need to create a separate way of users updating their Authorize.net account settings from their user profile form. I have looked in the commerce database tables and in the drupal variable editor to see if I could pull it from the database, but I have not found where its stored. How can I access this data?

2 Answers 2

2

I'm assuming you're using the latest version of Commerce authnet.

Drupal Commerce payment system (as well as discounts, taxes..) is based in rules, you can see here how the settings form are included: http://cgit.drupalcode.org/commerce/tree/modules/payment/commerce_payment.rules.inc#n250 in the rules UI, so it is basically stored by rules in a rules_config object, specifically in the unserialized data column.

So if you want to see the settings in the database, you can go to rules_config table and check the data db field.

Modifying this from outside rules is another story, I've never done this, but I'm quite sure that rules doesn't provide an API to alter this data field, you'll probably need to use the Database API to access rules_config table and unserialize/serialize the data information to alter it.

It is probably advisable to find an alternative way to do this, i.e providing a new module that runs a slightly modified version of the charge callback of authnet (http://cgit.drupalcode.org/commerce_authnet/tree/commerce_authnet.module#n750)

0

I figured out how to retreive the credtials with this post https://stackoverflow.com/a/9996895/1015214.

You can get the rule machine name from the rules_config table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.