This method sets the shipping methods
 +options+ should be an array with hashes containing the following options:
 * name
 * price
 You may fill an some optional values as well:
 * currency (defaults to 'USD')
776116
def shipping_methods(methods)
      # We need to check that the necessary keys are in the hash,
      # Otherwise the error will happen in the middle of to_xml,
      # and the bug will be harder to track.
      
      methods.each do |method|
        missing_keys = [ :name, :price ].select { |key|
          !method.include? key
        }
        unless missing_keys.empty?
          raise ArgumentError,
          "Required keys missing: #{missing_keys.inspect}"
        end
      end
      
      @shipping_methods = methods
    end
113833
public function setAdaptivePaymentsOptions()
    {
        if ($this->mode == 'sandbox') {
            $this->config['api_url'] = 'https://svcs.sandbox.paypal.com/AdaptivePayments';
            $this->config['gateway_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
        } else {
            $this->config['api_url'] = 'https://svcs.paypal.com/AdaptivePayments';
            $this->config['gateway_url'] = 'https://www.paypal.com/cgi-bin/webscr';
        }
        $this->config['notify_url'] = config('paypal.notify_url');
    }
1013220
def install_money_getter attribute, options={}
      
      define_method :"#{attribute}_with_exchange_typecasting" do
        currency = evaluate_money_option(options[:currency]) if options[:currency]
        
        test_for_currency_error(currency, attribute)
        
        time     = evaluate_money_option(options[:at]) if options[:at]
        
        if value = send(:"#{attribute}_without_exchange_typecasting")
          Exchange::Money.new(value) do |c|
            c.currency = currency
            c.time     = time if time
          end
        end
      end
      exchange_typecasting_alias_method_chain attribute
      
    end
64499
public static function init(array $options = []) {
		// default options
		self::$defaut_options = [
			'language_code' => 'sm0',
			'locale_code' => 'en_CA.UTF-8',
			'timezone_code' => 'America/Toronto', // user timezone
			'server_timezone_code' => Application::get('php.date.timezone'),
			'format_date' => 'Y-m-d',
			'format_time' => 'H:i:s',
			'format_datetime' => 'Y-m-d H:i:s',
			'format_timestamp' => 'Y-m-d H:i:s.u',
			'format_amount_frm' => 20, // Amounts In Forms
			'format_amount_fs' => 40, // Amounts In Financial Statement
			'format_uom' => 'METRIC',
			// computed settings
			'locale_locales' => [], // list of locale codes
			'locale_locale_js' => null, // javascript locale name
			'locale_set_name' => null, // set locale
			'locale_options' => [], // localeconv() output would be stored here
			'locale_override_class' => null, // override class
			// symbols
			'symbols' => []
		];
		// settings from config files
		$config = Application::get('flag.global.format');
		// settings from user account
		$user_settings = User::get('internalization');
		if (!empty($user_settings)) {
			foreach ($user_settings as $k => $v) if (empty($v)) unset($user_settings[$k]);
		}
		// merge all of them together
		self::$options = array_merge_hard(self::$defaut_options, $config, \I18n::$options, $user_settings, $options);
		// fix utf8
		self::$options['locale_code'] = str_replace(['utf8', 'utf-8'], 'UTF-8', self::$options['locale_code']);
		// generate a list of available locales
		$locale_settings = self::setLocale(self::$options['locale_code'], self::$defaut_options['locale_code']);
		self::$options = array_merge_hard(self::$options, $locale_settings);
		// fix values
		self::$options['format_amount_frm'] = (int) self::$options['format_amount_frm'];
		self::$options['format_amount_fs'] = (int) self::$options['format_amount_fs'];
		self::$options['locale_options']['mon_thousands_sep'] = self::$options['locale_options']['mon_thousands_sep'] ?? ',';
		self::$options['locale_options']['mon_decimal_point'] = self::$options['locale_options']['mon_decimal_point'] ?? '.';
		if (empty(self::$options['locale_options']['mon_grouping'])) {
			self::$options['locale_options']['mon_grouping'] = [3, 3];
		}
		// load data from models
		if (!empty(self::$options['model'])) {
			foreach (self::$options['model'] as $k => $v) {
				$method = \Factory::method($v, null);
				self::$options['settings'][$k] = \Factory::model($method[0], true)->{$method[1]}();
			}
			unset(self::$options['model']);
		}
		// handle overrides
		if (!empty(self::$options['locale_override_class'])) {
			// push js format version to frontend
			$locale_override_class = self::$options['locale_override_class'];
			$locale_override_class::js();
			// preset symbols
			if (!empty($locale_override_class::$symbol_defaults)) {
				foreach ($locale_override_class::$symbol_defaults as $k => $v) {
					if (empty(self::$symbol_defaults[$k])) continue;
					self::${'symbol_' . $k} = $v;
				}
			}
		}
		// symbols
		foreach (self::$symbol_defaults as $k => $v) {
			self::$options['symbols'][$k] = self::${'symbol_' . $k};
		}
	}
224103
function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes, $total_count;

    // shipping adjustment
    switch (MODULE_SHIPPING_TABLE_MODE) {
      case ('price'):
        $order_total = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
        break;
      case ('weight'):
        $order_total = $shipping_weight;
        break;
      case ('item'):
        $order_total = $total_count - $_SESSION['cart']->free_shipping_items();
        break;
    }

    $order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;

    $table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
    $size = sizeof($table_cost);
    for ($i=0, $n=$size; $i<$n; $i+=2) {
      if (round($order_total,9) <= $table_cost[$i]) {
        if (strstr($table_cost[$i+1], '%')) {
          $shipping = ($table_cost[$i+1]/100) * $order_total_amount;
        } else {
          $shipping = $table_cost[$i+1];
        }
        break;
      }
    }

    if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
      $shipping = $shipping * $shipping_num_boxes;
      // show boxes if weight
      switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
        case (0):
        $show_box_weight = '';
        break;
        case (1):
        $show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
        break;
        case (2):
        $show_box_weight = ' (' . number_format($shipping_weight * $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
        break;
        default:
        $show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
        break;
      }
    }

    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
    'cost' => $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) ) ));

    if ($this->tax_class > 0) {
      $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    }

    if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

    return $this->quotes;
  }
863542
def trade(currency_code, price, amount, action, limit = nil, counter_currency_code = "jpy")
            currency_pair = currency_code + "_" + counter_currency_code
            params = {:currency_pair => currency_pair, :action => action, :price => price, :amount => amount}
            params.store(:limit, limit) if limit
            json = post_ssl(@zaif_trade_url, "trade", params)
            return json
        end
395572
def currency
      # Mixing currency not allowed; this
      # library can't convert between
      # currencies.
      currencies = @contents.map { |item| item[:currency] }.uniq || "USD"

      case currencies.count
        when 0
          "USD"
        when 1
          currencies.first
        else
          raise RuntimeError.new("Mixing currency not allowed")
      end

    end
774560
def option(key, *value)
      if value.empty?
        value = options[key]
        value = value[0] if value && value.size == 1
        value
      else
        options(key => value)
      end
    end
789922
public function getPaymentCurrencyOptions()
    { 
        // Create the base options
        $options = [
            [
                'value' => self::BASE_CURRENCY,
                'label' => __('Use Magento default')
            ],
            [
                'value' => self::ORDER_CURRENCY,
                'label' => __('Order currency')
            ],
            [
                'value' => self::CUSTOM_CURRENCY,
                'label' => __('Custom currency')
            ],
        ];

        // Return the options as array
        return $options;
    }
913932
private void setCurrencyForSymbols() {

        // Bug 4212072 Update the affix strings according to symbols in order to keep the
        // affix strings up to date.  [Richard/GCL]

        // With the introduction of the Currency object, the currency symbols in the DFS
        // object are ignored. For backward compatibility, we check any explicitly set DFS
        // object. If it is a default symbols object for its locale, we change the
        // currency object to one for that locale. If it is custom, we set the currency to
        // null.
        DecimalFormatSymbols def = new DecimalFormatSymbols(symbols.getULocale());

        if (symbols.getCurrencySymbol().equals(def.getCurrencySymbol())
                && symbols.getInternationalCurrencySymbol()
                       .equals(def.getInternationalCurrencySymbol())) {
            setCurrency(Currency.getInstance(symbols.getULocale()));
        } else {
            setCurrency(null);
        }
    }
1133986
def get_imports(self, option):
        
        if option:
            if len(option) == 1 and option[0].isupper() and len(option[0]) > 3:
                return getattr(settings, option[0])
            else:
                codes = [e for e in option if e.isupper() and len(e) == 3]
                if len(codes) != len(option):
                    raise ImproperlyConfigured("Invalid currency codes found: %s" % codes)
                return codes
        for attr in ('CURRENCIES', 'SHOP_CURRENCIES'):
            try:
                return getattr(settings, attr)
            except AttributeError:
                continue
        return option
868747
def set_options(options)
      self.port = options[:port].to_i if options.key?(:port)
      self.handler = options[:handler] if options.key?(:handler)
      self.host = options[:host] if options.key?(:host)
      self.auto_port = options[:auto_port] if options.key?(:auto_port)
    end
502560
protected function setRequiredFields()
    {
        $requiredFields = [
            'transaction_id',
            'remote_ip',
            'amount',
            'currency',
            'return_success_url',
            'return_failure_url',
            'payment_method_category',
            'billing_country',
            'shipping_country'
        ];

        $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);

        $requiredFieldValues = [
            'payment_method_category' => [
                self::PAYMENT_METHOD_CATEGORY_PAY_LATER,
                self::PAYMENT_METHOD_CATEGORY_PAY_OVER_TIME
            ],
            'billing_country'         => static::getAllowedCountries(),
            'shipping_country'        => static::getAllowedCountries()
        ];

        $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
    }
482031
def options
      OPTION_KEYS.inject({}){|o,k|o.merge!(k => send(k))}
    end
983787
private function setDefaultValues()
    {
        // Set default payment action.
        if (empty($this->paymentAction)) {
            $this->paymentAction = 'Sale';
        }

        // Set default locale.
        if (empty($this->locale)) {
            $this->locale = 'en_US';
        }

        // Set default value for SSL validation.
        if (empty($this->validateSSL)) {
            $this->validateSSL = false;
        }
    }
729836
def basic_options
      Hash[BASIC_OPTION_KEYS.map { |k| [k, send(k)] }].reject {|_,v| v.nil?}
    end
1134713
def load_commodities(self):
        
        base, quote = self.market.split("_")
        if isinstance(self.price, Amount):
            self.price = Amount("{0:.8f} {1}".format(self.price.to_double(), quote))
        else:
            self.price = Amount("{0:.8f} {1}".format(float(self.price), quote))
        if isinstance(self.amount, Amount):
            self.amount = Amount("{0:.8f} {1}".format(self.amount.to_double(), base))
        else:
            self.amount = Amount("{0:.8f} {1}".format(float(self.amount), base))
        fee_currency = base if self.fee_side == 'base' else quote
        if isinstance(self.fee, Amount):
            self.fee = Amount("{0:.8f} {1}".format(float(self.fee.to_double()), fee_currency))
        else:
            self.fee = Amount("{0:.8f} {1}".format(float(self.fee), fee_currency))