Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Deepu K Sasidharan deepu105

🏠
Working from home
View GitHub Profile
View MdToHtml.html
<p>E-commerce applications are the backbone of today&#39;s online shopping world. In this post, we will see how to build an e-commerce application easily using Java, JHipster, Spring Boot, and React. Since we will be scaffolding the application, the post will focus on how to build a shopping cart and payment integration rather than how to build a Java web application.</p>
<h2 id="tools-and-technology-we-will-use">Tools and technology we will use</h2>
<p>We will use the below tools and technology to build this application:</p>
<ul>
<li><a href="https://www.jhipster.tech/"><strong>JHipster</strong></a>: JHipster is a rapid application development platform. It can quickly create web applications and microservices with production-grade code. Head over to the <a href="https://www.jhipster.tech/installation/">installation instructions</a> to set it up. JHipster can scaffold applications with a wide variety of languages, frameworks, and configurations. For this tutorial, we will stick with the following major option
View adyen-react-blog-6.sh
export ADYEN_API_KEY=yourAdyenApiKey
export ADYEN_MERCHANT_ACCOUNT=yourAdyenMerchantAccount
export ADYEN_ORIGIN_KEY=yourAdyenOriginKeyForCorrectDomain
View adyen-react-blog-5.tsx
//import ...;
export interface ICheckoutProp extends StateProps, DispatchProps {}
class CheckoutContainer extends React.Component<ICheckoutProp> {
private paymentContainer = React.createRef<HTMLDivElement>();
//...
componentDidMount() {
this.props.getEntityForCurrentUser();
View adyen-react-blog-4.gradle
implementation group: "com.adyen", name: "adyen-java-api-library", version: "5.0.0"
View adyen-react-blog-3.jdl
application {
config {
baseName store
packageName com.adyen.demo.store
authenticationType jwt
prodDatabaseType mysql
buildTool gradle
clientFramework react
useSass true
enableTranslation false
View adyen-react-blog-2.java
@PostMapping("/checkout/payment-methods")
public ResponseEntity<PaymentMethodsResponse> paymentMethods() throws EntityNotFoundException, IOException, ApiException {
PaymentMethodsRequest paymentMethodsRequest = new PaymentMethodsRequest();
paymentMethodsRequest.setMerchantAccount(merchantAccount);
paymentMethodsRequest.setCountryCode("NL");
paymentMethodsRequest.setShopperLocale("nl-NL");
paymentMethodsRequest.setChannel(PaymentMethodsRequest.ChannelEnum.WEB);
Amount amount = getAmountFromCart();
paymentMethodsRequest.setAmount(amount);
View adyen-react-blog-1.tsx
//import ...;
export interface ICartProp extends StateProps, DispatchProps {}
export const Cart = (props: ICartProp) => {
useEffect(() => {
props.getEntityForCurrentUser();
}, []);
const remove = id => () => {
@deepu105
deepu105 / e-commerce-app.jdl
Created Jun 24, 2020
Adyen E-Commerce JDL
View e-commerce-app.jdl
/** Product sold by the Online store */
entity Product {
name String required
description String
price BigDecimal required min(0)
size Size required
image ImageBlob
}
enum Size {
@deepu105
deepu105 / rust-stack-vs-heap.rs
Created Mar 30, 2020
Rust stack vs heap usage
View rust-stack-vs-heap.rs
use std::fs::File;
use std::io::prelude::*;
use std::usize;
fn lookup_ptr(addr: usize) -> std::io::Result<Option<String>> {
let mut contents = String::new();
File::open("/proc/self/maps")?.read_to_string(&mut contents)?;
Ok(contents
.split("\n")
// Uncomment this if you are only interested in stack and heap
@deepu105
deepu105 / rust-ownership.rs
Created Mar 30, 2020
Rust ownership and lifetimes
View rust-ownership.rs
// This function takes ownership of the passed value
fn take_ownership(value: Box<i32>) {
println!("Destroying box that contains {}", value); // value is destroyed here, and memory gets freed
}
// This function borrows the value by reference
fn borrow(reference: &i32) {
println!("This is: {}", reference);
}
You can’t perform that action at this time.