コード例 #1
0
        public EntityList <PaymentSource> ListPaymentSources()
        {
            PaymentSource source = new PaymentSource(this.GetConnection());

            source.SetEndpointBase(this.GetEndpoint(true));
            return(source.ListAll(null, null, new PaymentSourceConverter()));
        }
コード例 #2
0
        public PaymentSource CreatePaymentSource(SourceRequest sourceRequest)
        {
            string        url    = this.GetEndpoint(true) + "/payment_sources";
            PaymentSource output = null;

            try {
                string sourceRequestJson = sourceRequest.ToJsonString();
                string response          = this.GetConnection().Post(url, null, sourceRequestJson);

                JsonSerializerSettings sourceSettings = new JsonSerializerSettings()
                {
                    NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore
                };
                sourceSettings.Converters.Add(new PaymentSourceConverter());

                output = JsonConvert.DeserializeObject <PaymentSource>(response, sourceSettings);
                output.ChangeConnection(this.GetConnection());
                output.SetEndpointBase(this.GetEndpoint(true));
            }
            catch (Exception e) {
                throw new EntityException("", e);
            }

            return(output);
        }