Coder Social home page Coder Social logo

Comments (9)

Andrewangeta avatar Andrewangeta commented on May 19, 2024

That shouldn’t be the case and works fine for me. Even in my test cases. If you look at Provider.swiftall of the route properties are using the protocol type rather than the concrete type. So those default implementations with nil being the default value should work fine.

from stripe.

Andrewangeta avatar Andrewangeta commented on May 19, 2024

This compiles fine for me

let stripe = try req.make(StripeClient.self)
return try stripe.customer.create(email: registration.email).flatMap { customer in

from stripe.

JamesCoonce avatar JamesCoonce commented on May 19, 2024

Hmmmm. That's strange

func create(_ req: Request) throws -> Future<Customer> {
        let stripe = try req.make(StripeClient.self)
        return try req.content.decode(Customer.self).flatMap(to: Customer.self) { customer in
            let stripeCustomer = try stripe.customer.create(email: customer.email, description: customer.description)
            customer.stripeId = stripeCustomer.id
            return customer.save(on: req)
        }
    }

/Users/jamescoonce/SwiftWeb/StripeCustomer/Sources/App/Controllers/CustomersController.swift:21:61: error: m
issing argument for parameter 'accountBalance' in call
            let stripeCustomer = try stripe.customer.create(email: customer.email, description: customer.des
cription)
                                                            ^
                                                            accountBalance: <#Int?#>,
Stripe.CustomerRoutes:2:17: note: 'create(accountBalance:businessVatId:coupon:defaultSource:description:email:metadata:shipping:source:)' declared here
    public func create(accountBalance: Int?, businessVatId: String?, coupon: String?, defaultSource: String?, description: String?, email: String?, metadata: [String : String]?, shipping: Stripe.ShippingLabel?, source: Any?) throws -> NIO.EventLoopFuture<Stripe.StripeCustomer>

from stripe.

Andrewangeta avatar Andrewangeta commented on May 19, 2024

You sure you have the latest version of the provider?

from stripe.

JamesCoonce avatar JamesCoonce commented on May 19, 2024

.package(url: "https://github.com/vapor-community/stripe-provider.git", from: "2.2.0"),

from stripe.

Andrewangeta avatar Andrewangeta commented on May 19, 2024

That's interesting. I have no idea why you're getting a compile error. Get rid of the build folder, delete Package.resolved and try to do a package update. Maybe you have a really old version still.

from stripe.

Andrewangeta avatar Andrewangeta commented on May 19, 2024

A new version of the provider was just released also. Although those changes were in previous release try the latest and see if that helps 2.2.1
https://github.com/vapor-community/stripe-provider/releases/tag/2.2.1

from stripe.

JamesCoonce avatar JamesCoonce commented on May 19, 2024

.package(url: "https://github.com/vapor-community/stripe-provider.git", from: "2.2.1"),

In Package.resolved

{
        "package": "Stripe",
        "repositoryURL": "https://github.com/vapor-community/stripe-provider.git",
        "state": {
          "branch": null,
          "revision": "20c35dabd901c02bc7ad5fffd47f7a8e34595cbc",
          "version": "2.2.1"
        }
      },

.build was also delete

This is the output.


/Users/jamescoonce/SwiftWeb/StripeCustomer/Sources/App/Controllers/CustomersController.swift:21:61: error: missing argument for parameter 'accountBalance' in call
            let stripeCustomer = try stripe.customer.create(email: customer.email, description: customer.description)
                                                            ^
                                                            accountBalance: <#Int?#>,
Stripe.CustomerRoutes:2:17: note: 'create(accountBalance:businessVatId:coupon:defaultSource:description:email:metadata:shipping:source:)' declared here
    public func create(accountBalance: Int?, businessVatId: String?, coupon: String?, defaultSource: String?, description: String?, email: String?, metadata: [String : String]?, shipping: Stripe.ShippingLabel?, source: Any?) throws -> NIO.EventLoopFuture<Stripe.StripeCustomer>
                ^

from stripe.

Andrewangeta avatar Andrewangeta commented on May 19, 2024

Where you able to figure this out? I don’t think anyone else has had this problem.

from stripe.

Related Issues (20)

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.