diff --git a/.gitignore b/.gitignore index 1747393..2f739c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .gradle/ .idea/ -.DS_Store +*.DS_Store build/ bin/ diff --git a/config.properties b/config.properties index 0830992..50ba070 100644 --- a/config.properties +++ b/config.properties @@ -1,9 +1,9 @@ # Enter your information below # No quotation marks are required [DEFAULT] -merchant_account = -checkout_apikey = -origin_key = -checkout_payment_methods_url = https://checkout-test.adyen.com/v52/paymentMethods -checkout_payments_url = https://checkout-test.adyen.com/v52/payments -checkout_detail_url = https://checkout-test.adyen.com/v52/payments/details \ No newline at end of file +merchantAccount = TylerDouglas +apiKey = AQEyhmfxL4jIYhVBw0m/n3Q5qf3VaY9UCJ1+XWZe9W27jmlZiiSaWGoa4mOFeQne5hiuhQsQwV1bDb7kfNy1WIxIIkxgBw==-hJYG90gqLYPclLs6We+q8CUtAsa+KgXr/iWftd+rrCM=-89EKHpWfW8ABmGF3 +originKey = pub.v2.8115499067697722.aHR0cDovL2xvY2FsaG9zdDo4MDgw.I4ixvXum4JGOjgI0Nd3YQ49P4AWvIncxMv41suCoW1Y +paymentMethodsUrl = https://checkout-test.adyen.com/v52/paymentMethods +paymentsUrl = https://checkout-test.adyen.com/v52/payments +paymentsDetailsUrl = https://checkout-test.adyen.com/v52/payments/details \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 4ec8794..0000000 Binary files a/src/.DS_Store and /dev/null differ diff --git a/src/main/.DS_Store b/src/main/.DS_Store deleted file mode 100644 index 46afb28..0000000 Binary files a/src/main/.DS_Store and /dev/null differ diff --git a/src/main/java/model/Payments.java b/src/main/java/model/Payments.java index 031012d..854b520 100644 --- a/src/main/java/model/Payments.java +++ b/src/main/java/model/Payments.java @@ -1,11 +1,10 @@ package model; import com.adyen.Client; +import com.adyen.Config; import com.adyen.enums.Environment; import com.adyen.model.Amount; -import com.adyen.model.checkout.LineItem; -import com.adyen.model.checkout.PaymentsRequest; -import com.adyen.model.checkout.PaymentsResponse; +import com.adyen.model.checkout.*; import com.adyen.service.Checkout; import com.adyen.service.exception.ApiException; import com.google.gson.Gson; @@ -17,6 +16,7 @@ import java.io.IOException; public class Payments { + public static String makePayment(PaymentsRequest paymentsRequest) { Client client = new Client(Main.apiKey, Environment.TEST); Checkout checkout = new Checkout(client); diff --git a/src/main/resources/.DS_Store b/src/main/resources/.DS_Store deleted file mode 100644 index 851e17c..0000000 Binary files a/src/main/resources/.DS_Store and /dev/null differ diff --git a/src/main/resources/static/css/main.css b/src/main/resources/static/css/main.css index 2c352be..af514d7 100644 --- a/src/main/resources/static/css/main.css +++ b/src/main/resources/static/css/main.css @@ -2,80 +2,80 @@ html, body { - width: 100%; - margin: 0; - font-family: "Fakt", sans-serif, Helvetica, Arial; + width: 100%; + margin: 0; + font-family: "Fakt", sans-serif, Helvetica, Arial; } *, :after, :before { - box-sizing: border-box; + box-sizing: border-box; } a, u { - text-decoration: none; + text-decoration: none; } a:hover { - text-decoration: none; + text-decoration: none; } .hidden { - display: none; + display: none; } #header { - background: #fff; - border-bottom: 1px solid #e6e9eb; - height: 44px; - left: 0; - margin-bottom: 24px; - padding: 14px 26px; - position: fixed; - text-align: center; - top: 0; - width: 100%; - z-index: 2; - box-sizing: border-box; + background: #fff; + border-bottom: 1px solid #e6e9eb; + height: 44px; + left: 0; + margin-bottom: 24px; + padding: 14px 26px; + position: fixed; + text-align: center; + top: 0; + width: 100%; + z-index: 2; + box-sizing: border-box; } /* Buttons */ .button { - background: #00112c; - border: 0; - border-radius: 6px; - color: #fff; - cursor: pointer; - display: inline-block; - font-size: 1em; - font-weight: 500; - margin: 0; - padding: 15px; - text-align: center; - transition: background 0.3s ease-out, box-shadow 0.3s ease-out; - width: 100%; + background: #00112c; + border: 0; + border-radius: 6px; + color: #fff; + cursor: pointer; + display: inline-block; + font-size: 1em; + font-weight: 500; + margin: 0; + padding: 15px; + text-align: center; + transition: background 0.3s ease-out, box-shadow 0.3s ease-out; + width: 100%; } .button:hover { - background: #1c3045; - box-shadow: 0 3px 4px rgba(0, 15, 45, 0.2); + background: #1c3045; + box-shadow: 0 3px 4px rgba(0, 15, 45, 0.2); } .button:active { - background: #3a4a5c; + background: #3a4a5c; } .button:disabled { - background: #e6e9eb; - box-shadow: none; - cursor: not-allowed; - -webkit-user-select: all; - -moz-user-select: all; - -ms-user-select: all; - user-select: all; + background: #e6e9eb; + box-shadow: none; + cursor: not-allowed; + -webkit-user-select: all; + -moz-user-select: all; + -ms-user-select: all; + user-select: all; } /* end General page body */ @@ -83,129 +83,129 @@ a:hover { /* Index page */ .main-container { - margin: auto; - max-width: 1048px; - padding: 0 16px; - display: flex; - flex-direction: column; + margin: auto; + max-width: 1048px; + padding: 0 16px; + display: flex; + flex-direction: column; } .integration-list { - display: flex; - margin-top: 6%; - max-width: 1048px; - flex-wrap: wrap; - justify-content: space-between; - list-style: none; - margin: 0; - padding: 0; + display: flex; + margin-top: 6%; + max-width: 1048px; + flex-wrap: wrap; + justify-content: space-between; + list-style: none; + margin: 0; + padding: 0; } @media (min-width: 768px) { - .integration-list { - margin-left: -8px; - margin-bottom: -8px; - margin-right: -8px; - } + .integration-list { + margin-left: -8px; + margin-bottom: -8px; + margin-right: -8px; + } } @media (min-width: 1024px) { - .integration-list { - margin-left: -16px; - margin-bottom: -16px; - margin-right: -16px; - } + .integration-list { + margin-left: -16px; + margin-bottom: -16px; + margin-right: -16px; + } } .integration-list-item { - background: #f7f8f9; - border-radius: 6px; - flex: 1 1 0; - margin: 4px; - min-width: 40%; - position: relative; - display: flex; - justify-content: center; - align-items: center; - border: 1px solid #f7f8f9; + background: #f7f8f9; + border-radius: 6px; + flex: 1 1 0; + margin: 4px; + min-width: 40%; + position: relative; + display: flex; + justify-content: center; + align-items: center; + border: 1px solid #f7f8f9; } .integration-list-item:hover { - box-shadow: 0 16px 24px 0 #e5eaef; - text-decoration: none; - border: 1px solid #06f; + box-shadow: 0 16px 24px 0 #e5eaef; + text-decoration: none; + border: 1px solid #06f; } @media (min-width: 768px) { - .integration-list-item { - margin-left: 16px; - margin-bottom: 16px; - margin-right: 16px; - margin-top: 16px; - min-width: 25%; - } + .integration-list-item { + margin-left: 16px; + margin-bottom: 16px; + margin-right: 16px; + margin-top: 16px; + min-width: 25%; + } } .integration-list-item-link { - padding: 20px; - width: 100%; - display: flex; - align-items: center; - justify-content: center; + padding: 20px; + width: 100%; + display: flex; + align-items: center; + justify-content: center; } @media (min-width: 768px) { - .integration-list-item-link { - padding-left: 28px; - padding-bottom: 28px; - padding-right: 28px; - padding-top: 28px; - } + .integration-list-item-link { + padding-left: 28px; + padding-bottom: 28px; + padding-right: 28px; + padding-top: 28px; + } } .integration-list-item-title { - margin: 0; - text-align: center; - color: #00112c; - font-size: 1em; - font-weight: 700; - margin: 10px 0 0; + margin: 0; + text-align: center; + color: #00112c; + font-size: 1em; + font-weight: 700; + margin: 10px 0 0; } @media (min-width: 768px) { - .integration-list-item-title { - font-size: 24px; - margin-left: 0; - margin-bottom: 6px; - margin-right: 0; - } + .integration-list-item-title { + font-size: 24px; + margin-left: 0; + margin-bottom: 6px; + margin-right: 0; + } } .integration-list-item-subtitle { - color: #00112c; - font-size: 0.67em; - font-weight: 700; - margin: 10px 0 0; + color: #00112c; + font-size: 0.67em; + font-weight: 700; + margin: 10px 0 0; } @media (min-width: 768px) { - .integration-list-item-subtitle { - font-size: 16px; - margin-left: 0; - margin-bottom: 6px; - margin-right: 0; - } + .integration-list-item-subtitle { + font-size: 16px; + margin-left: 0; + margin-bottom: 6px; + margin-right: 0; + } } .title-container { - display: flex; - flex-direction: column; - align-items: center; + display: flex; + flex-direction: column; + align-items: center; } .info { - margin-top: 10%; - color: #00112c; + margin-top: 10%; + color: #00112c; } /* end Index page */ @@ -213,100 +213,117 @@ a:hover { /* Cart preview page */ .shopping-cart { - float: right; + float: right; } + @media (min-width: 768px) { - .shopping-cart { - padding-left: 0; - padding-bottom: 0; - padding-right: 0; - padding-top: 3px; - } + .shopping-cart { + padding-left: 0; + padding-bottom: 0; + padding-right: 0; + padding-top: 3px; + } } + .shopping-cart-link { - display: inline-block; - position: relative; + display: inline-block; + position: relative; } + .order-summary-list { - border-top: 1px solid #e6e9eb; + border-top: 1px solid #e6e9eb; } + .order-summary-list-list-item { - border-bottom: 1px solid #e6e9eb; - display: flex; - height: 97px; + border-bottom: 1px solid #e6e9eb; + display: flex; + height: 97px; } + .order-summary-list-list-item-image { - height: 64px; - margin: 16px; - width: 64px; + height: 64px; + margin: 16px; + width: 64px; } + .order-summary-list-list-item-title { - font-weight: 700; - margin: auto auto auto 0; + font-weight: 700; + margin: auto auto auto 0; } + .order-summary-list-list-item-price { - color: #687282; - margin: auto 16px; - text-align: right; - width: 80px; + color: #687282; + margin: auto 16px; + text-align: right; + width: 80px; } + @media (min-width: 768px) { - .order-summary-list-list-item-price { - margin-left: 24px; - margin-bottom: auto; - margin-right: 24px; - margin-top: auto; - } + .order-summary-list-list-item-price { + margin-left: 24px; + margin-bottom: auto; + margin-right: 24px; + margin-top: auto; + } } + .order-summary-list-list-item-remove-product { - background: none; - border: 0; - cursor: pointer; - height: 25px; - margin: auto 0; - padding: 0; - width: 25px; + background: none; + border: 0; + cursor: pointer; + height: 25px; + margin: auto 0; + padding: 0; + width: 25px; } + .cart { - text-align: center; - margin-top: 80px; + text-align: center; + margin-top: 80px; } + .cart-footer { - font-weight: 700; - margin-top: 17px; - text-align: right; + font-weight: 700; + margin-top: 17px; + text-align: right; } + @media (min-width: 768px) { - .cart-footer { - margin-top: 24px; - } + .cart-footer { + margin-top: 24px; + } } + .cart-footer .button { - margin-top: 30px; - width: 100%; + margin-top: 30px; + width: 100%; } + @media (min-width: 768px) { - .cart-footer .button { - margin-top: 0; - width: 288px; - } + .cart-footer .button { + margin-top: 0; + width: 288px; + } } + .cart-footer-amount { - margin-left: 16px; - margin-right: 24px; + margin-left: 16px; + margin-right: 24px; } + .whole-preview { - margin: auto; - max-width: 1110px; - padding: 0 16px; + margin: auto; + max-width: 1110px; + padding: 0 16px; } + @media (min-width: 1440px) { - .whole-preview { - padding-left: 0; - padding-bottom: 0; - padding-right: 0; - padding-top: 0; - } + .whole-preview { + padding-left: 0; + padding-bottom: 0; + padding-right: 0; + padding-top: 0; + } } /* end of Cart preview page */ @@ -314,68 +331,68 @@ a:hover { /* Payment page */ #payment-page { - display: flex; - flex-direction: column; - align-items: center; + display: flex; + flex-direction: column; + align-items: center; } #payment-page .container { - margin-top: 100px; - display: flex; - flex-direction: row; - justify-content: space-between; - width: 100%; - max-width: 1110px; - padding-left: 8px; - padding-right: 8px; + margin-top: 100px; + display: flex; + flex-direction: row; + justify-content: space-between; + width: 100%; + max-width: 1110px; + padding-left: 8px; + padding-right: 8px; } .checkout-component { - background: #f7f8f9; - border: 1px solid #e6e9eb; - border-radius: 12px; - margin: 8px 0; + background: #f7f8f9; + border: 1px solid #e6e9eb; + border-radius: 12px; + margin: 8px 0; } /* Adyen Components */ .payment { - width: 100%; - padding-top: 0px !important; - padding-left: 20px; - padding-right: 20px; + width: 100%; + padding-top: 0px !important; + padding-left: 20px; + padding-right: 20px; } @media screen and (max-width: 1076px) { - #payment-page .container { - display: flex; - flex-direction: column; - align-items: center; - } + #payment-page .container { + display: flex; + flex-direction: column; + align-items: center; + } - .payment { - align-self: center; - max-width: 610px; - } + .payment { + align-self: center; + max-width: 610px; + } } .payment-container { - display: flex; - justify-content: center; - background: #f7f8f9; - border: 1px solid #e6e9eb; - border-radius: 12px; - padding-top: 18px; - padding-bottom: 18px; - width: 100%; - max-width: 450px; - height: 100%; + display: flex; + justify-content: center; + background: #f7f8f9; + border: 1px solid #e6e9eb; + border-radius: 12px; + padding-top: 18px; + padding-bottom: 18px; + width: 100%; + max-width: 450px; + height: 100%; } @media screen and (max-width: 1076px) { - .payment-container { - align-self: center; - max-width: 610px; - } + .payment-container { + align-self: center; + max-width: 610px; + } } /* end Payments page */ @@ -383,15 +400,15 @@ a:hover { /* Dropin page */ #dropin { - width: 100%; - max-width: 450px; + width: 100%; + max-width: 450px; } @media screen and (max-width: 1076px) { - #dropin { - width: 100%; - max-width: 610px; - } + #dropin { + width: 100%; + max-width: 610px; + } } /* end Dropin page */ @@ -399,84 +416,86 @@ a:hover { /* Customer billing information form */ .address { - background: #f7f8f9; - border: 1px solid #e6e9eb; - border-radius: 12px; + background: #f7f8f9; + border: 1px solid #e6e9eb; + border-radius: 12px; } .billing-header { - padding: 1em 1em 0px 1em; + padding: 1em 1em 0px 1em; } .address-form { - padding: 1em; - border-radius: 3px; + padding: 1em; + border-radius: 3px; } .address-form * { - box-sizing: border-box; + box-sizing: border-box; } .address-form input { - border: 1px solid #ccc; - border-radius: 6px; - font-size: 0.8em; - padding: 0.5em; + border: 1px solid #ccc; + border-radius: 6px; + font-size: 0.8em; + padding: 0.5em; } .address-form input[type="text"] { - width: 100%; - height: 40px; + width: 100%; + height: 40px; } .address-label { - overflow: hidden; - text-overflow: ellipsis; - transition: color 0.1s ease-out; - white-space: nowrap; - font-size: 0.81em; - font-weight: 400; - line-height: 13px; - padding-bottom: 5px; + overflow: hidden; + text-overflow: ellipsis; + transition: color 0.1s ease-out; + white-space: nowrap; + font-size: 0.81em; + font-weight: 400; + line-height: 13px; + padding-bottom: 5px; } .address-input { - display: inline-grid; - width: 100%; + display: inline-grid; + width: 100%; } .address-input:first-child { - padding-right: 4px; + padding-right: 4px; } + .address-input:last-child { - padding-left: 4px; + padding-left: 4px; } + .address-input.full-width { - padding-left: 0px; - padding-right: 0px; + padding-left: 0px; + padding-right: 0px; } .address-line { - padding: 4px; - display: flex; - flex-direction: row; + padding: 4px; + display: flex; + flex-direction: row; } .address-line4 div { - width: 33.3%; + width: 33.3%; } .customer-form { - width: 100%; - max-width: 610px; - margin-bottom: 16px; + width: 100%; + max-width: 610px; + margin-bottom: 16px; } @media screen and (max-width: 1076px) { - .customer-form { - align-self: center; - max-width: 610px; - } + .customer-form { + align-self: center; + max-width: 610px; + } } /* end Customer billing information page */ @@ -484,44 +503,44 @@ a:hover { /* Status page */ .status-container { - height: 100vh; - display: flex; - align-items: center; - justify-content: center; + height: 100vh; + display: flex; + align-items: center; + justify-content: center; } .status { - margin: 100px 0 126px; - text-align: center; + margin: 100px 0 126px; + text-align: center; } .status .status-image { - display: block; - height: 100px; - margin: 16px auto 0; + display: block; + height: 100px; + margin: 16px auto 0; } .status .status-image-thank-you { - height: 66px; + height: 66px; } .status .status-message { - margin: 8px 0 24px; + margin: 8px 0 24px; } .status .button { - max-width: 236px; + max-width: 236px; } @media (min-width: 768px) { - .status .button { - max-width: 200px; - } + .status .button { + max-width: 200px; + } } .title-status { - margin-top: 10%; - text-align: center; + margin-top: 10%; + text-align: center; } /* end Status page */ diff --git a/src/main/resources/static/img/.DS_Store b/src/main/resources/static/img/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/src/main/resources/static/img/.DS_Store and /dev/null differ diff --git a/src/main/resources/static/img/MyDemo.gif b/src/main/resources/static/img/MyDemo.gif new file mode 100644 index 0000000..1238495 Binary files /dev/null and b/src/main/resources/static/img/MyDemo.gif differ diff --git a/src/main/resources/static/js/adyen_implementations.js b/src/main/resources/static/js/adyen_implementations.js index 7c94013..3245bae 100644 --- a/src/main/resources/static/js/adyen_implementations.js +++ b/src/main/resources/static/js/adyen_implementations.js @@ -10,7 +10,6 @@ const structureRequest = (data) => { paymentRequest['browserInfo'] = data.browserInfo; } - console.log(paymentRequest); return paymentRequest; }; @@ -19,7 +18,7 @@ const handleFinalState = (resultCode) => { if (resultCode === 'Authorised') { window.location.href = "http://localhost:8080/success"; - } else if (resultCode === 'Pending') { + } else if (resultCode === 'Pending' || resultCode === 'Received') { window.location.href = "http://localhost:8080/pending"; } else if (resultCode === 'Error') { @@ -63,7 +62,7 @@ const onSubmit = (state, component) => { }; const onAdditionalDetails = (state, component) => { - console.log("On additionalDetails triggered"); + console.log("OnAdditionalDetails triggered"); fetch(`/api/submitAdditionalDetails`, { method: 'POST', headers: { @@ -80,7 +79,8 @@ const onAdditionalDetails = (state, component) => { } }) .catch(error => { - throw Error(error); + console.log(error); + window.location.href = "http://localhost:8080/failed"; }); }; @@ -91,59 +91,30 @@ const onError = (error) => { // Create Adyen checkout instance and initilize component const createAdyenCheckout = () => { - + // Get /paymentMethods call and clientKey response Jinja2 passed back to