File History: src/main/java/com/paymentlink/service/ShippingService.java

← View file content

File Content at Commit 9c24ca4

1 package com.paymentlink.service;
2
3 import org.springframework.stereotype.Service;
4
5 @Service
6 public class ShippingService {
7
8 /**
9 * Calculate shipping cost based on method and country
10 */
11 public long calculateShippingCost(String method, String country) {
12 if (method == null || method.isEmpty()) {
13 method = "standard";
14 }
15
16 // Base rates in cents
17 long baseRate = switch (method.toLowerCase()) {
18 case "express" -> 2000; // $20
19 case "overnight" -> 3500; // $35
20 default -> 1000; // $10 for standard
21 };
22
23 // International shipping surcharge
24 if (country != null && !country.equals("US")) {
25 baseRate += 1500; // $15 surcharge
26 }
27
28 return baseRate;
29 }
30
31 /**
32 * Get available shipping methods
33 */
34 public String[] getAvailableShippingMethods() {
35 return new String[]{"standard", "express", "overnight"};
36 }
37
38 /**
39 * Validate shipping method
40 */
41 public boolean isValidShippingMethod(String method) {
42 if (method == null) return false;
43 String lower = method.toLowerCase();
44 return lower.equals("standard") || lower.equals("express") || lower.equals("overnight");
45 }
46 }
47
48

Commits

Commit Author Date Message File SHA Actions
f0438c2 <f69e50@finnacloud.com> 1766443042 +0300 12/22/2025, 10:37:22 PM increment once more f1bf8ea View
188fc92 <f69e50@finnacloud.com> 1766442998 +0300 12/22/2025, 10:36:38 PM increment f1bf8ea View
4617f76 <f69e50@finnacloud.com> 1766442953 +0300 12/22/2025, 10:35:53 PM rename branch from main to master oops f1bf8ea View
e6d1548 <f69e50@finnacloud.com> 1766442769 +0300 12/22/2025, 10:32:49 PM add initial test workflow file f1bf8ea View
9c24ca4 <f69e50@finnacloud.com> 1766442705 +0300 12/22/2025, 10:31:45 PM add CI configuration and test script for Jenkins build f1bf8ea Hide
690c1f6 <f69e50@finnacloud.com> 1766368110 +0300 12/22/2025, 1:48:30 AM initialize backend structure with controllers, DTOs, and configuration files f1bf8ea View