moyasar 0.6.6 → 0.8.5
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 +5 -5
- data/.github/workflows/gempush.yml +44 -0
- data/.github/workflows/ruby.yml +20 -0
- data/.travis.yml +2 -0
- data/lib/moyasar.rb +5 -0
- data/lib/moyasar/actions/cancel.rb +28 -0
- data/lib/moyasar/actions/capture.rb +29 -0
- data/lib/moyasar/actions/void.rb +29 -0
- data/lib/moyasar/invoice.rb +3 -1
- data/lib/moyasar/payment.rb +5 -2
- data/lib/moyasar/resource.rb +13 -1
- data/lib/moyasar/source.rb +3 -1
- data/lib/moyasar/sources/apple_pay.rb +10 -0
- data/lib/moyasar/sources/stc_pay.rb +10 -0
- data/lib/moyasar/version.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 838982e945f69c0431f2733cacabc99dead3fa09198e1c8c916c166f8be2fb8b
|
4
|
+
data.tar.gz: 5cd5fda14aa8425d41f88362f2953b0ccf14a60a2d9e2168cc9f05ffd1f10fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec2e5dd51d2e712b1d618a7daf1817e473f6cc5e65f812e923a00aa445ab6006fe1f27e8d55b94e841eae1bff3d20279f0ee6d6c65c1ff3ab46a55d9ac8f189
|
7
|
+
data.tar.gz: b0eb27ef0a197a3346696197b9e53cbda918f68c47b4395fb25d51b34b7efb1a9832e452a40f0852b694c8d3258ebe3d1ef067145aa321e01d38bdb41bad95eb
|
@@ -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/.travis.yml
CHANGED
data/lib/moyasar.rb
CHANGED
@@ -13,6 +13,9 @@ require 'moyasar/actions/list'
|
|
13
13
|
require 'moyasar/actions/fetch'
|
14
14
|
require 'moyasar/actions/update'
|
15
15
|
require 'moyasar/actions/refund'
|
16
|
+
require 'moyasar/actions/cancel'
|
17
|
+
require 'moyasar/actions/capture'
|
18
|
+
require 'moyasar/actions/void'
|
16
19
|
|
17
20
|
require 'moyasar/source'
|
18
21
|
require 'moyasar/resource'
|
@@ -21,6 +24,8 @@ require 'moyasar/invoice'
|
|
21
24
|
|
22
25
|
require 'moyasar/sources/sadad'
|
23
26
|
require 'moyasar/sources/credit_card'
|
27
|
+
require 'moyasar/sources/apple_pay'
|
28
|
+
require 'moyasar/sources/stc_pay'
|
24
29
|
|
25
30
|
require 'moyasar/errors/moyasar_error'
|
26
31
|
require 'moyasar/errors/authentication_error'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Moyasar
|
2
|
+
module Actions
|
3
|
+
module Cancel
|
4
|
+
|
5
|
+
def self.included(klass)
|
6
|
+
klass.extend ClassMethods
|
7
|
+
klass.send :include, InstanceMethods
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def cancel(id)
|
12
|
+
perform_cancel(id)
|
13
|
+
end
|
14
|
+
|
15
|
+
def perform_cancel(id)
|
16
|
+
response = request(:put, cancel_url(id))
|
17
|
+
new(response.body)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module InstanceMethods
|
22
|
+
def cancel()
|
23
|
+
self.class.perform_cancel(id) unless id.nil?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -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
@@ -1,6 +1,8 @@
|
|
1
1
|
module Moyasar
|
2
2
|
class Invoice < Resource
|
3
|
-
|
3
|
+
include Moyasar::Actions::Create
|
4
|
+
|
5
|
+
attr_reader :id, :status, :amount_format, :url, :payments, :metadata, :created_at, :updated_at
|
4
6
|
attr_accessor :description, :amount, :currency
|
5
7
|
|
6
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
@@ -2,10 +2,10 @@ module Moyasar
|
|
2
2
|
class Resource
|
3
3
|
include Moyasar::Actions::Request
|
4
4
|
include Moyasar::Actions::Construct
|
5
|
-
include Moyasar::Actions::Create
|
6
5
|
include Moyasar::Actions::List
|
7
6
|
include Moyasar::Actions::Fetch
|
8
7
|
include Moyasar::Actions::Update
|
8
|
+
include Moyasar::Actions::Cancel
|
9
9
|
|
10
10
|
class << self
|
11
11
|
|
@@ -42,6 +42,18 @@ module Moyasar
|
|
42
42
|
"#{resource_url}/#{id}/refund"
|
43
43
|
end
|
44
44
|
|
45
|
+
def cancel_url(id)
|
46
|
+
"#{resource_url}/#{id}/cancel"
|
47
|
+
end
|
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
|
+
|
45
57
|
end
|
46
58
|
|
47
59
|
private
|
data/lib/moyasar/source.rb
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
module Moyasar
|
2
|
+
class ApplePay < Source
|
3
|
+
attr_reader :company, :name, :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
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Moyasar
|
2
|
+
class STCPay < Source
|
3
|
+
attr_reader :mobile, :reference_number, :branch, :cashier, :reference_number, :transaction_url, :message
|
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
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.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdulaziz AlShetwi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-20 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
|
@@ -71,6 +73,8 @@ files:
|
|
71
73
|
- bin/console
|
72
74
|
- bin/setup
|
73
75
|
- lib/moyasar.rb
|
76
|
+
- lib/moyasar/actions/cancel.rb
|
77
|
+
- lib/moyasar/actions/capture.rb
|
74
78
|
- lib/moyasar/actions/construct.rb
|
75
79
|
- lib/moyasar/actions/create.rb
|
76
80
|
- lib/moyasar/actions/fetch.rb
|
@@ -78,6 +82,7 @@ files:
|
|
78
82
|
- lib/moyasar/actions/refund.rb
|
79
83
|
- lib/moyasar/actions/request.rb
|
80
84
|
- lib/moyasar/actions/update.rb
|
85
|
+
- lib/moyasar/actions/void.rb
|
81
86
|
- lib/moyasar/errors/account_inactive_error.rb
|
82
87
|
- lib/moyasar/errors/api_connection_error.rb
|
83
88
|
- lib/moyasar/errors/api_error.rb
|
@@ -90,8 +95,10 @@ files:
|
|
90
95
|
- lib/moyasar/payment.rb
|
91
96
|
- lib/moyasar/resource.rb
|
92
97
|
- lib/moyasar/source.rb
|
98
|
+
- lib/moyasar/sources/apple_pay.rb
|
93
99
|
- lib/moyasar/sources/credit_card.rb
|
94
100
|
- lib/moyasar/sources/sadad.rb
|
101
|
+
- lib/moyasar/sources/stc_pay.rb
|
95
102
|
- lib/moyasar/version.rb
|
96
103
|
- moyasar.gemspec
|
97
104
|
homepage: https://moyasar.com/docs/api?ruby
|
@@ -113,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
120
|
- !ruby/object:Gem::Version
|
114
121
|
version: '0'
|
115
122
|
requirements: []
|
116
|
-
|
117
|
-
rubygems_version: 2.6.11
|
123
|
+
rubygems_version: 3.0.3
|
118
124
|
signing_key:
|
119
125
|
specification_version: 4
|
120
126
|
summary: Ruby wrapper library for Moyasar Payment Service
|