feat: add deposit with stripe (CAS-28) #23
@ -11,6 +11,7 @@ import de.szut.casino.deposit.dto.SessionIdDto;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties;
|
import org.springframework.boot.autoconfigure.cassandra.CassandraProperties;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -24,7 +25,10 @@ public class DepositController {
|
|||||||
private String stripeKey;
|
private String stripeKey;
|
||||||
|
|
||||||
@PostMapping("/deposit/checkout")
|
@PostMapping("/deposit/checkout")
|
||||||
public ResponseEntity<SessionIdDto> checkout(@RequestBody @Valid AmountDto amountDto) throws StripeException {
|
public ResponseEntity<SessionIdDto> checkout(
|
||||||
|
@RequestBody @Valid AmountDto amountDto,
|
||||||
|
@RequestHeader("Origin") String origin
|
||||||
|
) throws StripeException {
|
||||||
Stripe.apiKey = stripeKey;
|
Stripe.apiKey = stripeKey;
|
||||||
|
|
||||||
SessionCreateParams params = SessionCreateParams.builder()
|
SessionCreateParams params = SessionCreateParams.builder()
|
||||||
@ -34,7 +38,7 @@ public class DepositController {
|
|||||||
.setQuantity(1L)
|
.setQuantity(1L)
|
||||||
.setName("Einzahlung")
|
.setName("Einzahlung")
|
||||||
.build())
|
.build())
|
||||||
.setSuccessUrl("http://localhost:8080/deposit/success")
|
.setSuccessUrl(origin+"/deposit/success")
|
||||||
.setMode(SessionCreateParams.Mode.PAYMENT)
|
.setMode(SessionCreateParams.Mode.PAYMENT)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@ import { loadStripe, Stripe } from '@stripe/stripe-js';
|
|||||||
import { DepositService } from '../service/deposit.service';
|
import { DepositService } from '../service/deposit.service';
|
||||||
import { debounceTime } from 'rxjs';
|
import { debounceTime } from 'rxjs';
|
||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
|
import { NgIf } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-deposit',
|
selector: 'app-deposit',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [ReactiveFormsModule],
|
imports: [ReactiveFormsModule, NgIf],
|
||||||
templateUrl: './deposit.component.html',
|
templateUrl: './deposit.component.html',
|
||||||
styleUrl: './deposit.component.css',
|
styleUrl: './deposit.component.css',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user