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

Python Flask/Ruby Sinatra examples #160

Merged
merged 17 commits into from
Oct 16, 2024

Conversation

LeonarthusMectus
Copy link
Contributor

This PR adds server example implementations for both standard & advanced integrations.

  • Ruby was implemented using the Sinatra framework for both standard & advanced
  • Python was implementation using the Flask framework for both standard & advanced

The HTML front end was used to validate both language backends in both standard & advanced integrations as per the instructions provided in the repository including the PayPal flow + card fields flow (for advanced).

gem "dotenv", "~> 3.1"
gem "paypal-server-sdk", "~> 0.5.1"
gem "puma", "~> 6.4"
gem "rackup", "~> 2.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove rackup and puma

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these are required by Sinatra.

),
'prefer' => 'return=representation'
})
order_response.data.to_json
Copy link
Contributor

@amsourav amsourav Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeonarthusMectus can you return this response as json, similar to Line 34. By default text/html;charset=utf-8 will be return instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amsourav Good catch, fixed this up in both standard & advanced integrations.

Copy link

@sarat2 sarat2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeonarthusMectus - Can we remove .env usage and stick to Environment Variables like used in other languages? https://github.com/paypal-examples/docs-examples/blob/main/advanced-integration/v2/server/dotnet/README.md


app = Flask(__name__)

load_dotenv()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the dotenv reference as the README steps for other languages direct the user to explicitly add the environment variables in their shell.

ref: https://github.com/paypal-examples/docs-examples/blob/c964b7083a62e76886251f34dd822fb02258b3c6/advanced-integration/v2/server/dotnet/README.md#running-the-sample

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the .env files and update the README to match.

I also caught at the last moment that Integration appears to be misspelled as Integartion in all the server README files. I've corrected it here for the new additions which were based on the existing READMEs, but thought I'd point that out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @LeonarthusMectus, It has been fixed in other languages

.gitignore Outdated
@@ -101,6 +101,7 @@ dist
.tern-port

# dotnet
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sure can. I missed that unwinding a bad rebase.

@gregjopa gregjopa merged commit 843672d into paypal-examples:main Oct 16, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

4 participants