creative-paypal-express 1.2.0 → 1.2.1

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
  SHA1:
3
- metadata.gz: e3a1313ca1047f68a9801c63c2c0eae9aaf4bc9d
4
- data.tar.gz: 4d9aeedc4d2692e2301079d42c7b3a8db94834ea
3
+ metadata.gz: c1b6637908ce92f01757f3561a0835d86e667ce2
4
+ data.tar.gz: c3c7ca0dde27ed7f3e43bc18f7e6328fdf75c99a
5
5
  SHA512:
6
- metadata.gz: e942250f8683e6f2d07e8d1c140679fce166365c64082df09e120717b81608a1db38f0d0745ac75768d2276b46141a87a80b90bd7297aefef7a120737b335e0c
7
- data.tar.gz: b3ebea5d48de225090e9ad354836b91f0bc65f12f55cd90f7ce0659e63f394becc6609af79cf8445f52016ef384b6087d0359a0c80bc96a9f2e366117a8b7106
6
+ metadata.gz: 320892ab92f76b77fef75b53044c77f10c1fa3a153ad41ea0cfaf137d6e794f33827adf5f47603c451fae7e98df2f038516a1f10b4f422fb3ecdd1245e97947d
7
+ data.tar.gz: 06323e9c79aea9270dc3665c054ebd56854ec62dee1dc012804a98cc75f1de0691c8cb6bf2d325a7de2be8b4f61297cfaeadd201c5a620b370ad5f829f6e4b8e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v1.2.1
2
+ __Updated:__
3
+ - Subscription amendment now takes mandatory currency_code option.
4
+
5
+ ```rb
6
+ Paypal::Express::Request.new(params).amend!("profile_id", {amount: 19.95, currency_code: "EUR", note: "will show up in email and profile logs"})
7
+ ```
8
+
1
9
  ## v1.2.0
2
10
  __Added:__
3
11
  - Ability to amend a created paypal subscription (its amount)
data/README.md CHANGED
@@ -7,7 +7,7 @@ Express Checkout for Digital Goods is also supported.
7
7
  ## Installation
8
8
 
9
9
  ```rb
10
- gem "creative-paypal-express", "~> 1.2.0"
10
+ gem "creative-paypal-express", "~> 1.2.1"
11
11
  ```
12
12
 
13
13
  ## Usage
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
@@ -135,7 +135,8 @@ module Paypal
135
135
  :PROFILEID => profile_id,
136
136
  :NOTE => options[:note],
137
137
  :AMT => options[:amount].presence || (raise ArgumentError.new(":amount option missing!")), # Paypal accepts 19.95 type decimals
138
- }
138
+ :CURRENCYCODE => options[:currency_code].presence || (raise ArgumentError.new(":currency_code option missing!")), # "EUR"
139
+ }.select{|k, v| v.present?}
139
140
 
140
141
  response = request(:UpdateRecurringPaymentsProfile, params)
141
142
  return Response.new(response)
@@ -489,21 +489,36 @@ describe Paypal::Express::Request do
489
489
  end
490
490
 
491
491
  describe "#amend!(profile_id, options={})" do
492
- it "should raise ArgumentError if :amount not passed" do
493
- expect{instance.amend!('profile_id')}.to raise_error(ArgumentError, ":amount option missing!")
492
+ context "when calling with mandatory options missing" do
493
+ it "should raise ArgumentError" do
494
+ expect{instance.amend!('profile_id', {currency_code: "EUR"})}.to raise_error(ArgumentError, ":amount option missing!")
495
+ expect{instance.amend!('profile_id', {amount: 19.95})}.to raise_error(ArgumentError, ":currency_code option missing!")
496
+ end
497
+ end
498
+
499
+ context "when calling with note option" do
500
+ it "should call UpdateRecurringPaymentsProfile with correct method and params" do
501
+ expect{instance.amend!('profile_id', {note: "test changes", amount: 19.95, currency_code: "EUR"})}.
502
+ to request_to(nvp_endpoint, :post)
503
+
504
+ expect(instance._method_).to eq :UpdateRecurringPaymentsProfile
505
+ expect(instance._sent_params_).to eq({:PROFILEID => 'profile_id', :NOTE => "test changes", CURRENCYCODE: "EUR", :AMT => 19.95})
506
+ end
494
507
  end
495
508
 
496
- it "should call UpdateRecurringPaymentsProfile" do
497
- expect{instance.amend!('profile_id', {note: "test changes", amount: 19.95})}.
498
- to request_to(nvp_endpoint, :post)
509
+ context "when calling without note option" do
510
+ it "should call UpdateRecurringPaymentsProfile with correct method and params" do
511
+ expect{instance.amend!('profile_id', {amount: 19.95, currency_code: "EUR"})}.
512
+ to request_to(nvp_endpoint, :post)
499
513
 
500
- expect(instance._method_).to eq :UpdateRecurringPaymentsProfile
501
- expect(instance._sent_params_).to eq({:PROFILEID => 'profile_id', :NOTE => "test changes", :AMT => 19.95})
514
+ expect(instance._method_).to eq :UpdateRecurringPaymentsProfile
515
+ expect(instance._sent_params_).to eq({:PROFILEID => 'profile_id', CURRENCYCODE: "EUR", :AMT => 19.95})
516
+ end
502
517
  end
503
518
 
504
519
  it 'should return Paypal::Express::Response' do
505
520
  fake_response 'UpdateRecurringPaymentsProfile/success'
506
- response = instance.amend!('profile_id', {note: "test changes", amount: 19.95})
521
+ response = instance.amend!('profile_id', {note: "test changes", currency_code: "EUR", amount: 19.95})
507
522
 
508
523
  expect(response.class).to eq Paypal::Express::Response
509
524
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creative-paypal-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-21 00:00:00.000000000 Z
12
+ date: 2017-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport