Skip to content

Commit

Permalink
Update missing product fields for #45
Browse files Browse the repository at this point in the history
  • Loading branch information
kfrancis committed May 24, 2017
1 parent 83fd342 commit 221c352
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 9 deletions.
20 changes: 20 additions & 0 deletions Source/Chargify.NET/Interfaces/IProduct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,25 @@ public interface IProduct : IComparable<IProductFamily>
/// The version of the product
/// </summary>
int ProductVersion { get; }

/// <summary>
/// Is this product taxable?
/// </summary>
bool Taxable { get; }

/// <summary>
/// The return url upon update
/// </summary>
string UpdateReturnUrl { get; }

/// <summary>
/// Paramters for update
/// </summary>
string UpdateReturnParams { get; }

/// <summary>
/// Will the setup/initial charge be processed after the trial?
/// </summary>
bool InitialChargeAfterTrial { get; }
}
}
53 changes: 44 additions & 9 deletions Source/Chargify.NET/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,9 @@ private void LoadFromJson(JsonObject obj)
_expirationIntervalUnit = obj.GetJSONContentAsIntervalUnit(key);
break;
case "return_url":
case "update_return_url":
_returnUrl = obj.GetJSONContentAsString(key);
break;
case "return_params":
case "update_return_params":
_returnParams = obj.GetJSONContentAsString(key);
break;
case "require_credit_card":
Expand All @@ -183,6 +181,18 @@ private void LoadFromJson(JsonObject obj)
case "public_signup_pages":
_publicSignupPages = obj.GetJSONContentAsPublicSignupPages(key);
break;
case "initial_charge_after_trial":
_initialChargeAfterTrial = obj.GetJSONContentAsBoolean(key);
break;
case "update_return_url":
_updateReturnUrl = obj.GetJSONContentAsString(key);
break;
case "update_return_params":
_updateReturnParams = obj.GetJSONContentAsString(key);
break;
case "taxable":
_taxable = obj.GetJSONContentAsBoolean(key);
break;
}
}
}
Expand Down Expand Up @@ -241,11 +251,9 @@ private void LoadFromNode(XmlNode productNode)
_expirationIntervalUnit = dataNode.GetNodeContentAsIntervalUnit();
break;
case "return_url":
case "update_return_url":
_returnUrl = dataNode.GetNodeContentAsString();
break;
case "return_params":
case "update_return_params":
_returnParams = dataNode.GetNodeContentAsString();
break;
case "require_credit_card":
Expand All @@ -269,6 +277,18 @@ private void LoadFromNode(XmlNode productNode)
case "public_signup_pages":
_publicSignupPages = dataNode.GetNodeContentAsPublicSignupPages();
break;
case "initial_charge_after_trial":
_initialChargeAfterTrial = dataNode.GetNodeContentAsBoolean();
break;
case "update_return_url":
_updateReturnUrl = dataNode.GetNodeContentAsString();
break;
case "update_return_params":
_updateReturnParams = dataNode.GetNodeContentAsString();
break;
case "taxable":
_taxable = dataNode.GetNodeContentAsBoolean();
break;
}
}
}
Expand Down Expand Up @@ -539,12 +559,9 @@ public string ReturnURL
/// </summary>
public string UpdateReturnUrl
{
get { return _returnUrl; }
set
{
_returnUrl = value;
}
get { return _updateReturnUrl; }
}
private string _updateReturnUrl = string.Empty;

/// <summary>
/// The parameter string chargify will use in constructing the return URL.
Expand Down Expand Up @@ -626,6 +643,24 @@ public int ProductVersion
get { return _productVersion; }
}
private int _productVersion = int.MinValue;

/// <summary>
/// Is this product taxable?
/// </summary>
public bool Taxable { get { return _taxable; } }
private bool _taxable;

/// <summary>
/// Paramters for update
/// </summary>
public string UpdateReturnParams { get { return _updateReturnParams; } }
private string _updateReturnParams = string.Empty;

/// <summary>
/// Will the setup/initial charge be processed after the trial?
/// </summary>
public bool InitialChargeAfterTrial { get { return _initialChargeAfterTrial; } }
private bool _initialChargeAfterTrial;
#endregion

#region Operators
Expand Down

0 comments on commit 221c352

Please sign in to comment.