/// <summary>
        /// Updates a collection. 
        /// </summary>
        public Collection UpdateCollection(Collection collection)
        {
            JSONObject json = _api.Put(Properties.Settings.Default.CollectionsUri + "/" + collection.Id.ToString(), collection.ToJSON(), ContentType.JSON);
            Collection updatedCollection = new Collection(json);

            return updatedCollection;
        }
        /// <summary>
        /// Create a new collection notification instance using a valid json.
        /// </summary>
        /// <param name="json">The json object used to
        /// fill the collection notification data</param>
        public CollectionNotification(JSONObject json)
        {
            // todo: strong type validation
            _json = json;

            // set collection values
            _collection = new Collection(_json.Dictionary["collection"]);
        }
        /// <summary>
        /// Proactively cancels a collection. 
        /// </summary>
        public void CancelCollection(Int32 collectionId)
        {
            // Create a collection status change
            Collection collection = new Collection();
            collection.Id = collectionId;
            collection.Status = "cancelled";

            // Execute update
            UpdateCollection(collection);
        }
Ejemplo n.º 4
0
        protected void ChangeExternalReferenceButton_Click(object sender, EventArgs e)
        {
            // Set PaymentHelper
            PaymentsHelper ph = GetPaymentsHelper();

            // Try change the collection's external reference
            try
            {
                Collection collection = new Collection();
                collection.Id = Convert.ToInt32(ColIdChangeExtRefText.Text);
                collection.ExternalReference = NewExternalReferenceText.Text;
                ph.UpdateCollection(collection);
                ShowLabelMessageOk(ChangeExternalReferenceResult);
            }
            catch (Exception ex)
            {
                ShowLabelMessageError(ChangeExternalReferenceResult, ex.Message);
            }
        }