package II91b44bcd1a3177752576e3bb07b6182d; use strict 'vars'; use LWP::UserAgent; use IIedc3417b3b246250508c70cb08344002; use II8721cc6465d134809ce288833c808242; use II040d1645cc3e327e8ed2b5eb9fb581ff; use IIf62e762f48ca931b1ec3c151acf92dba; BEGIN{*II91b44bcd1a3177752576e3bb07b6182d::llIllllIlllIIIIl=\%{pack('H6','087360')^'M=6'};*II91b44bcd1a3177752576e3bb07b6182d::lllIllIIllIlIIll=\&{pack('H24','53225a51066f24727125370d')^'>C3?<UWJFGO9'};$II91b44bcd1a3177752576e3bb07b6182d::IIIllIIIIlIlllII=pack('H18','0f07111b1c05036710')^'GSEKCML4D';$II91b44bcd1a3177752576e3bb07b6182d::IlIllIIlIIIlIIII=pack('H12','0c73027a1811')^'F:L6QR'};sub mnt_display { my ($class, $C) = @_; my $in = $C->{INPUT}; my $uq = ($C->{uq} or die "uq is expected in CTX")->getDecorated; my $quest = $uq->getQuest; my @items = $quest->getItems; my $triggerdata = $uq->unpackTriggerdata; my $triggerdatalist = $C->{TriggerDataList} = [map { $triggerdata->{$_} } grep { $_ } split ',', $quest->{api_post_quest}]; return if $uq->{complete}; my $dummyUq = II91b44bcd1a3177752576e3bb07b6182d::lllIllIIllIlIIll($II040d1645cc3e327e8ed2b5eb9fb581ff::IlIIllIIlIlIlllI{$II040d1645cc3e327e8ed2b5eb9fb581ff::llIIIIIllIIIIlll},999,$II040d1645cc3e327e8ed2b5eb9fb581ff::IlIIllIIlIlIlllI{$IIf62e762f48ca931b1ec3c151acf92dba::IIllIIIIlllllIII})->get($uq->{id})->set(_quest_object => $quest); { my $curr_ui = II8721cc6465d134809ce288833c808242::lIIlIIlIIIllIllI($II8721cc6465d134809ce288833c808242::llIIIIIIllIIIIII{$IIf62e762f48ca931b1ec3c151acf92dba::lIIllllllIlllIII},995,$II8721cc6465d134809ce288833c808242::llIIIIIIllIIIIII{$II91b44bcd1a3177752576e3bb07b6182d::IlIllIIlIIIlIIII})->URLUnpack($uq->{userinput}); for (my $c = 1; $c <= @items; $c++) { if (my $v = $curr_ui->{"value$c"}) { $dummyUq->{ 'item' . $items[$c - 1]->{id} } = $v; } } } my $form = $C->{Form} = $dummyUq->getView(II8721cc6465d134809ce288833c808242::IIlIIlIIllIIIlll($IIf62e762f48ca931b1ec3c151acf92dba::llIlIlIIIllllIll{$IIedc3417b3b246250508c70cb08344002::IIIIllIllIIIllIl},844,$IIf62e762f48ca931b1ec3c151acf92dba::llIlIlIIIllllIll{$II8721cc6465d134809ce288833c808242::llIlllIlIIlIIIll})); return unless $in->{"submitQuest$uq->{id}"}; $form->process; my $c = 0; my %userinput = ( numitems => scalar(@items), map { $c++; my @a = ( "field$c", $_->{title}, "value$c", $dummyUq->{"item$_->{id}"} ); @a; } @items ); $uq->{userinput} = IIf62e762f48ca931b1ec3c151acf92dba::IIIIIlIIIlIIllll($IIf62e762f48ca931b1ec3c151acf92dba::lIIllIIlllllIllI{$II8721cc6465d134809ce288833c808242::lIIllIIllllllIII},995,$IIf62e762f48ca931b1ec3c151acf92dba::lIIllIIlllllIllI{$IIedc3417b3b246250508c70cb08344002::IlIlIIlIlIlIlIII})->URLPack(\%userinput); $uq->save; return if $form->{errors}; my $api_post_all_good = 1; if ($quest->{api_post_quest}) { for my $tdata (@$triggerdatalist) { next if $tdata->{ok} == 1; my $apipost = IIf62e762f48ca931b1ec3c151acf92dba::IIIIIlIIIlIIllll($IIedc3417b3b246250508c70cb08344002::IlllIlIIIlIIIllI{$II8721cc6465d134809ce288833c808242::llIllllllIlllIII},48,$IIedc3417b3b246250508c70cb08344002::IlllIlIIIlIIIllI{$IIf62e762f48ca931b1ec3c151acf92dba::lIllIlIlllIIIIlI})->get($tdata->{id}); next unless $apipost->stored; next unless $apipost->hasEvent('create'); my ($post_success, $post_message) = $uq->prepareCtxAndSendAPIPost($apipost, \%userinput, 'create'); $tdata->{ok} = $post_success ? 1 : 0; $tdata->{text} = $post_message; $api_post_all_good = 0 unless $post_success; if ($uq->{sale_id}) { $uq->getSale->getOrder->getSyslog->put( $post_success ? "done API Post (questionnaire: on create) #$apipost->{id} to $apipost->{url}" : "error doing API Post (questionnaire: on create) #$apipost->{id} to $apipost->{url}: $post_message" ); } } $uq->packTriggerdata($triggerdata); $uq->save; } return unless $api_post_all_good; $uq->{complete} = 1; $uq->save; Zen->getRequest->redirect($uq->getSale->getThankLink . "?redirect=$$") if $quest->{blocking}; return; } 1; 