package II5117351e1a4f1d07d1c88690b7a75168::mod_psigate; use strict; sub checkPGateSettings { my $class = shift; my $settings = shift; my @errors; push @errors, 'check.empty_settings' unless $settings->{mid}; @errors; } sub checkProductSettings { my $class = shift; my ($product) = @_; my @errors; @errors; } sub useCardPayment { 0 } sub go { my ($class, $pgtxn) = @_; my $settings = $pgtxn->getPGateSettings; my $sale = $pgtxn->getSale; my $prod = $sale ? $sale->getProduct : undef; my $order = $pgtxn->getOrder; my $jin_pgtxn = ref($pgtxn) . '/' . $pgtxn->id; my $descr = $pgtxn->getDescription; my $amount = $pgtxn->getAmount; my $form = { Storekey => $settings->{testmode} ? 'psigatecapturescard001010' : $settings->{mid}, Bname => $order->{user_name}, Bcompany => $order->{user_company}, Baddress1 => $order->{user_address}, Bcity => $order->{user_city}, Bprovince => $order->{user_state}, Bpostalcode => $order->{user_zipcode}, Bcountry => $order->{user_country}, Phone => $order->{user_phone}, Email => $order->{user_email}, ItemID01 => $descr, Description01 => $prod && $prod->{descr} ? $prod->{descr} : $descr, Quantity01 => 1, Price01 => $amount, ResponseFormat => 'HTML', ThanksURL => $pgtxn->getFeedbackURL('return', 'txn'), NoThanksURL => $pgtxn->getFeedbackURL('return', 'txn'), PaymentType => 'CC', CardAction => 0, }; $pgtxn->logg('REQ', $form); my $url = $settings->{testmode} ? 'https://devcheckout.psigate.com/HTMLPost/HTMLMessenger' : 'https://checkout.psigate.com/HTMLPost/HTMLMessenger'; Zen->getRequest->redirectPOST($url, $form); } sub feedbackReturnTxn { my ($class, $pgtxn) = @_; my $in = Zen->getRequest->getInput; $pgtxn->logg('RSP', $in); if ($in->{Err}) { Zen->getRequest->printHeader('text/html'); print "Error: $in->{ErrMsg}<br><a href=\"".$pgtxn->getOrder->getOrderLink."\">continue</a>"; return; } my $settings = $pgtxn->getPGateSettings; my $txn_code = "$in->{OrderID} / $in->{TransRefNumber}"; my $paymentGood = $in->{Approved} =~ /APPROVED/i && $in->{TransactionType} =~ /SALE/i ? 1 : 0; $pgtxn->txnPayment($txn_code) if $paymentGood; $pgtxn->redirectToReturnPage; } 1; 