TagoStripe 0.1.0.15 → 0.1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 646e72f1a03e85c2556a72b2b5ed4b6a3300326b084faca1a750b8c2906e0635
4
- data.tar.gz: 1f4c12a9547d0b5172abab14df64ac43e74dbadc5ac8237ee5e4e78b8ff4adc6
3
+ metadata.gz: 76ae064aac78a05ac8bec6b1bfd3b336f42de325aa4110fe43222eca34e30aaf
4
+ data.tar.gz: fdb692fca756bc0779db8429ef39634676fb4e4ca216310eeb553f678273a0a1
5
5
  SHA512:
6
- metadata.gz: 7de5988ef3d89db13f82a8b9ff7df9a0d91a576f23d0262ae332698b33926e4f218fe8c3b7edc38fde58f359700f61bc4f7e3faa0776ee56cc113bd5ffad6a33
7
- data.tar.gz: 98889aa67abc668d77845e7ebc51b6dc278c25f735aecbdf2f113518ace22a6ce00dafdc3b059c0d6ff8948e4a4a6775d60b09acff00d6382f79883d12e1b8e0
6
+ metadata.gz: ddb7c8c8b9de66fa5bd94dcc74cbc3e236f1f50f7a7af647cb40dd9abe9ec7c61756bfd54b5b4a1dddbbf1c957136f241e4eecf785d1df14519012a93ed0328c
7
+ data.tar.gz: 0b59483838d200838e414a9ab5fd2b9d7f543705bd5603ac2ecc3d8ef4cb632973170afb39e3cdec70e190176f40946149ddf7fba1347c3f01428efa241ecaea
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/README.md CHANGED
@@ -1,31 +1,6 @@
1
- # TagoStripe
1
+ # このgemの基本理念
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/TagoStripe`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Development
24
-
25
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
-
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
-
29
- ## Contributing
30
-
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/TagoStripe.
3
+ - とにかく難しいことはしない。
4
+ - 組み込みフォームなんてもってのほか。PaymentLinkに全てお任せするものとする。
5
+ - ユーザー視点で見た時に、簡単にキャンセルとかできることが大事。
6
+ - 製品や価格は管理画面が用意されてるわけだからそっち使おうぜ。
@@ -17,6 +17,20 @@ module TagoStripe
17
17
  return customer
18
18
  end
19
19
 
20
+ #顧客名を部分一致で検索できる
21
+ def self.searchByName(name)
22
+ set_api_key
23
+ customers = Stripe::Customer.list
24
+ customers.select { |customer| customer.name.include?(name) }
25
+ end
26
+
27
+ #emailを部分一致で検索できる
28
+ def self.searchByEmail(email)
29
+ set_api_key
30
+ customers = Stripe::Customer.list
31
+ customers.select { |customer| customer.email.include?(email) }
32
+ end
33
+
20
34
  def self.create(email, name , metaData={})
21
35
  set_api_key
22
36
  customer = Stripe::Customer.create({
@@ -27,7 +41,7 @@ module TagoStripe
27
41
  return customer
28
42
  end
29
43
 
30
- def self.update(customer_id, email, name, metaData={})
44
+ def self.update(customer_id, name, email, metaData={})
31
45
  set_api_key
32
46
  customer = Stripe::Customer.update(customer_id, {
33
47
  email: email,
@@ -11,12 +11,74 @@ module TagoStripe
11
11
  return payment_links.data
12
12
  end
13
13
 
14
+ def self.activeList
15
+ set_api_key
16
+ payment_links = Stripe::PaymentLink.list({active: true})
17
+ return payment_links.data
18
+ end
19
+
20
+
14
21
  def self.getOne(payment_link_id)
15
22
  set_api_key
16
23
  payment_link = Stripe::PaymentLink.retrieve(payment_link_id)
17
24
  return payment_link
18
25
  end
19
26
 
27
+ def self.getOneWithPrice(payment_link_id)
28
+ set_api_key
29
+ payment_link = Stripe::PaymentLink.retrieve(payment_link_id)
30
+ payment_link_line_items = Stripe::PaymentLink.list_line_items(payment_link_id)
31
+ payment_link.price = payment_link_line_items.data[0].price
32
+ return payment_link
33
+ end
34
+
35
+
36
+ def self.getOneWithPriceAndProduct(payment_link_id)
37
+ set_api_key
38
+ payment_link = Stripe::PaymentLink.retrieve(payment_link_id)
39
+ payment_link_line_items = Stripe::PaymentLink.list_line_items(payment_link_id)
40
+ payment_link.price = payment_link_line_items.data[0].price
41
+ product = Stripe::Product.retrieve(payment_link.price.product)
42
+ payment_link.product = product
43
+ payment_link
44
+ end
45
+
46
+ def self.listWithPriceAndProduct()
47
+ set_api_key
48
+ payment_links = Stripe::PaymentLink.list()
49
+ result=[]
50
+ payment_links.data.each do |payment_link|
51
+ result.push(getOneWithPriceAndProduct(payment_link.id))
52
+ end
53
+ return result
54
+ end
55
+
56
+
57
+
58
+ def self.list_line_items(payment_link_id)
59
+ set_api_key
60
+ payment_link_line_items = Stripe::PaymentLink.list_line_items(payment_link_id)
61
+ return payment_link_line_items.data
62
+ end
63
+
64
+ def self.list_line_items_by_payment_link(payment_link)
65
+ set_api_key
66
+ payment_link_line_items = Stripe::PaymentLink.list_line_items(payment_link.id)
67
+ return payment_link_line_items.data
68
+ end
69
+
70
+ def self.create(amount, currency, description, payment_method_types)
71
+ set_api_key
72
+ payment_link = Stripe::PaymentLink.create({
73
+ amount: amount,
74
+ currency: currency,
75
+ description: description,
76
+ payment_method_types: payment_method_types
77
+ })
78
+ return payment_link
79
+ end
80
+
81
+
20
82
  def self.create(price_id)
21
83
  set_api_key
22
84
  payment_link = Stripe::PaymentLink.create({
@@ -1,8 +1,11 @@
1
1
  require 'stripe'
2
2
  module TagoStripe
3
3
  class Product
4
+
5
+
4
6
  def self.set_api_key
5
7
  Stripe.api_key = ENV['STRIPE_SECRET_KEY']
8
+ @isTest = true
6
9
  end
7
10
 
8
11
  def self.list
@@ -17,6 +20,23 @@ module TagoStripe
17
20
  return products.data
18
21
  end
19
22
 
23
+ def self.activeListWithPrice
24
+ set_api_key
25
+ products = Stripe::Product.list({active: true})
26
+ products.data.each do |product|
27
+ prices = Stripe::Price.list({product: product.id,active: true})
28
+ product.prices = prices.data
29
+ end
30
+ return products.data
31
+ end
32
+
33
+ #製品名で検索(部分一致)
34
+ def self.searchByName(name)
35
+ set_api_key
36
+ products = Stripe::Product.list
37
+ products.select { |product| product.name.include?(name) }
38
+ end
39
+
20
40
  def self.getOne(product_id)
21
41
  set_api_key
22
42
  product = Stripe::Product.retrieve(product_id)
@@ -33,6 +53,7 @@ module TagoStripe
33
53
  return product
34
54
  end
35
55
 
56
+
36
57
  def self.update(product_id, name, description, unit_label)
37
58
  set_api_key
38
59
  product = Stripe::Product.update(product_id, {
@@ -42,7 +42,7 @@ module TagoStripe
42
42
 
43
43
  def self.cancel(subscription_id)
44
44
  set_api_key
45
- subscription = Stripe::Subscription.delete(subscription_id)
45
+ subscription = Stripe::Subscription.cancel(subscription_id)
46
46
  return subscription
47
47
  end
48
48
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TagoStripe
4
- VERSION = "0.1.0.15"
4
+ VERSION = "0.1.0.17"
5
5
  end
data/lib/TagoStripe.rb CHANGED
@@ -11,5 +11,16 @@ require_relative "TagoStripe/PaymentLink"
11
11
 
12
12
  module TagoStripe
13
13
  class Error < StandardError; end
14
+
15
+ class << self
16
+ def initialize
17
+ puts "hello"
18
+ Stripe.api_key = ENV['STRIPE_SECRET_KEY']
19
+ end
20
+
21
+ def list
22
+ puts "hello"
23
+ end
24
+ end
14
25
  # Your code goes here...
15
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TagoStripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.15
4
+ version: 0.1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - manatago
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-23 00:00:00.000000000 Z
11
+ date: 2024-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stripe
@@ -31,6 +31,7 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".rspec"
34
35
  - README.md
35
36
  - Rakefile
36
37
  - lib/TagoStripe.rb