moyasar 0.6.8 → 0.9.0
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 +4 -4
- data/.github/workflows/gempush.yml +44 -0
- data/.github/workflows/ruby.yml +20 -0
- data/lib/moyasar/actions/capture.rb +29 -0
- data/lib/moyasar/actions/void.rb +29 -0
- data/lib/moyasar/invoice.rb +1 -1
- data/lib/moyasar/payment.rb +5 -2
- data/lib/moyasar/resource.rb +8 -0
- data/lib/moyasar/source.rb +3 -1
- data/lib/moyasar/sources/apple_pay.rb +10 -0
- data/lib/moyasar/sources/credit_card.rb +1 -1
- data/lib/moyasar/sources/stc_pay.rb +10 -0
- data/lib/moyasar/version.rb +1 -1
- data/lib/moyasar.rb +4 -0
- data/moyasar.gemspec +1 -1
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c698ba47b4e7ba890e233d6940f8da7bb42068b7f5cb3628101976cffaa6cb9c
|
4
|
+
data.tar.gz: b24a3df09ecef2019da2855778ead83537247c0eba9e2f1c8954cc3a3c0c3ab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e38e54227da5a6ec7cd28e515e3aa64c1ce7f6f95a4cd0f26a7ba647c90c63cf9a1707f50c3178ff1a2b287842b1906ffa2fa237e03d5ced1f499bf38189bcab
|
7
|
+
data.tar.gz: 8cc7e7fd39ba14e7c38776e98d24f32d04a3df8fa43f6c40825d1d729a8ceca2d146ac39ae85e90b449e21c30894f2c03365a304e24337d94b4d3290b376b210
|
@@ -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
|
@@ -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
|
data/lib/moyasar/invoice.rb
CHANGED
@@ -2,7 +2,7 @@ module Moyasar
|
|
2
2
|
class Invoice < Resource
|
3
3
|
include Moyasar::Actions::Create
|
4
4
|
|
5
|
-
attr_reader :id, :status, :amount_format, :url, :payments, :created_at, :updated_at
|
5
|
+
attr_reader :id, :status, :amount_format, :url, :payments, :metadata, :created_at, :updated_at
|
6
6
|
attr_accessor :description, :amount, :currency
|
7
7
|
|
8
8
|
def ==(other)
|
data/lib/moyasar/payment.rb
CHANGED
@@ -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, :metadata, :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
|
data/lib/moyasar/resource.rb
CHANGED
data/lib/moyasar/source.rb
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
module Moyasar
|
2
|
+
class ApplePay < Source
|
3
|
+
attr_reader :company, :name, :number, :gateway_id, :reference_number, :message
|
4
|
+
|
5
|
+
def ==(other)
|
6
|
+
return unless other.instance_of? ApplePay
|
7
|
+
[:company, :name, :number, :message].all? { |attr| self.send(attr) == other.send(attr) }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Moyasar
|
2
2
|
class CreditCard < Source
|
3
|
-
attr_reader :company, :name, :number, :message, :transaction_url
|
3
|
+
attr_reader :company, :name, :number, :gateway_id, :reference_number, :message, :transaction_url
|
4
4
|
|
5
5
|
def ==(other)
|
6
6
|
return unless other.instance_of? CreditCard
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Moyasar
|
2
|
+
class STCPay < Source
|
3
|
+
attr_reader :mobile, :reference_number, :branch, :cashier, :reference_number, :message, :transaction_url
|
4
|
+
|
5
|
+
def ==(other)
|
6
|
+
return unless other.instance_of? STCPay
|
7
|
+
[:mobile, :reference_number, :branch, :cashier, :reference_number, :transaction_url, :message].all? { |attr| self.send(attr) == other.send(attr) }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/moyasar/version.rb
CHANGED
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'
|
@@ -22,6 +24,8 @@ require 'moyasar/invoice'
|
|
22
24
|
|
23
25
|
require 'moyasar/sources/sadad'
|
24
26
|
require 'moyasar/sources/credit_card'
|
27
|
+
require 'moyasar/sources/apple_pay'
|
28
|
+
require 'moyasar/sources/stc_pay'
|
25
29
|
|
26
30
|
require 'moyasar/errors/moyasar_error'
|
27
31
|
require 'moyasar/errors/authentication_error'
|
data/moyasar.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'moyasar/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'moyasar'
|
8
8
|
spec.version = Moyasar::VERSION
|
9
|
-
spec.authors = ['Abdulaziz AlShetwi']
|
9
|
+
spec.authors = ['Abdulaziz AlShetwi', 'Moyasar Dev Team']
|
10
10
|
spec.email = ['developers@moyasar.com']
|
11
11
|
|
12
12
|
spec.summary = %q{Ruby wrapper library for Moyasar Payment Service}
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moyasar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdulaziz AlShetwi
|
8
|
+
- Moyasar Dev Team
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-11-13 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -61,6 +62,8 @@ executables:
|
|
61
62
|
extensions: []
|
62
63
|
extra_rdoc_files: []
|
63
64
|
files:
|
65
|
+
- ".github/workflows/gempush.yml"
|
66
|
+
- ".github/workflows/ruby.yml"
|
64
67
|
- ".gitignore"
|
65
68
|
- ".travis.yml"
|
66
69
|
- Gemfile
|
@@ -72,6 +75,7 @@ files:
|
|
72
75
|
- bin/setup
|
73
76
|
- lib/moyasar.rb
|
74
77
|
- lib/moyasar/actions/cancel.rb
|
78
|
+
- lib/moyasar/actions/capture.rb
|
75
79
|
- lib/moyasar/actions/construct.rb
|
76
80
|
- lib/moyasar/actions/create.rb
|
77
81
|
- lib/moyasar/actions/fetch.rb
|
@@ -79,6 +83,7 @@ files:
|
|
79
83
|
- lib/moyasar/actions/refund.rb
|
80
84
|
- lib/moyasar/actions/request.rb
|
81
85
|
- lib/moyasar/actions/update.rb
|
86
|
+
- lib/moyasar/actions/void.rb
|
82
87
|
- lib/moyasar/errors/account_inactive_error.rb
|
83
88
|
- lib/moyasar/errors/api_connection_error.rb
|
84
89
|
- lib/moyasar/errors/api_error.rb
|
@@ -91,8 +96,10 @@ files:
|
|
91
96
|
- lib/moyasar/payment.rb
|
92
97
|
- lib/moyasar/resource.rb
|
93
98
|
- lib/moyasar/source.rb
|
99
|
+
- lib/moyasar/sources/apple_pay.rb
|
94
100
|
- lib/moyasar/sources/credit_card.rb
|
95
101
|
- lib/moyasar/sources/sadad.rb
|
102
|
+
- lib/moyasar/sources/stc_pay.rb
|
96
103
|
- lib/moyasar/version.rb
|
97
104
|
- moyasar.gemspec
|
98
105
|
homepage: https://moyasar.com/docs/api?ruby
|
@@ -114,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
121
|
- !ruby/object:Gem::Version
|
115
122
|
version: '0'
|
116
123
|
requirements: []
|
117
|
-
rubygems_version: 3.0.1
|
124
|
+
rubygems_version: 3.0.3.1
|
118
125
|
signing_key:
|
119
126
|
specification_version: 4
|
120
127
|
summary: Ruby wrapper library for Moyasar Payment Service
|