Business-OnlinePayment-Litle

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

  Author: Jason Hall <jayce@lug-nut.com>
  Date : 2017-10-23 09:15:32 +0000

    Upload a test updater batch for testing/validation. Doesn't currently
    have the full suite, but was enough to prove validity 

  Change: 6a29587043cf14cceb105a8a893164197c579232
  Author: Jason Hall <jayce@lug-nut.com>
  Date : 2017-10-23 09:11:09 +0000

    Small error with upload, the XML object didn't have the 'new'
    correctly, and a legacy bug where it tried to use sftp->message which
    isn't a method. 

  Change: bd2034fc808e0fee6b09b57fd0afc4d1c0bf6d2d
  Author: Jason Hall <jayce@lug-nut.com>
  Date : 2017-08-29 09:21:00 +0000

    Fix some annoying whitespace, added in missing Address2 line from
    normal payment information 

README  view on Meta::CPAN


    $tx->format_phone_field( \%content, 'company_phone' );

 map_request

    Converts the BOP data to something that Litle can use.

 chargeback_retrieve_support_doc

    A new method not directly supported by BOP. Retrieve a currently
    uploaded file

     $tx->content(
      login       => 'testdrive',
      password    => '123qwe',
      merchantid  => '123456',
      case_id     => '001',
      filename    => 'mydoc.pdf',
     );
     $tx->chargeback_retrieve_support_doc();
     $myFileData = $tx->{'fileContent'};

 chargeback_delete_support_doc

    A new method not directly supported by BOP. Delete a currently uploaded
    file. Follows the same format as chargeback_retrieve_support_doc

 chargeback_upload_support_doc

    A new method not directly supported by BOP. Upload a new file

     $tx->content(
      login       => 'testdrive',
      password    => '123qwe',
      merchantid  => '123456',
      case_id     => '001',
      filename    => 'mydoc.pdf',
      filecontent => $binaryPdfData,
      mimetype    => 'application/pdf',
     );
     $tx->chargeback_upload_support_doc();

 chargeback_replace_support_doc

    A new method not directly supported by BOP. Replace a previously
    uploaded file. Follows the same format as chargeback_upload_support_doc

 chargeback_list_support_docs

    A new method not directly supported by BOP. Return a hashref that
    contains a list of files that already exist on the server.

     $tx->content(
      login       => 'testdrive',
      password    => '123qwe',
      merchantid  => '123456',

lib/Business/OnlinePayment/Litle.pm  view on Meta::CPAN

    if ($self->is_success) { $self->{'fileContent'} = $self->{'server_response_dangerous'}; } else { $self->{'fileContent'} = undef; }
}


sub chargeback_delete_support_doc {
    my ( $self ) = @_;
    $self->_litle_support_doc('DELETE' );
}


sub chargeback_upload_support_doc {
    my ( $self ) = @_;
    $self->_litle_support_doc('UPLOAD' );
}


sub chargeback_replace_support_doc {
    my ( $self ) = @_;
    $self->_litle_support_doc('REPLACE' );
}

lib/Business/OnlinePayment/Litle.pm  view on Meta::CPAN


$tx->format_phone_field( \%content, 'company_phone' );

=head2 map_request

Converts the BOP data to something that Litle can use.

=head2 chargeback_retrieve_support_doc

A new method not directly supported by BOP.
Retrieve a currently uploaded file

 $tx->content(
  login       => 'testdrive',
  password    => '123qwe',
  merchantid  => '123456',
  case_id     => '001',
  filename    => 'mydoc.pdf',
 );
 $tx->chargeback_retrieve_support_doc();
 $myFileData = $tx->{'fileContent'};

=head2 chargeback_delete_support_doc

A new method not directly supported by BOP.
Delete a currently uploaded file.  Follows the same format as chargeback_retrieve_support_doc

=head2 chargeback_upload_support_doc

A new method not directly supported by BOP.
Upload a new file

 $tx->content(
  login       => 'testdrive',
  password    => '123qwe',
  merchantid  => '123456',
  case_id     => '001',
  filename    => 'mydoc.pdf',
  filecontent => $binaryPdfData,
  mimetype    => 'application/pdf',
 );
 $tx->chargeback_upload_support_doc();

=head2 chargeback_replace_support_doc

A new method not directly supported by BOP.
Replace a previously uploaded file.  Follows the same format as chargeback_upload_support_doc

=head2 chargeback_list_support_docs

A new method not directly supported by BOP.
Return a hashref that contains a list of files that already exist on the server.

 $tx->content(
  login       => 'testdrive',
  password    => '123qwe',
  merchantid  => '123456',

t/chargeback.t  view on Meta::CPAN

# Litle says to use the following line... but it fails
#$caseid = $merchantid . '001'; # Litle says use this for the test case #1
SKIP: {
    skip "Test 1 case_id.  No Test Account setup",6 if ! $authed;
    my ($resp_validation) = grep { $_->{'currentQueue'} eq 'Merchant' } @{ $chargeback_activity };
    if (defined $resp_validation && $resp_validation->case_id) { $caseid = $resp_validation->case_id; }
    is( $caseid > 0, 1, "Caseid found: " . $caseid );
}
note "Test Case #1 ($caseid)";

# Litle cleanup, make sure no files we are about to upload already exist
clean_test($authed,$caseid,\%orig_content,$data,$tx);

# Litle test 1 upload all documents
SKIP: {
    skip "chargeback_upload_support_doc.  No caseid found",6 if $caseid == 0;
    my %content = %orig_content;
    $content{'case_id'} = $caseid;

    foreach $filePTR ( @{ $data->{'test_images'} } ) {
        $content{'filename'} = $filePTR->{'filename'};
        $content{'filecontent'} = $filePTR->{'filecontent'};
        $content{'mimetype'} = $filePTR->{'mimetype'};
        $tx->content(%content);
        $chargeback_list = $tx->chargeback_upload_support_doc();
        is( $tx->is_success, 1, "Chargeback upload: " . $content{'filename'} );
        is( $tx->result_code, '000', "result_code(): RESULT" );
        is( $tx->error_message, 'Success', "error_message(): RESULT" );
        if ($tx->result_code eq '005') {
            diag('-'x70);
            diag('Result code 005 means that someone probably aborted the last test sequence early');
            diag('-'x70);
        }
    }
}

t/chargeback.t  view on Meta::CPAN

        is( $tx->result_code, '000', "result_code(): RESULT" );
        is( $tx->error_message, 'Success', "error_message(): RESULT" );
    }
}

# Litle test 6, delete a document
SKIP: {
    skip "chargeback_delete_support_doc.  No caseid found",6 if $caseid == 0;
    my %content = %orig_content;
    $content{'case_id'} = $caseid;
    # Note the delete test must run, or it will make the next "upload" test sequence fail

    $filePTR = $data->{'test_images'}[0];
    $content{'filename'} = $filePTR->{'filename'};
    $tx->content(%content);
    $chargeback_list = $tx->chargeback_delete_support_doc();
    is( $tx->is_success, 1, "Chargeback delete: " . $content{'filename'} );
    is( $tx->result_code, '000', "result_code(): RESULT" );
    is( $tx->error_message, 'Success', "error_message(): RESULT" );
}

t/chargeback.t  view on Meta::CPAN

# Litle says to use the following line... but it fails
#$caseid = $merchantid . '002'; # Litle says use this for the test case #1
SKIP: {
    skip "Test 2 case_id.  No Test Account setup",6 if ! $authed;
    my ($resp_validation) = grep { $_->{'currentQueue'} ne 'Merchant' } @{ $chargeback_activity };
    if (defined $resp_validation && $resp_validation->case_id) { $caseid = $resp_validation->case_id; }
    is( $caseid > 0, 1, "Caseid found: " . $caseid );
}
note "Test Case #2 ($caseid)";

# Litle cleanup, make sure no files we are about to upload already exist
clean_test($authed,$caseid,\%orig_content,$data,$tx);

# Litle Test case #2 parts 1 and 2
SKIP: {
    skip "chargeback_upload_support_doc.  No caseid found",6 if $caseid == 0;
    my %content = %orig_content;
    $content{'case_id'} = $caseid;

    foreach $filePTR ( @{ $data->{'test_images'} } ) {
        $content{'filename'} = $filePTR->{'filename'};
        $content{'filecontent'} = $filePTR->{'filecontent'};
        $content{'mimetype'} = $filePTR->{'mimetype'};
        $tx->content(%content);
        $chargeback_list = $tx->chargeback_upload_support_doc();
        is( $tx->is_success, 0, "Chargeback upload: " . $content{'filename'} );
        is( $tx->result_code, '010', "result_code(): RESULT" );
        is( $tx->error_message, 'Case not in valid cycle', "error_message(): RESULT" );
    last; # only need to upload one
    }
}

$caseid = 0;
# Litle says to use the following line... but it fails
#$caseid = $merchantid . '003'; # Litle says use this for the test case #1
SKIP: {
    skip "Test 3 case_id.  No Test Account setup",6 if ! $authed;
    my ($resp_validation) = grep { $_->{'currentQueue'} ne 'Merchant' } @{ $chargeback_activity };
    if (defined $resp_validation && $resp_validation->case_id) { $caseid = $resp_validation->case_id; }
    is( $caseid > 0, 1, "Caseid found: " . $caseid );
}
note "Test Case #3 ($caseid)";

# Litle cleanup, make sure no files we are about to upload already exist
clean_test($authed,$caseid,\%orig_content,$data,$tx);

# Litle Test case #3 parts 1 and 2
SKIP: {
    skip "chargeback_upload_support_doc.  No caseid found",6 if $caseid == 0;
    my %content = %orig_content;
    $content{'case_id'} = $caseid;

    $filePTR = $data->{'test_images'}[0];
    $content{'filename'} = $filePTR->{'filename'};
    $content{'filecontent'} = $filePTR->{'filecontent'};
    $content{'mimetype'} = $filePTR->{'mimetype'};
    $tx->content(%content);
    $chargeback_list = $tx->chargeback_upload_support_doc();
    is( $tx->is_success, 0, "Chargeback upload: " . $content{'filename'} );
    is( $tx->result_code, '004', "result_code(): RESULT" );
    is( $tx->error_message, 'Case Not In Merchant Queue', "error_message(): RESULT" );
}

$caseid = 0;
# Litle says to use the following line... but it fails
#$caseid = $merchantid . '004'; # Litle says use this for the test case #1
SKIP: {
    skip "Test 4 case_id.  No Test Account setup",6 if ! $authed;
    my ($resp_validation) = grep { $_->{'currentQueue'} eq 'Merchant' } @{ $chargeback_activity };
    if (defined $resp_validation && $resp_validation->case_id) { $caseid = $resp_validation->case_id; }
    is( $caseid > 0, 1, "Caseid found: " . $caseid );
}
note "Test Case #4 ($caseid)";

# Litle cleanup, make sure no files we are about to upload already exist
clean_test($authed,$caseid,\%orig_content,$data,$tx);

# Litle Test case #4 parts 1 and 2
SKIP: {
    skip "chargeback_upload_support_doc.  No caseid found",6 if $caseid == 0;
    my %content = %orig_content;
    $content{'case_id'} = $caseid;

    $filePTR = $data->{'test_images'}[0];
    $content{'filename'} = 'maxsize.tif';
    $content{'filecontent'} = $filePTR->{'filecontent'};
    $content{'mimetype'} = $filePTR->{'mimetype'};
    $tx->content(%content);
    $chargeback_list = $tx->chargeback_upload_support_doc();
    $chargeback_list = $tx->chargeback_upload_support_doc(); # run it twice because they don't have the file there already
    is( $tx->is_success, 0, "Chargeback upload: " . $content{'filename'} );
    is( $tx->result_code, '005', "result_code(): RESULT" );
    is( $tx->error_message, 'Document Already Exists', "error_message(): RESULT" );

    # Litel Test case 4 part 3 & 4
    $content{'filename'} = $filePTR->{'filename'};
    $content{'filecontent'} = $filePTR->{'filecontent'} . ' 'x3000000; # file greater then 2M
    $content{'mimetype'} = $filePTR->{'mimetype'};
    $tx->content(%content);
    eval { $chargeback_list = $tx->chargeback_upload_support_doc(); };
    is( $tx->is_success, 0, "Chargeback upload: " . $content{'filename'} );
    is( $tx->error_message, 'Filesize Exceeds Limit Of 2MB', "error_message(): RESULT" );

    # Litel Test case 4 part 5 & 6
    $content{'filename'} = $filePTR->{'filename'};
    $content{'filecontent'} = $filePTR->{'filecontent'};
    $content{'mimetype'} = $filePTR->{'mimetype'};
    foreach my $cnt ( 1 .. 10 ) {
        $content{'filename'} = $cnt.$filePTR->{'filename'};
        $tx->content(%content);
        $chargeback_list = $tx->chargeback_upload_support_doc(); # make sure we have to many files for this test
    }
    $content{'filename'} = '11'.$filePTR->{'filename'};
    $tx->content(%content);
    $tx->chargeback_upload_support_doc();
    $chargeback_list = $tx->chargeback_list_support_docs();
    is( $tx->is_success, 0, "Chargeback upload: " . $content{'filename'} );
    is( $tx->result_code, '008', "result_code(): RESULT" );
    is( $tx->error_message, 'Max Document Limit Per Case Reached', "error_message(): RESULT" );
}









( run in 0.944 second using v1.01-cache-2.11-cpan-b16cb0d3907 )