spree_cod_payment 2.1.5 → 2.1.6
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/LICENSE +21 -0
- data/README.md +37 -1
- data/lib/spree_cod_payment/version.rb +1 -1
- metadata +5 -5
- data/LICENSE.md +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 072c0fb115ffe57b9ef898a4e4302277c77aa4b312cf4d7478301ff8c002ff39
|
|
4
|
+
data.tar.gz: ec31dc0fac14b895b973706a80767a95ebd47f949d36c11dc53c116126db362b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 930c01febe106423066542d298faa9824c7161a8b3eb51ced8068dd80805a0c064403ab6aebbec021d7e6ca828525dfc96eeff30e037270419f1dbe83342398a
|
|
7
|
+
data.tar.gz: cfe061924bce0d3cbae8af428974df1c5588ea9150652096278a3a62239535aaed3dbc3f57ee6f03261f10656600431fe1d1219ad68e5a31c2b624d29e66e345
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OlympusOne
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -22,6 +22,42 @@ This is a Cash On Delivery Payment extension for [Spree Commerce](https://spreec
|
|
|
22
22
|
|
|
23
23
|
If your server was running, restart it so that it can find the assets properly.
|
|
24
24
|
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
1. Create a Payment Method for Cash on Delivery (e.g. name: "Cash on Delivery") whose `method_type` is `cod_payment`.
|
|
28
|
+
2. This gem supplies helpers:
|
|
29
|
+
* `payment_method.cod_payment?`
|
|
30
|
+
* `payment_method.cod_payment_available?(order)` (true when the order’s shipping method supports COD)
|
|
31
|
+
3. To show the COD payment method ONLY when eligible (and optionally hide it for store pickup), add a decorator in the host app:
|
|
32
|
+
|
|
33
|
+
````ruby
|
|
34
|
+
module Spree
|
|
35
|
+
module PaymentMethodDecorator
|
|
36
|
+
def available_for_order?(order)
|
|
37
|
+
return false unless super
|
|
38
|
+
|
|
39
|
+
# Show COD only when shipping method allows it.
|
|
40
|
+
if cod_payment_available?(order)
|
|
41
|
+
return cod_payment?
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# If integrating with store pickup (from spree_store_pickup):
|
|
45
|
+
if respond_to?(:store_pickup_available?) && store_pickup_available?(order)
|
|
46
|
+
return false if cod_payment? # Hide COD during pickup
|
|
47
|
+
return !cod_payment? # Allow other methods
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Hide specialized method when its condition is not met.
|
|
51
|
+
return false if cod_payment?
|
|
52
|
+
|
|
53
|
+
true
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
PaymentMethod.prepend PaymentMethodDecorator
|
|
58
|
+
end
|
|
59
|
+
````
|
|
60
|
+
|
|
25
61
|
## Developing
|
|
26
62
|
|
|
27
63
|
1. Create a dummy app
|
|
@@ -61,4 +97,4 @@ If you'd like to contribute, please take a look at the
|
|
|
61
97
|
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
|
62
98
|
pull request.
|
|
63
99
|
|
|
64
|
-
Copyright (c)
|
|
100
|
+
Copyright (c) 2026 OlympusOne, released under the MIT License.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cod_payment
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OlympusOne
|
|
@@ -85,7 +85,7 @@ executables: []
|
|
|
85
85
|
extensions: []
|
|
86
86
|
extra_rdoc_files: []
|
|
87
87
|
files:
|
|
88
|
-
- LICENSE
|
|
88
|
+
- LICENSE
|
|
89
89
|
- README.md
|
|
90
90
|
- Rakefile
|
|
91
91
|
- app/models/spree/payment_method/cod_payment.rb
|
|
@@ -109,13 +109,13 @@ files:
|
|
|
109
109
|
- lib/spree_cod_payment/version.rb
|
|
110
110
|
homepage: https://github.com/olympusone/spree_cod_payment
|
|
111
111
|
licenses:
|
|
112
|
-
-
|
|
112
|
+
- MIT
|
|
113
113
|
metadata:
|
|
114
114
|
bug_tracker_uri: https://github.com/olympusone/spree_cod_payment/issues
|
|
115
|
-
changelog_uri: https://github.com/olympusone/spree_cod_payment/releases/tag/v2.1.
|
|
115
|
+
changelog_uri: https://github.com/olympusone/spree_cod_payment/releases/tag/v2.1.6
|
|
116
116
|
documentation_uri: https://github.com/olympusone/spree_cod_payment
|
|
117
117
|
homepage_uri: https://github.com/olympusone/spree_cod_payment
|
|
118
|
-
source_code_uri: https://github.com/olympusone/spree_cod_payment/tree/v2.1.
|
|
118
|
+
source_code_uri: https://github.com/olympusone/spree_cod_payment/tree/v2.1.6
|
|
119
119
|
rdoc_options: []
|
|
120
120
|
require_paths:
|
|
121
121
|
- lib
|
data/LICENSE.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# LICENSE
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 OlympusOne. All rights reserved.
|
|
4
|
-
|
|
5
|
-
This program is free software: you can redistribute it and/or modify it under the terms of the
|
|
6
|
-
GNU Affero General Public License as published by the Free Software Foundation, either
|
|
7
|
-
version 3 of the License, or any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
|