webpay 3.2.0 → 3.2.1
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/lib/webpay.rb +1 -1
- data/lib/webpay/charge.rb +2 -2
- data/lib/webpay/data_types.rb +65 -0
- data/webpay.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78307f5c91271a987bbaa3b55a37e5c1772a07d3
|
4
|
+
data.tar.gz: 247c7932211d2aca377458331f7308a8eff46586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d84730f96e52fef12aee659f3db2e86c3dfe30643779eb377d3d421305138f18c67965fc881a12f8ec8f1d19dad0bca976dc1747dbdbfb08c7225f65a5edb034
|
7
|
+
data.tar.gz: 95af13dfe005a73359470a7a6c06808baf32b6f290b74157c84863b409995fb91c5df9c736faf7a6f90717febfee39ddc15abee1803dad7cf8a30cac6315b076
|
data/lib/webpay.rb
CHANGED
data/lib/webpay/charge.rb
CHANGED
@@ -23,10 +23,10 @@ class WebPay::Charge < WebPay::ApiResource
|
|
23
23
|
# Refund a paid charge specified by charge id.
|
24
24
|
# Optional argument amount is to refund partially.
|
25
25
|
#
|
26
|
-
# @param params [
|
26
|
+
# @param params [ChargeRequestRefund|Hash] Parameters to API call
|
27
27
|
# @return [ChargeResponse]
|
28
28
|
def refund(params = {})
|
29
|
-
req = WebPay::
|
29
|
+
req = WebPay::ChargeRequestRefund.create(params)
|
30
30
|
raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'refund', req)
|
31
31
|
WebPay::ChargeResponse.new(raw_response)
|
32
32
|
end
|
data/lib/webpay/data_types.rb
CHANGED
@@ -477,6 +477,71 @@ class WebPay
|
|
477
477
|
attributes['id'] = value
|
478
478
|
end
|
479
479
|
|
480
|
+
end
|
481
|
+
class ChargeRequestRefund < Entity
|
482
|
+
attr_reader :attributes
|
483
|
+
|
484
|
+
def self.fields
|
485
|
+
['id', 'amount', 'uuid']
|
486
|
+
end
|
487
|
+
|
488
|
+
|
489
|
+
def self.create(params)
|
490
|
+
return params if params.is_a?(self)
|
491
|
+
hash = case params
|
492
|
+
when Hash; params
|
493
|
+
when WebPay::ChargeResponse; {'id' => params.id}
|
494
|
+
when String; {'id' => params}
|
495
|
+
else
|
496
|
+
raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
|
497
|
+
end
|
498
|
+
self.new(hash)
|
499
|
+
end
|
500
|
+
|
501
|
+
def initialize(hash = {})
|
502
|
+
hash = normalize_hash(hash)
|
503
|
+
@attributes = hash
|
504
|
+
end
|
505
|
+
|
506
|
+
|
507
|
+
def request_body
|
508
|
+
result = {}
|
509
|
+
copy_if_exists(@attributes, result, 'amount', 'request_body');
|
510
|
+
copy_if_exists(@attributes, result, 'uuid', 'request_body');
|
511
|
+
result
|
512
|
+
end
|
513
|
+
|
514
|
+
def query_params
|
515
|
+
result = {}
|
516
|
+
return result
|
517
|
+
end
|
518
|
+
|
519
|
+
|
520
|
+
# attributes accessors
|
521
|
+
def id
|
522
|
+
attributes['id']
|
523
|
+
end
|
524
|
+
|
525
|
+
def id=(value)
|
526
|
+
attributes['id'] = value
|
527
|
+
end
|
528
|
+
|
529
|
+
def amount
|
530
|
+
attributes['amount']
|
531
|
+
end
|
532
|
+
|
533
|
+
def amount=(value)
|
534
|
+
attributes['amount'] = value
|
535
|
+
end
|
536
|
+
|
537
|
+
def uuid
|
538
|
+
attributes['uuid']
|
539
|
+
end
|
540
|
+
|
541
|
+
def uuid=(value)
|
542
|
+
attributes['uuid'] = value
|
543
|
+
end
|
544
|
+
|
480
545
|
end
|
481
546
|
class ChargeRequestWithAmount < Entity
|
482
547
|
attr_reader :attributes
|
data/webpay.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'webpay'
|
5
|
-
spec.version = '3.2.
|
5
|
+
spec.version = '3.2.1'
|
6
6
|
spec.authors = ['webpay', 'tomykaira']
|
7
7
|
spec.email = ['administrators@webpay.jp', 'tomykaira@webpay.jp']
|
8
8
|
spec.description = 'WebPay is payment gateway service in Japan. see also https://webpay.jp/'
|