Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send invoice by email #9

Open
samber opened this issue Oct 2, 2018 · 9 comments
Open

Send invoice by email #9

samber opened this issue Oct 2, 2018 · 9 comments

Comments

@samber
Copy link
Owner

samber commented Oct 2, 2018

  • Setup emails on Laravel
  • Simple template
@RobinTHOREL
Copy link

i'll take this issue

@RobinTHOREL
Copy link

I have some bad issues while testing the POST URI :

brixton@LAPTOP-BJCUB787:~$ curl "https://invoice-as-a-service.cleverapps.io/api/invoice/generate" \
>      -X POST -H "content-type: application/json" \
>      -d '{
>         "id": "42",
>         "currency": "€",
>         "lang": "en",
>         "date": 1520852472,
>         "due_date": 1521457272,
>         "paid": false,
>         "payment_link": "https://amazon.com/user/invoices/42/pay",
>         "decimals": 2,
>         "notes": "Lorem ipsum dolor sit amet.",
>
>         "items": [
>             {
>                 "title": "'Growth' plan Bienavous.io",
>                 "description": "1 year subscription",
>                 "price": 42,
>                 "quantity": 1,
>                 "tax": 20
>             }
>         ],
>
>         "customer": {
>             "summary": "John Doe",
>             "address_line_1": "Baxter Building, 42nd street, Madison Avenue",
>             "address_line_2": "Manhattan, NY, 11234",
>             "address_line_3": "United States",
>             "address_line_4": "Earth",
>             "phone": "1-888-548-0034",
>             "email": "[email protected]"
>         },
>
>         "company": {
>             "summary": "Bienavous",
>             "address_line_1": "123, place de Bretagne",
>             "address_line_2": "44000 Nantes",
>             "address_line_3": "France",
>             "address_line_4": "Earth",
>             "phone": "1-888-548-0034",
>             "email": "[email protected]",
>             "logo": "https://upload.wikimedia.org/wikipedia/commons/7/70/Amazon_logo_plain.svg",
>             "other": [
>                 "EMEA office",
>                 {
>                     "title": "Business hours",
>                     "content": "9am - 6pm"
>                 }
>             ]
>         },
>
>         "s3": {
>             "presigned_url": null
>         }
>
>      }'
%PDF-1.3
1 0 obj
<< /Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R >>
endobj
2 0 obj
<< /Type /Outlines /Count 0 >>
endobj
3 0 obj
<< /Type /Pages
/Kids [6 0 R
]
/Count 1
/Resources <<
/ProcSet 4 0 R
/Font <<
/F1 8 0 R
/F2 9 0 R
/F3 16 0 R
/F4 23 0 R
>>
>>
/MediaBox [0.000 0.000 612.000 792.000]
 >>
endobj
4 0 obj
[/PDF /Text ]
endobj
5 0 obj
<<
/Producer ( d o m p d f   < 5 1 1 3 a c c d >   +   C P D F)
/CreationDate (D:20181002130726+00'00')
/ModDate (D:20181002130726+00'00')
/Title ( I n v o i c e   4 2)
>>
endobj
6 0 obj
<< /Type /Page
/MediaBox [0.000 0.000 612.000 792.000]
/Parent 3 0 R
/Annots [ 24 0 R 26 0 R 28 0 R 30 0 R ]
/Contents 7 0 R
>>
endobj
7 0 obj
<< /Filter /FlateDecode
/Length 9171 >>
stream
curl: (23) Failed writing body (724 != 8192)
brixton@LAPTOP-BJCUB787:~$

I've tried on the remote server - not satisfying. Now on my host machine :

brixton@LAPTOP-BJCUB787:~$ curl "http://localhost:8000/api/invoice/generate" \
>      -X POST -H "content-type: application/json" \
>      -d '{
>
>         "id": "42",
>         "currency": "€",
>         "lang": "en",
>         "date": 1520852472,
>         "due_date": 1521457272,
>         "paid": false,
>         "payment_link": "https://amazon.com/user/invoices/42/pay",
>         "decimals": 2,
>         "notes": "Lorem ipsum dolor sit amet.",
>
>         "items": [
>             {
>                 "title": "'Growth' plan Bienavous.io",
>                 "description": "1 year subscription",
>                 "price": 42,
>                 "quantity": 1,
>                 "tax": 20
>             }
>         ],
>
>         "customer": {
>             "summary": "John Doe",
>             "address_line_1": "Baxter Building, 42nd street, Madison Avenue",
>             "address_line_2": "Manhattan, NY, 11234",
>             "address_line_3": "United States",
>             "address_line_4": "Earth",
>             "phone": "1-888-548-0034",
>             "email": "[email protected]"
>         },
>
>         "company": {
>             "summary": "Bienavous",
>             "address_line_1": "123, place de Bretagne",
>             "address_line_2": "44000 Nantes",
>             "address_line_3": "France",
>             "address_line_4": "Earth",
>             "phone": "1-888-548-0034",
>             "email": "[email protected]",
>             "logo": "https://upload.wikimedia.org/wikipedia/commons/7/70/Amazon_logo_plain.svg",
>             "other": [
>                 "EMEA office",
>                 {
>                     "title": "Business hours",
>                     "content": "9am - 6pm"
>                 }
>             ]
>         },
>
>         "s3": {
>             "presigned_url": null
>         }
>
>      }'
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Error</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">

        <!-- Styles -->
        <style>
            html, body {
                background-color: #fff;
                color: #636b6f;
                font-family: 'Raleway', sans-serif;
                font-weight: 100;
                height: 100vh;
                margin: 0;
            }

            .full-height {
                height: 100vh;
            }

            .flex-center {
                align-items: center;
                display: flex;
                justify-content: center;
            }

            .position-ref {
                position: relative;
            }

            .content {
                text-align: center;
            }

            .title {
                font-size: 36px;
                padding: 20px;
            }
        </style>
    </head>
    <body>
        <div class="flex-center position-ref full-height">
            <div class="content">
                <div class="title">
                    Whoops, looks like something went wrong.                </div>
            </div>
        </div>
    </body>
</html>

Now on POSTMAN : all the fields are required...

It's look like $request->all() in InvoiceController is always empty.

@samber
Copy link
Owner Author

samber commented Oct 3, 2018

Hi @RobinTHOREL

Thanks for reporting this issue.

This is weird, it works for me (both remote and local).
Do you have an erreur in php console ?

@RobinTHOREL
Copy link

No any errors on my php console.

I've tried again on an other terminal (git bash for windows) and I get :

Brixton le Brave@LAPTOP-BJCUB787 MINGW64 ~/Desktop/www/ESGI-5A/sf_1/website-skeleton
$ curl "http://localhost:8000/api/invoice/generate" \
>      -X POST -H "content-type: application/json" \
>      -d '{
>
>         "id": "42",
>         "currency": "€",
>         "lang": "en",
>         "date": 1520852472,
>         "due_date": 1521457272,
>         "paid": false,
>         "payment_link": "https://amazon.com/user/invoices/42/pay",
>         "decimals": 2,
>         "notes": "Lorem ipsum dolor sit amet.",
>
        "items": [
            {
>         "items": [
>             {
>                 "title": "'Growth' plan Bienavous.io",
>                 "description": "1 year subscription",
>                 "price": 42,
>                 "quantity": 1,
>                 "tax": 20
>             }
>         ],
>
>         "customer": {
>             "summary": "John Doe",
>             "address_line_1": "Baxter Building, 42nd street, Madison Avenue",
>             "address_line_2": "Manhattan, NY, 11234",
>             "address_line_3": "United States",
>             "address_line_4": "Earth",
>             "phone": "1-888-548-0034",
>             "email": "[email protected]"
>         },
>
>         "company": {
>             "summary": "Bienavous",
>             "address_line_1": "123, place de Bretagne",
>             "address_line_2": "44000 Nantes",
>             "address_line_3": "France",
>             "address_line_4": "Earth",
>             "phone": "1-888-548-0034",
>             "email": "[email protected]",
n_logo_plain.svg",o": "https://upload.wikimedia.org/wikipedia/commons/7/70/Amazon
>             "other": [
>                 "EMEA office",
>                 {
>                     "title": "Business hours",
>                     "content": "9am - 6pm"
>                 }
>             ]
>         },
>
>         "s3": {
>             "presigned_url": null
>         },
>
>         "ftp": {
>         "host": "127.0.0.1",
>         "username": "ftpuser",
>         "password": "superSecretPassword",
>         "path" : "/var/html/share/"
>         }
>
>      }'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2335    0   567  100  1768    283    884  0:00:02  0:00:02 --:--:--   951"{\"id\":[\"The id field is required.\"],\"currency\":[\"The currency field is required.\"],\"lang\":[\"The lang field is required.\"],\"date\":[\"The date field is required.\"],\"due_date\":[\"The due date field is required.\"],\"items\":[\"The items field is required.\"],\"customer.summary\":[\"The customer.summary field is required.\"],\"customer.address_line_1\":[\"The customer.address line 1 field is required.\"],\"company.summary\":[\"The company.summary field is required.\"],\"company.address_line_1\":[\"The company.address line 1 field is required.\"]}"

PHP console :

Brixton le Brave@LAPTOP-BJCUB787 MINGW64 ~/Desktop/www/PR/invoice-as-a-service (master)
$ php artisan serve

Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
Laravel development server started: <http://127.0.0.1:8000>

When I die(var_dump($data)); on InvoiceController@generate I have :

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1781    0    13  100  1768     13   1768  0:00:01  0:00:01 --:--:--  1325array(0) {
}

for the same request.

@samber
Copy link
Owner Author

samber commented Oct 3, 2018

To be honest, I don't use windows.

Are you sure your curl is identical to Linux curl ?

Could you test with postman ?

@RobinTHOREL
Copy link

image

@samber
Copy link
Owner Author

samber commented Oct 4, 2018

You should configure postman to send a JSON payload, not "text" ;)

@adrmrn
Copy link

adrmrn commented Oct 4, 2018

@RobinTHOREL are you working on this task?

@RobinTHOREL
Copy link

@adrmrn you can take this issue. I feel too busy right now...
@samber I made the call successly with application/json in header of my request but never understood why it's not working properly on my terminals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants