コード例 #1
0
 /**
  * Get Market code from country traits
  * Otherwise default to static definition
  *
  * @param $market_id
  * @return mixed
  */
 public static function byMarket($market_id)
 {
     $trait = ClassRegistry::init('TraitCountry');
     $trait->getDataSource()->reconnect();
     $merchant = $trait->getTrait($market_id, 'world_pay_merchant_code');
     if (!empty($merchant)) {
         return $merchant;
     } else {
         return WorldPayMerchant::byMarketId($market_id);
     }
 }
コード例 #2
0
ファイル: WorldPay.php プロジェクト: kameshwariv/testexample
 /**
  * Initialize World Pay
  *
  * Create defines in bootstrap for PROD/TEST
  * @param $options
  */
 public function initialize($options)
 {
     if (empty($options['secret'])) {
         if (defined('WORLD_PAY_SECRET')) {
             $this->secret = WORLD_PAY_SECRET;
         }
     } else {
         $this->secret = $options['secret'];
     }
     if (!empty($options['test_mode'])) {
         $this->test_mode = $options['test_mode'];
         $options['user_agent'] = 'Mozilla/5.0';
     }
     /**
      * Setup Merchant Market
      */
     if (empty($options['market_id'])) {
         $mid = 1;
     } else {
         $mid = $options['market_id'];
     }
     if (empty($options['merchant_code'])) {
         $options['merchant_code'] = WorldPayMerchant::byMarket($mid);
     }
     if ($mid == 7 && isset($options['alt_method'])) {
         if (empty($options['alt_merchant_code'])) {
             $options['alt_merchant_code'] = WorldPayMerchant::byMarketAlternative($mid);
         }
     }
     if (YOUNIQUE_TESTSERVER == TRUE) {
         if (empty($options['test_mode'])) {
             $this->test_mode = true;
         }
         if ($options['market_id'] == 1) {
             $options['merchant_code'] = 'YOUNIQUETEST';
         }
     }
     /** In world pay merchant codes are set as the username */
     if (isset($options['alt_method'])) {
         $this->username = $options['alt_merchant_code'];
     } else {
         $this->username = $options['merchant_code'];
     }
     $this->xml = new WorldPayXML($options);
 }