features-extras.opensocial-payment.billingitem.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shindig-extras Show documentation
Show all versions of shindig-extras Show documentation
Provides extra, deprecated or extended functionality. The items here have unstable APIs and could change at any time.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @class
* Representation of a billing item.
?
* @name opensocial.BillingItem
*/
/**
* Base interface for billing item objects.
*
* @param {Map.<opensocial.BillingItem.Field, Object>} params
* Parameters defining the billing item.
* @private
* @constructor
*/
opensocial.BillingItem = function(params) {
this.fields_ = params || {};
this.fields_[opensocial.BillingItem.Field.COUNT] =
this.fields_[opensocial.BillingItem.Field.COUNT] || 1;
};
/**
* @static
* @class
* All of the fields that a billing item object can have.
*
* The SKU_ID and PRINE are required for the request.
*
*
* See also:
*
* opensocial.BillingItem.getField()
*
*
* @name opensocial.Payment.Field
*/
opensocial.BillingItem.Field = {
/**
* @member opensocial.BillingItem.Field
*/
SKU_ID : 'skuId',
/**
* @member opensocial.BillingItem.Field
*/
PRICE : 'price',
/**
* @member opensocial.BillingItem.Field
*/
COUNT : 'count',
/**
* @member opensocial.BillingItem.Field
*/
DESCRIPTION : 'description'
};
/**
* Gets the billing item field data that's associated with the specified key.
*
* @param {String} key The key to get data for;
* see the Field class
* for possible values
* @param {Map.<opensocial.DataRequest.DataRequestFields, Object>}
* opt_params Additional
* params
* to pass to the request.
* @return {String} The data
* @member opensocial.BillingItem
*/
opensocial.BillingItem.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
};
/**
* Sets data for this billing item associated with the given key.
*
* @param {String} key The key to set data for
* @param {String} data The data to set
*/
opensocial.BillingItem.prototype.setField = function(key, data) {
return this.fields_[key] = data;
};
© 2015 - 2024 Weber Informatics LLC | Privacy Policy