Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Add ability to specify TOTALBILLINGCYCLES when creating recurring profil... #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/paypal/recurring/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Base
attr_accessor :refund_type
attr_accessor :return_url
attr_accessor :start_at
attr_accessor :billing_length
attr_accessor :token
attr_accessor :transaction_id
attr_accessor :item_category
Expand Down Expand Up @@ -188,6 +189,7 @@ def create_recurring_profile
:ipn_url,
:frequency,
:period,
:billing_length,
:email,
:trial_length,
:trial_period,
Expand Down
1 change: 1 addition & 0 deletions lib/paypal/recurring/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Request
:payer_id => "PAYERID",
:payment_action => "PAYMENTREQUEST_0_PAYMENTACTION",
:period => "BILLINGPERIOD",
:billing_length => "TOTALBILLINGCYCLES",
:profile_id => "PROFILEID",
:reference => ["PROFILEREFERENCE", "PAYMENTREQUEST_0_CUSTOM", "PAYMENTREQUEST_0_INVNUM"],
:refund_type => "REFUNDTYPE",
Expand Down
4 changes: 4 additions & 0 deletions spec/paypal/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,9 @@
it "normalizes locale" do
subject.normalize_params(:locale => :us).should == {:LOCALECODE => "US"}
end

it "normalizes billing length" do
subject.normalize_params(:billing_length => 1).should == {:TOTALBILLINGCYCLES => 1}
end
end
end
3 changes: 2 additions & 1 deletion spec/paypal/response/create_recurring_profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
:payer_id => "D2U7M6PTMJBML",
:start_at => Time.now,
:failed => 1,
:outstanding => :next_billing
:outstanding => :next_billing,
:billing_length => 1
})
ppr.create_recurring_profile
}
Expand Down