Skip to content

Commit

Permalink
added week as billing period - changes by aossowski
Browse files Browse the repository at this point in the history
  • Loading branch information
jhliberty committed Dec 9, 2011
1 parent c397a92 commit e6f9089
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions lib/paypal/recurring/request.rb
Expand Up @@ -23,12 +23,14 @@ class Request

PERIOD = {
:daily => "Day",
:weekly => "Weekly",
:monthly => "Month",
:yearly => "Year"
}

TRIAL_PERIOD = {
:daily => "Day",
:weekly => "Weekly",
:monthly => "Month",
:yearly => "Year"
}
Expand All @@ -37,6 +39,13 @@ class Request
:next_billing => "AddToNextBilling",
:no_auto => "NoAutoBill"
}

REFUNDTYPE = {
:full => "Full",
:partial => "Partial",
:external => "ExternalDispute",
:other => "Other",
}

ATTRIBUTES = {
:action => "ACTION",
Expand Down
7 changes: 4 additions & 3 deletions lib/paypal/recurring/response/profile.rb
Expand Up @@ -36,9 +36,10 @@ class Profile < Base
}

PERIOD = {
"Month" => :monthly,
"Year" => :yearly,
"Day" => :daily
"Month" => :monthly,
"Weekly" => :weekly,
"Year" => :yearly,
"Day" => :daily
}

def active?
Expand Down
2 changes: 2 additions & 0 deletions spec/paypal/request_spec.rb
Expand Up @@ -79,12 +79,14 @@

it "normalizes period" do
subject.normalize_params(:period => :monthly).should == {:BILLINGPERIOD => "Month"}
subject.normalize_params(:period => :monthly).should == {:BILLINGPERIOD => "Weekly"}
subject.normalize_params(:period => :daily).should == {:BILLINGPERIOD => "Day"}
subject.normalize_params(:period => :yearly).should == {:BILLINGPERIOD => "Year"}
end

it "normalizes trial period" do
subject.normalize_params(:trial_period => :monthly).should == {:TRIALBILLINGPERIOD => "Month"}
subject.normalize_params(:trial_period => :monthly).should == {:TRIALBILLINGPERIOD => "Weekly"}
subject.normalize_params(:trial_period => :daily).should == {:TRIALBILLINGPERIOD => "Day"}
subject.normalize_params(:trial_period => :yearly).should == {:TRIALBILLINGPERIOD => "Year"}
end
Expand Down

0 comments on commit e6f9089

Please sign in to comment.