Jump to content
  • 0

Postal Methods 2.0


Question

15 answers to this question

Recommended Posts

  • 0

We tested version 5.0.2 which includes API Adapter for new Postal Methods API but, unfortunately, it does not work.
We set dev api key and tried to send invoice using Postal Methods and got next error:

{"code":0,"message":"An internal error occurred during your request!","details":null,"validationErrors":null}

We also see next information in Postal Methods Dashboard (http://prntscr.com/z5x4oi😞

Object reference not set to an instance of an object.


Please, check it.

 

PS I found minor bug in the components/delivery/postal_methods.php. I fixed it for my instance but it hasn't changed the API response
 

(line 225)

$filename = tempnam(sys_get_temp_dir(), 'tmp_') // This will generate file like "/tmp/tmp_XbKJsv" without ".tmp" extension
...

// This block is completely useless because filename does not contain ".tmp"
$new_filename = str_replace('.tmp', '.pdf', $filename);
rename($filename, $new_filename);


My Fix:

 

$filename = tempnam(sys_get_temp_dir(), 'tmp_') . '.pdf';

// TODO: remove it
// $new_filename = str_replace('.tmp', '.pdf', $filename);
// rename($filename, $new_filename);


 

Link to post
Share on other sites
  • 0
15 hours ago, Anton Qcl said:

We tested version 5.0.2 which includes API Adapter for new Postal Methods API but, unfortunately, it does not work.
We set dev api key and tried to send invoice using Postal Methods and got next error:

{"code":0,"message":"An internal error occurred during your request!","details":null,"validationErrors":null}

We also see next information in Postal Methods Dashboard (http://prntscr.com/z5x4oi😞

Object reference not set to an instance of an object.


Please, check it.

 

PS I found minor bug in the components/delivery/postal_methods.php. I fixed it for my instance but it hasn't changed the API response
 

(line 225)

$filename = tempnam(sys_get_temp_dir(), 'tmp_') // This will generate file like "/tmp/tmp_XbKJsv" without ".tmp" extension
...

// This block is completely useless because filename does not contain ".tmp"
$new_filename = str_replace('.tmp', '.pdf', $filename);
rename($filename, $new_filename);


My Fix:

 

$filename = tempnam(sys_get_temp_dir(), 'tmp_') . '.pdf';

// TODO: remove it
// $new_filename = str_replace('.tmp', '.pdf', $filename);
// rename($filename, $new_filename);


 

Thanks, we're looking into this. What version of PHP are you running? I'm getting a different error in the PostalMethods logs:

Quote

File Type Not Supported! Please send a file with extension .pdf, .doc, .docx or .html

Which might be similar to your second point. We have a task for that one at https://dev.blesta.com/browse/CORE-4166

Link to post
Share on other sites
  • 0
16 hours ago, Anton Qcl said:

@Paul

thank you for fix, but, unfortunately, no changes after applying :(

Still get the error "An internal error occurred during your request!"
Our settings: http://prntscr.com/zsgyak
OS: centos7
PHP: php7.4
Blesta: 5.0.2 + patch
Key Type: Dev

Let me know if you need any additional information from me
 

It works fine for us, the only difference might be the option you've selected "Include a Reply Envelope", we'll test with that. Do you get the error with that option disabled or no?

Link to post
Share on other sites
  • 0

@Paul, Works good without that option.
@Jono, the error generated by PostalMethods, so there is nothing in blesta logs. However, if you need to, I can temporary modify file postal_methods.php to collect any debug information you can use. Let me know which information you want to get from me

 

 

Link to post
Share on other sites
  • 0

@Paul, hi!
Updated version to 5.0.3. 
Invoices go to the PostalMethods but they are marked as "Invalid" in Postal Methods admin panel. Error: "Invalid Page Size" (http://prntscr.com/106zp92)
Can you check it, please?

 

Upd: got information from PostalMethods:
 

Quote

We require all documents to be 8.5 x 11.  This was the issue with your documents previously when we had to delete them and refund your money.

Can you, please, create PDF's in LETTER format for them?

Link to post
Share on other sites
  • 0
On 2/25/2021 at 12:40 PM, Anton Qcl said:

@Paul, hi!
Updated version to 5.0.3. 
Invoices go to the PostalMethods but they are marked as "Invalid" in Postal Methods admin panel. Error: "Invalid Page Size" (http://prntscr.com/106zp92)
Can you check it, please?

 

Upd: got information from PostalMethods:
 

Can you, please, create PDF's in LETTER format for them?

The default Paper Size in Blesta is Letter, but Blesta also supports A4. You can update it under Settings > Company > Billing/Payment > Invoice Customization.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...