Commit: 9c24ca4
Commit Details
| SHA | 9c24ca40dbca995b0007e09659176f7c90e13392 |
|---|---|
| Tree | 4c630341b69f778f78daa19bfebcc1bfdebe1836 |
| Author | <f69e50@finnacloud.com> 1766442705 +0300 |
| Committer | <f69e50@finnacloud.com> 1766442705 +0300 |
| Message | add CI configuration and test script for Jenkins build |
| GPG Signature | -----BEGIN PGP SIGNATURE----- iQJSBAABCAA8FiEEWJb139mJI+vZ81KkoAIVSUsXI0oFAmlJxtEeHHNvcGhpYS5l cmFzbGFuQGZpbm5hY2xvdWQuY29tAAoJEKACFUlLFyNKwOEP/RJdPEnaGlYKr4zE NkU5vATgzcYMHxCO6p3T6JqsfHsvv2d65vedOJ8LsSHFtT9AN/yXqZKV2722R5CG WLsPzbVYJSXexKVZ8D7Zpf+DTu+/OAlWUE+XHMm+bJYVpDmqUo0ak/qX6vz6VYtW bSRPMtM9g8WZKZqbBxLK7Sg1IkYFsFjEWmvn6mbD9C7k/0y4Sxp6Xee26xAx1sdI +srAjwFgF+wJw0OAQoBA2jykTOiib93n9gdc9wbgl4AYUvdcaX3Hxv8LTl3Bu88N 2rqaL+OmjXtkFkEAiBaruvZZCt+aqp14gTgOM0wcLp1I1FP7uOFNOg0F0zSUawzY Fuw3w6CKebkpbixGfxtJqrLl1IbPAhd92TxRVerZbDEnWpXW3a9HoGWRu5KFX/ny ww+8M53ziWFNcHqpIyI5adRjG74C+5MdvC04J0/Sh1X8mykWcjE96Wu2/iRY9XQe 07I94ZVO0RaBSjSUnIItfhAgBXi03nzx+ZPw2tM4VHosn2zZjpzT8+KNQ0EXYhuT AzgqcOKV94ZkM+48ZePvUFXsJxhMSkpXIQxGWWBnU9gjm3QAUsuCyqZGKXgVY9Vo mDlLBl83Nhx+/7V8AFJO2gUmaph9YB01p3SMDfE++lLqX1BwdguFVrQib30OsRnq e86d/6MrRABKf+FjtaulHY9+e8LS =9ZJj -----END PGP SIGNATURE----- ✓ Verified |
File: src/main/java/com/paymentlink/service/ShippingService.java
| 1 | package com.paymentlink.service; |
| 2 | |
| 3 | import org.springframework.stereotype.Service; |
| 4 | |
| 5 | |
| 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 |