if ($cc_args->{processor} eq 'Stripe') { # Stripe
my $stripe = Business::Stripe->new(-api_key => $psettings->{secretkey});
$stripe->charges_create(
- amount => $total_paid,
+ amount => int($total_paid * 100.0), # Stripe takes amount in pennies
card => $cc_args->{stripe_token},
description => $cc_args->{note}
);
return OpenILS::Event->new(
"SUCCESS", payload => {
map { $_ => $stripe->success->{$_} } qw(
- invoice customer balance_transaction id created
+ invoice customer balance_transaction id created card
)
}
);
approval_code (for out-of-band payment)
type (for out-of-band payment)
number (for call to payment processor)
+ stripe_token (for call to Stripe payment processor)
expire_month (for call to payment processor)
expire_year (for call to payment processor)
billing_first (for out-of-band payments and for call to payment processor)
if ($payobj->has_field('cc_number')) {
$payobj->cc_number(substr($cc_args->{number}, -4));
}
- if ($payobj->has_field('expire_month')) { $payobj->expire_month($cc_args->{expire_month}); }
+ if ($payobj->has_field('expire_month')) { $payobj->expire_month($cc_args->{expire_month}); $logger->info("LFW XXX expire_month is $cc_args->{expire_month}"); }
if ($payobj->has_field('expire_year')) { $payobj->expire_year($cc_args->{expire_year}); }
# Note: It is important not to set approval_code
}
}
+ # Urgh, clean up this mega-function one day.
+ if ($cc_processor eq 'Stripe' and $approval_code and $cc_payload) {
+ $payment->expire_month($cc_payload->{card}{exp_month});
+ $payment->expire_year($cc_payload->{card}{exp_year});
+ $payment->cc_number($cc_payload->{card}{last4});
+ }
+
$payment->approval_code($approval_code) if $approval_code;
$payment->cc_order_number($cc_order_number) if $cc_order_number;
$payment->cc_type($cc_type) if $cc_type;