moyasar 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fee9ff1717fcf84cbf0322c262a9eaf7d6aebc662f4b7991bf85c1f208a0ad63
4
- data.tar.gz: 39ee4bda9d46570598bf7c912135d8c3bd076b6dda159c0997e8e9d5cb50d78a
3
+ metadata.gz: d8c18638e97d23b64339db1e9a4639cdeab882ba8a37ec69c6c8615639f34140
4
+ data.tar.gz: a9c50ccbe68ed542624c41bbb5f5fa3d5649ee8435f160599f162f76f061ebe4
5
5
  SHA512:
6
- metadata.gz: 342ded52e326a9b80681982cd0a8497e7aec33ee85399d7a2b731c56332f926cb463b6238460c8e1cafd8b3db861e980bf02270ff9dee17eae0ae96ec46e1743
7
- data.tar.gz: 3b5484dedbe178da18ab7c964b09640d5746f9104ac53a37c6b07b4af88f77fc5e1f30ae53a3ce8149c48ac1cfa3c5e74640c9c415c10d02cee295e4a5a9d2c9
6
+ metadata.gz: 7a839477875814460e2e8e375182e630a81d21805aece35b29652dba9a9f82259e16a812330f46b021705c71f203b1f8183c7d5640e77847b10fcff4a5a263b8
7
+ data.tar.gz: b0c3140d5aedb912c6158a2aa32eb7e712d5d745df917b9ce427c46d593ea4b61c21eefc4d8933137697ead43322da998011b47d04f3666a6118e24a2b680187
@@ -0,0 +1,44 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ push:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ build:
13
+ name: Build + Publish
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@master
18
+ - name: Set up Ruby 2.6
19
+ uses: actions/setup-ruby@v1
20
+ with:
21
+ version: 2.6.x
22
+
23
+ - name: Publish to GPR
24
+ run: |
25
+ mkdir -p $HOME/.gem
26
+ touch $HOME/.gem/credentials
27
+ chmod 0600 $HOME/.gem/credentials
28
+ printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
29
+ gem build *.gemspec
30
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
31
+ env:
32
+ GEM_HOST_API_KEY: ${{secrets.GPR_AUTH_TOKEN}}
33
+ OWNER: username
34
+
35
+ - name: Publish to RubyGems
36
+ run: |
37
+ mkdir -p $HOME/.gem
38
+ touch $HOME/.gem/credentials
39
+ chmod 0600 $HOME/.gem/credentials
40
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
41
+ gem build *.gemspec
42
+ gem push *.gem
43
+ env:
44
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -0,0 +1,20 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Build and test with Rake
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs 4 --retry 3
20
+ bundle exec rake
data/lib/moyasar.rb CHANGED
@@ -14,6 +14,8 @@ require 'moyasar/actions/fetch'
14
14
  require 'moyasar/actions/update'
15
15
  require 'moyasar/actions/refund'
16
16
  require 'moyasar/actions/cancel'
17
+ require 'moyasar/actions/capture'
18
+ require 'moyasar/actions/void'
17
19
 
18
20
  require 'moyasar/source'
19
21
  require 'moyasar/resource'
@@ -0,0 +1,29 @@
1
+ module Moyasar
2
+ module Actions
3
+ module Capture
4
+
5
+ def self.included(klass)
6
+ klass.extend ClassMethods
7
+ klass.send :include, InstanceMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def capture(id, attrs = {})
12
+ perform_capture(id, attrs)
13
+ end
14
+
15
+ def perform_capture(id, attrs = {})
16
+ response = request(:post, capture_url(id), params: attrs)
17
+ new(response.body)
18
+ end
19
+ end
20
+
21
+ module InstanceMethods
22
+ def capture(attrs = {})
23
+ self.class.perform_capture(id, attrs) unless id.nil?
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module Moyasar
2
+ module Actions
3
+ module Void
4
+
5
+ def self.included(klass)
6
+ klass.extend ClassMethods
7
+ klass.send :include, InstanceMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def void(id)
12
+ perform_void(id)
13
+ end
14
+
15
+ def perform_void(id)
16
+ response = request(:post, void_url(id))
17
+ new(response.body)
18
+ end
19
+ end
20
+
21
+ module InstanceMethods
22
+ def void
23
+ self.class.perform_void(id) unless id.nil?
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -1,9 +1,12 @@
1
1
  module Moyasar
2
2
  class Payment < Resource
3
3
  include Moyasar::Actions::Refund
4
+ include Moyasar::Actions::Capture
5
+ include Moyasar::Actions::Void
4
6
 
5
7
  attr_reader :id, :status, :amount, :amount_format, :fee, :fee_format, :currency, :invoice_id,
6
- :source, :refunded, :refunded_at, :ip, :created_at, :updated_at, :callback_url
8
+ :source, :refunded, :refunded_at, :ip, :created_at, :updated_at, :callback_url,
9
+ :captured, :captured_at, :voided_at
7
10
  attr_accessor :description
8
11
 
9
12
  def initialize(attrs = {})
@@ -17,7 +20,7 @@ module Moyasar
17
20
  def ==(other)
18
21
  return false unless other.is_a? Payment
19
22
 
20
- [:id, :status, :amount, :fee, :currency, :invoice_id, :source, :refunded, :refunded_at, :ip, :created_at, :updated_at].all? do |attr|
23
+ [:id, :status, :amount, :fee, :currency, :invoice_id, :source, :refunded, :refunded_at, :captured, :captured_at, :voided_at, :ip, :created_at, :updated_at].all? do |attr|
21
24
  self.send(attr) == other.send(attr)
22
25
  end
23
26
  end
@@ -46,6 +46,14 @@ module Moyasar
46
46
  "#{resource_url}/#{id}/cancel"
47
47
  end
48
48
 
49
+ def capture_url(id)
50
+ "#{resource_url}/#{id}/capture"
51
+ end
52
+
53
+ def void_url(id)
54
+ "#{resource_url}/#{id}/void"
55
+ end
56
+
49
57
  end
50
58
 
51
59
  private
@@ -1,3 +1,3 @@
1
1
  module Moyasar
2
- VERSION = '0.6.8'
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moyasar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdulaziz AlShetwi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-26 00:00:00.000000000 Z
11
+ date: 2019-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,6 +61,8 @@ executables:
61
61
  extensions: []
62
62
  extra_rdoc_files: []
63
63
  files:
64
+ - ".github/workflows/gempush.yml"
65
+ - ".github/workflows/ruby.yml"
64
66
  - ".gitignore"
65
67
  - ".travis.yml"
66
68
  - Gemfile
@@ -72,6 +74,7 @@ files:
72
74
  - bin/setup
73
75
  - lib/moyasar.rb
74
76
  - lib/moyasar/actions/cancel.rb
77
+ - lib/moyasar/actions/capture.rb
75
78
  - lib/moyasar/actions/construct.rb
76
79
  - lib/moyasar/actions/create.rb
77
80
  - lib/moyasar/actions/fetch.rb
@@ -79,6 +82,7 @@ files:
79
82
  - lib/moyasar/actions/refund.rb
80
83
  - lib/moyasar/actions/request.rb
81
84
  - lib/moyasar/actions/update.rb
85
+ - lib/moyasar/actions/void.rb
82
86
  - lib/moyasar/errors/account_inactive_error.rb
83
87
  - lib/moyasar/errors/api_connection_error.rb
84
88
  - lib/moyasar/errors/api_error.rb