You are here

function commerce_payleap_server_url in Commerce Payleap 7

Returns the URL to the PayLeap server determined by transaction mode.

Parameters

$txn_mode: The transaction mode that relates to the production or test server.

$txn_payleap_type: The transaction type that relate to transaction steps or results.

Return value

string The URL to use to submit requests to the PayLeap server.

1 call to commerce_payleap_server_url()
commerce_payleap_request in ./commerce_payleap.module
Submits a request to PayLeap.

File

./commerce_payleap.module, line 575
Implements PayLeap payment services for use in Drupal Commerce.

Code

function commerce_payleap_server_url($txn_mode, $txn_payleap_type) {
  switch ($txn_payleap_type) {
    case PAYLEAP_TXN_TYPE_DIRECT_CAPTURE:
    case PAYLEAP_TXN_TYPE_DELAYED_CAPTURE:
    case PAYLEAP_TXN_TYPE_VOID:
    case PAYLEAP_TXN_TYPE_FORCE:
      $service = 'TransactServices.svc/ProcessCreditCard';
      break;
    case PAYLEAP_TXN_TYPE_RECURRING_CAPTURE:
      $service = 'MerchantServices.svc/ProcessCreditCard';
      break;
    case PAYLEAP_TXN_TYPE_MANAGECREDITCARDINFO:
      $service = 'MerchantServices.svc/ManageCreditCardInfo';
      break;
    case PAYLEAP_TXN_TYPE_ADDRECURRINGCREDITCARD:
      $service = 'MerchantServices.svc/AddRecurringCreditCard';
      break;
    case PAYLEAP_TXN_TYPE_MANAGECUSTOMER:
      $service = 'MerchantServices.svc/ManageCustomer';
      break;
    case PAYLEAP_TXN_TYPE_MANAGECONTRACT:
      $service = 'MerchantServices.svc/ManageContract';
      break;
    default:
      $service = '';
      break;
  }
  switch ($txn_mode) {
    case PAYLEAP_TXN_MODE_PRODUCTION:
      return 'https://secure1.payleap.com/' . $service;
    case PAYLEAP_TXN_MODE_TEST:
      return 'https://uat.payleap.com/' . $service;
  }
}