Skip to content

Commit

Permalink
Merge pull request #4 from confact/version-1.0
Browse files Browse the repository at this point in the history
Version 1.0
  • Loading branch information
confact authored Apr 26, 2020
2 parents 9e275a7 + 9dc525c commit 3117f6f
Show file tree
Hide file tree
Showing 173 changed files with 58,086 additions and 204 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/docs/
/lib/
/coverage/
/bin/
Expand Down
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Changelog


## v1.0
* Added this changelog file
* Supporting Crystal 0.34
* Moving all structs to classes to fix compiler issues
* Changed structure of the calls, using class methods and class variables for api key. Will use less memory and be much cleaner.
* Added expand to these entities create methods: Customer, Charge, SetupIntent, PaymentIntent, and Token
* Made List Enumerable - So all Enumerable's methods works on lists

### Added api calls
* Create source
* Retrieve source
* Attach source to customer
* Detach source from customer
* Add tax id to a customer
* Remove tax id from customer
* Retrieve tax id from customer
* Retrieve charge
* create refund
* retrieve refund
* list customers
* list subscriptions
* list invoices
* list payment intents
* list setup intents
* create tax rate
* retrieve tax rate

### Added Entities
* Coupons
* Customer Tax ID
* Payout
* Source


## v0.2 (2020-03-31)
* Added some core entities
* Fixed bug in Charges
* Removed validations macro
* Added support for sending post params with array and array with Hashes/NamedTuples
* Added expand only on `create_subscription` method

### Added api calls
* payment/setup intent create
* payment/setup intent retrieve
* payment/setup intent confirm
* create product
* create plan

### Added Entities
* Payment Intent
* Setup Intent
* Plan
* Product
76 changes: 62 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Stripe API wrapper for Crystal.

This version (>1.0) is changed to follow Ruby's method and class structure. We will follow `Stripe::Class.method` but follow crystal parameters to take care of the types automatically.

### Notice

This api wrapper was tested on api version `2020-03-02` but have been trying to make it flexible with `String?` and correspondent in the types.
Expand All @@ -21,27 +23,29 @@ dependencies:
```crystal
require "stripe"

stripe = Stripe.new("YOUR_API_TOKEN")
Stripe.api_key = "YOUR_API_TOKEN"

token = stripe.create_card_token(card: {
token = Stripe::Token.create(card: {
number: "4242424242424242",
exp_month: 12,
exp_year: 2019,
cvc: 123,
})

customer = stripe.create_customer(source: token)
charge = stripe.create_charge(amount: 1000, currency: "usd", customer: customer)
customer = Stripe::Customer.create(source: token)
charge = Stripe::Charge.create(amount: 1000, currency: "usd", customer: customer)
```
### custom API version
You can set custom api version if needed.
Version need to be set before first api call is called. otherwise it won't be used.
```crystal
require "stripe"

stripe = Stripe.new("YOUR_API_TOKEN", "2019-03-29")
Stripe.api_key = "YOUR_API_TOKEN"
Stripe.version = "2019-03-29"
```

### Example of setting up a subscription
Expand All @@ -55,7 +59,7 @@ When the step is at server code, check the code below that is corresponding towa
Setting up an customer:
```crystal
token = params['StripeToken'] # or what the param for the token is called for you.
customer = stripe.create_customer(email: email,
customer = Stripe::Customer.create(email: email,
description: name, # just example
payment_method: token, # or token.payment_method.id
# depends what you do in the frontend to handle the token.
Expand All @@ -65,7 +69,7 @@ Setting up an customer:

create a subscription with that customer:
```crystal
stripe.create_subscription(customer: customer,
Stripe::Subscription.create(customer: customer,
plan: STRIPE_PLAN_ID,
expand: ["latest_invoice.payment_intent"]) # yes - create_subscription support expand.
```
Expand All @@ -92,14 +96,26 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [x] Create a charge

- [ ] Retrieve a charge
- [x] Retrieve a charge

- [ ] Update a charge

- [ ] Capture a charge

- [ ] List all charges

##### Sources

- [x] Create a source

- [x] Retrieve a source

- [x] Attach a source to customer

- [x] Detach a source from customer

- [ ] Update a source

##### Subscriptions
- [x] Create a Subscription

Expand All @@ -109,7 +125,7 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [x] Delete a Subscription

- [ ] List all Subscriptions
- [x] List all Subscriptions

##### Setup Intent

Expand All @@ -125,7 +141,7 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [ ] Delete a Setup Intent

- [ ] List all Setup Intents
- [x] List all Setup Intents

##### Payment Intent

Expand All @@ -141,7 +157,7 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [ ] Delete a Payment Intent

- [ ] List all Payment Intents
- [x] List all Payment Intents

##### Customers

Expand All @@ -153,7 +169,35 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [x] Delete a customer

- [ ] List all customers
- [x] List all customers

##### Customer Tax IDs

- [x] Create a customer tax ID

- [x] Retrieve a customer tax ID

- [x] Delete a customer tax ID

##### Refund

- [x] Create a refund

- [x] Retrieve a refund

- [ ] Update a refund

- [ ] List all refunds

##### Tax Rate

- [x] Create a tax rate

- [x] retrieve a tax rate

- [ ] Update a tax rate

- [ ] List all tax rates

##### Tokens

Expand All @@ -177,7 +221,7 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [ ] Delete a invoice

- [ ] List all invoices
- [x] List all invoices


### Objects
Expand All @@ -196,6 +240,8 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [x] Customer

- [x] Customer Tax ID

- [x] Subscription

- [x] Invoice
Expand All @@ -214,6 +260,8 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [x] Refund

- [x] Tax Rate

- [x] Token

- [x] Payment Intent
Expand All @@ -228,7 +276,7 @@ But follow [https://stripe.com/docs/billing/subscriptions/set-up-subscription](h

- [x] Card

- [ ] Source
- [x] Source

#### Connect

Expand Down
Loading

0 comments on commit 3117f6f

Please sign in to comment.