utility to combine PaymentTransactionInfoPlugins

Maybe the pull request can be simplified to hide internal changes that aren't interesting after the fact
Does ruby give me clone for free? I assumed that I had to manually do the
clone 'cause it's not implemented for the object I'm cloning but maybe ruby
does it for me and I can just .clone?


On Sat, Aug 16, 2014 at 3:05 PM, Kevin Postlewaite <
kevinpostlewaite@gmail.com> wrote:

> I still need to clone the object: I can't just return.
>
>
> On Sat, Aug 16, 2014 at 8:41 AM, Pierre-Alexandre Meyer <
> notifications@github.com> wrote:
>
>> In lib/killbill/helpers/utils.rb:
>>
>> > +        if t1.nil?
>> > +          return nil if t2.nil?
>> > +          t1=t2
>> > +          t2=nil
>> > +        end
>> > +
>> > +        # Create the combined transaction info and set the values
>> > +        t3=Killbill::Plugin::Model::PaymentTransactionInfoPlugin.new
>> > +        t3.kb_payment_id=t1.kb_payment_id
>> > +        t3.kb_transaction_payment_id=t1.kb_transaction_payment_id
>> > +        t3.transaction_type=t1.transaction_type
>> > +        t3.amount=t1.amount
>> > +        t3.currency=t1.currency
>> > +        t3.created_date=t1.created_date
>> > +        t3.effective_date=t1.effective_date
>> > +        t3.status=t1.status==:PROCESSED && ( t2.nil? || t2.status==:PROCESSED) ? :PROCESSED : :ERROR
>>
>> Oh, right, I see it now. I would simplify it indeed: if t2 is nil,
>> return t1 and if t1 is nil, return t2. In both cases, if the other one
>> is nil too, we would return nil, which is fine.
>>
>> —
>> Reply to this email directly or view it on GitHub
>> <https://github.com/killbill/killbill-plugin-framework-ruby/pull/4/files#r16325315>
>> .
>>
>
>
>
> --
> Kevin Postlewaite
>



-- 
Kevin Postlewaite