Coder Social home page Coder Social logo

chargify-dot-net's People

Contributors

dbruning avatar dependabot[bot] avatar edlichtman avatar gitter-badger avatar hewittj avatar jaceenet avatar jamiepenney avatar janigorse avatar joseph51d avatar josephdix avatar kfrancis avatar lordjz avatar markpearlcoza avatar rgmills avatar sam-s-timely avatar threescreenstudios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chargify-dot-net's Issues

Medium Trust Host Error Since upgrading to .NET 4+

In upgrading to the latest version (to fix the bad request issue with customer update) we've been experiencing the following error when trying to run in our hosted environment.

Inheritance security rules violated while overriding member: 'ChargifyNET.ChargifyException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Our site is hosted on Rackspace Cloud Sites where they run with Modified Medium Trust.

This seems to have been introduced by the recent update in Chargify.NET to .NET 4+ (Security Changes)

I've researched this problem today and have implemented and tried a few of the suggested fixes for it but I've been unable to fix the issue at this time.

Price Points?

Are Price Points updatable with the API? I searched code for "price_point_id" and "PricePoint", but didn't get any hits.

If not, are there any plans to add in near future?

Thanks!

The type or namespace name 'IMetafield' could not be found

Where is IMetafield (referenced by ChargifyConnect class) defined? I did a clean pull and am seeing the following error trying to build (in VS2017):

The type or namespace name 'IMetafield' could not be found (are you missing a using directive or an assembly reference?) ChargifyDotNet(netstandard2.0)

\chargify-dot-net\Source\ChargifyDotNet\ChargifyConnect.cs 215

Allow delayed product change

Let's update the EditSubscriptionProduct method to allow for delayed product change, which only requires one additional optional paramter.

No UpdateProduct?

Hi,

I'm using ChargifyDotNet to check and move configuration changes between sites. Thanks for the excellent work!

I noticed that there is no UpdateProduct method. There is an UpdateCustomer method, and Customers have settable properties - but Products seem to have properties that are get-only.
Is this by design? It seems like the Chargify API allows product updates, so I'm wondering why ChargifyDotNet doesn't.

Invoice Payment

There seems to only be support for getting a list of invoices, while there is no support for adding a payment to an invoice, like described in the Chargify API: https://docs.chargify.com/api-invoices-payments

By just using AddPayment, the payment will not be linked to the invoice and the status will remain Unpaid.

Am I right here, or am I missing something here?

Failing to compile

I was going to look into implementing price points, but am not able to compile the solution (VS 2017). Wondering where I'm being dumb and missing something simple? Here's a screenshot of the error dump:

image

System.ArgumentOutOfRangeException

On calling CreateSubscription this exception is always thrown: System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index'. I've included the exception details below.

I'm using version Chargify.Net 1.2.5 from Nuget on a .Net Framework 4.6.1 project, and Newtonsoft.Json v11.0.2.

Here is the code (this is on a test account so I'm passing "1" for the credit card):

CustomerAttributes customer = new CustomerAttributes("Damon", "Janis", "[email protected]", "Quest", "7645");
CreditCardAttributes creditCard = new CreditCardAttributes("Damon", "Janis", "1", 2022, 4, "123", "150 Rainbow Dr #5022", "Livingston", "TX", "77399", "US");
var subscription = ChargifyConnect.CreateSubscription("standard-monthly", customer, creditCard);

I've tried passing in different information but no matter what I try, the same exception is always thrown. Here are the exception details:

System.ArgumentOutOfRangeException
HResult=0x80131502
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source=mscorlib
StackTrace:
at System.Collections.ArrayList.get_Item(Int32 index)
at ChargifyNET.Json.XmlToJsonConverter.XmlToJsoNnode(StringBuilder sbJson, XmlElement node, Boolean showNodeName)
at ChargifyNET.Json.XmlToJsonConverter.OutputNode(String childname, Object alChild, StringBuilder sbJson, Boolean showNodeName)
at ChargifyNET.Json.XmlToJsonConverter.XmlToJsoNnode(StringBuilder sbJson, XmlElement node, Boolean showNodeName)
at ChargifyNET.Json.XmlToJsonConverter.XmlToJson(XmlDocument xmlDoc)
at ChargifyNET.ChargifyConnect.DoRequest(String methodString, HttpRequestMethod requestMethod, String postData)
at ChargifyNET.ChargifyConnect.CreateSubscription(String productHandle, String newSystemId, String firstName, String lastName, String emailAddress, String phone, String organization, String vatNumber, String shippingAddress, String shippingCity, String shippingState, String shippingZip, String shippingCountry, String fullNumber, Int32 expirationMonth, Int32 expirationYear, String cvv, String billingAddress, String billingCity, String billingState, String billingZip, String billingCountry, String couponCode, Int32 componentId, Int32 allocatedQuantity)
at ChargifyNET.ChargifyConnect.CreateSubscription(String productHandle, ICustomerAttributes customerAttributes, ICreditCardAttributes creditCardAttributes)
at questBLL.Chargify.CreateCustomer(String firstName, String lastName, String email, String fullNumber, String cvv, Int32 expirationMonth, Int32 expirationYear, String billingAddress, String billingCity, String billingState, String billingZip) in C:\Users\damonjanis\Dropbox\Data\work\Projects\Quest\Src\BLL\Chargify.cs:line 31
at TestBLL.Program.Main(String[] args) in C:\Users\damonjanis\Dropbox\Data\work\Projects\Quest\Src\TestBLL\Program.cs:line 19

MissingMethodException when setting VatNumber property on ICustomer

I updated to the latest build on Nuget to implement VatNumber functionality since a PR #15, however I am getting the following error when I try to call my method which gets a customer and updates the VatNumber property - assuming it's not been fully implemented?

System.MissingMethodException was unhandled by user code
Method not found: 'Void ChargifyNET.ICustomerAttributes.set_VatNumber(System.String)'.

Depreciated Endpoints

/subscriptions/123/components/456.xml is depreciated (doesnt properly honor upgrade/downgrade schemes).

Number/DateTime parsing routines MUST use invariant (or otherwise explicit) culture

JSON spec explicitly states which characters can be used to denote numbers; Chargify also uses culture-independent settings when outputting JSON and XML. However, chargify-dot-net uses the current thread culture to parse numbers and dates/times both in JSON and XML, and sometimes fails silently when failing to parse JSON or XML.

Tests can be used to enforce 3 conditions:

  • Any method that parses JSON or XML values to numbers or dates/times MUST use invariant culture to do so (or otherwise explicitly specified culture settings).
  • Any method that parses JSON or XML values to numbers or dates/times MUST NOT fail silently (e.g. MUST NOT return 0 when input is invalid).
  • Any method that parses JSON or XML values to numbers or dates/times MUST succeed with any thread culture.

Incomplete list of affected methods:

  • All GetJSONContent* methods
  • All GetNodeContent* methods
  • JsonNumber.Parse method

CreateSubscription name on credit card

Hi,

This function is ignoring name from credit card. It just takes name from customer.

CreateSubscription(string ProductHandle, ICustomerAttributes CustomerAttributes, ICreditCardAttributes CreditCardAttributes)

Provide a usage licence.

So that my client can have certainty that they are not going to have to open source their code base, because they used an AGPL licence library. Can you please provide a licence, that this project can be used under.

Both here and on the nuget page.

TLS Upgrade 12 January 2016

Chargify are no longer supporting TLS 1.0 and 1.1 from 12 January 2016 (https://docs.chargify.com/tls-upgrade-notice). In my Chargify control panel I saw a notification saying "We’re concerned that your Chargify integration will stop working on Jan 12, 2016. Please see your ​TLS Check page (https://app.chargify.com/tls_check) for more information."

Sure enough that page shows a that the client 'Chargify.NET Client v1.1.5738.19989' is using TLSv1.

I believe a configuration change is necessary to explicitly set the ChargifyConnect.ProtocolType to SecurityProtocolType.Tls12 as this is now the only supported protocol. It could be that this is unnecessary and it will switch automatically? But as I couldn't see it documented on the project here I thought I'd ask just in case come D-Day anyone has any issues.

Fix FullCardNumber and Card Type?

In version .5879, PaymentProfile.FullCardNumber is blank (in older releases it wasn't) and Card Type is missing.

Someone committed a fix for this...Can you possibly roll this into the release soon? Thanks!

050967e

One-time charge doesn't have 'taxable' option

Hi, when doing a one-time charge, there isn't a setting for taxable. I have done the change in the source code but I am unable to upload it. If you would like it, please tell me what I need to do to get it to you.

Thanks.

GetMetadataFor returning list with empty strings

I have a subscription for a test site that has 3 custom fields with names and values assigned.

Below is a screenshot showing the custom fields populated for the subscription.

2016-09-08_17-21-08

When I call the GetMetadataFor like:

var sub = chargify.LoadSubscription(subId);
var meta = chargify.GetMetadataFor<Subscription>(subId, null);

I do get a MetadataResult object back with 3 items in the Metadata list, but all them have empty strings in the name and value properties. The ResourceID is also just 0 (zero).

Any ideas why this is happening?

Make NextBillingAt nullable on CreateSubscription?

Per the chargify API, this is an optional parameter: https://docs.chargify.com/api-subscriptions (scroll to "next_billing_at)

This is actually pretty important in that a null value collects payment immediately / when the subscription is created. If this value is set (event to a date in the past), there's a delay.

Any chance you can change this to be DateTime? in the applicable methods? I'm particularly interested in the one that takes in a paymentProfileID.

PS -- Thanks for adding the payment profile stuff so quickly!!

PreviewRenewal method does not work

Calling PreviewRenewal results in

Unexpected character encountered while parsing value: C. Path '', line 0, position 0.
That's what we get when calling wrapper method - it looks like data structure has changed since wrapper lib was implemented.

Add support for missing fields in Chargify.NET

I am working on converting the C# object returned from Chargify.NET back into XML, however, I'm noticing some elements in the XML returned by Charfigy's REST API are not represented as properties in the C# objects.

Example:
Class: Product
Missing: taxable
initial_charge_after_trial
update_return_params

Class: Component:
Supports only 3 properties(id, quantity, memo) , everything else is missing, such as: pricing_scheme, unit_name, unit_price, kind, etc.

Class: Customer/CustomerAttributes
Missing:
portal_customer_created_at
portal_invite_last_sent_at
portal_invite_last_accepted_at

I didn't look @ the Subscription class.

I suspect that they've added new properties over time, and/ore these are non-critical type fields for the most part.

Bug in "UpdateTheSubscriptionCreditCard" method

In the private method for updating the subscription credit card, the CVV's length is checked if the CVV is required in Chargify. HOWEVER, it is possible to pass in a null value for the CVV if that value should not be updated. Because there is no check to see if the CVV is null, the call to this method throws a null object reference exception. This bug makes it impossible to update just the billing address from the library.

GetPrettyUpdateURL Page Not Found

The GetPrettySubscriptionUpdateURL is 404'ing because the "/" parts of the URL itself are getting encoded. I haven't been able to narrow down what has changed on chargify's end to cause this - it does seem like a bug in Chargify.NET though. I've outlined fixes below.

If you update the Chargify.NET ChargifyConnect class to the following it should resolve the issue.

        public string GetPrettySubscriptionUpdateURL(string firstName, string lastName, int subscriptionId)
        {
            if (string.IsNullOrEmpty(SharedKey)) throw new ArgumentException("SharedKey is required to generate the hosted page url");

            string message = UpdateShortName + "--" + subscriptionId + "--" + SharedKey;
            string token = message.GetChargifyHostedToken();
            string prettyId = string.Format("{0}-{1}-{2}", subscriptionId, PCLWebUtility.WebUtility.UrlEncode(firstName.Trim().ToLower()), PCLWebUtility.WebUtility.UrlEncode(lastName.Trim().ToLower()));
            string methodString = string.Format("{0}/{1}/{2}", UpdateShortName, prettyId, token);
            // just in case?
            // methodString = PCLWebUtility.WebUtility.UrlEncode(methodString);
            string updateUrl = string.Format("{0}{1}{2}", URL, (URL.EndsWith("/") ? "" : "/"), methodString);
            return updateUrl;
        }

All i've done is comment out the global Urlencode call and wrap first and last name in encodes instead (as I believe those are the 2 potential problem areas - each of the sections could be wrapped in encodes instead). I also believe the URL encode in this method could be removed or modified as deemed appropriate.

Edit: I've looked into making a pull request but There's a billion errors - i think related to nuget packages.. or something... that I can't seem to fix at this time.

Edit 2: I updated the code snippets above - I was looking at the Chargify.NET folder in source - and that's apparently.. no longer.. needed/updated/used? I'm honestly not sure - but these changes are based on the code in the chargifydotnet structure instead.

Edit 3: I defeated VS/Git/TheWorld - PR at #55

Expose async methods

Same request as for the API v2 SDK: kfrancis/Chargify2#3

The current library only exposes synchronous methods, meaning the web server is forced to keep a CPU thread twiddling its thumbs while waiting for the Chargify response. Since the thread pool is a limited resource, enough traffic to long running synchronous tasks like these can cause a severe bottleneck.

I recommend refactoring to .NET 4.5 async methods (or .NET 4 with microsoft.bcl.async nuget) so they are async by default and can be called synchronously by .Wait or .Result properties if so desired.

ChargifyException Message may contain sensitive information

We have noticed that some ChargifyException Message values contain sensitive information, namely the request body that was posted to chargify. Here is an abridged sample (bogus credit card number used)

[ChargifyException: The server returned 'Unprocessable Entity' with the status code 422 (422) when posting '<?xml version="1.0" encoding="UTF-8"?><subscription><credit_card_attributes><full_number>4111111111111119</full_number><expiration_month>10</expiration_month><expiration_year>2019</expiration_year><cvv>000</cvv><billing_country>NZ</billing_country></credit_card_attributes></subscription>'.]

Some request body values may be acceptable to include in the message but probably not any containing a cc number etc

Happy to have a crack at resolving this issue

entity/POCO objects to XML?

Thanks for putting this project out there. It is making my life much easier right now!

I have an enhancement request.

The chargify REST API will return XML, which is serialized into C# objects, I would like to be able to serialize those objects back to XML that matches the XML returned by the REST API as we'll be storing a copy of this XML in our own system.

Any plans to enhance Chargify.NET to serialize various entity type classes (ProductFamily, Product, Component, Customer, and Subscription) to their XML representation?

Even if there's no plans, I can create this XML myself, but some of the objects do not support all of the properties available in the XML.
I'll post a separate issue for those.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.