diff --git a/force-app/main/default/classes/AdyenConstants.cls b/force-app/main/default/classes/AdyenConstants.cls index 56dbad1..282fbc5 100644 --- a/force-app/main/default/classes/AdyenConstants.cls +++ b/force-app/main/default/classes/AdyenConstants.cls @@ -1,67 +1,70 @@ -@namespaceAccessible +@NamespaceAccessible public with sharing class AdyenConstants { - @namespaceAccessible + @NamespaceAccessible public static final String DEFAULT_ADAPTER_NAME = 'AdyenDefault'; - @namespaceAccessible + @NamespaceAccessible public static final String NOTIFICATION_REQUEST_TYPE_CANCEL = 'cancellation'; - @namespaceAccessible + @NamespaceAccessible public static final String NOTIFICATION_REQUEST_TYPE_AUTHORISE = 'authorization'; - @namespaceAccessible + @NamespaceAccessible public static final String NOTIFICATION_REQUEST_TYPE_CAPTURE_FAILED = 'capture-failed'; - @namespaceAccessible + @NamespaceAccessible public static final String NOTIFICATION_REQUEST_TYPE_CAPTURE = 'capture'; - @namespaceAccessible + @NamespaceAccessible public static final String NOTIFICATION_REQUEST_TYPE_REFUND = 'refund'; - @namespaceAccessible + @NamespaceAccessible + public static final String NOTIFICATION_REQUEST_TYPE_RECURRING_CONTRACT = 'recurring_contract'; + + @NamespaceAccessible public static final String NOTIFICATION_ACCEPTED_RESPONSE = '[accepted]'; - @namespaceAccessible + @NamespaceAccessible public static final String NOTIFICATION_RECEIVED_CHECKOUT = 'received'; - @namespaceAccessible + @NamespaceAccessible public static final String TEST_MERCHANT_ACCOUNT = 'TEST_MERCHANT_ACCOUNT'; - @namespaceAccessible + @NamespaceAccessible public static final String TEST_REFERENCE = 'TEST_REFERENCE'; - @namespaceAccessible + @NamespaceAccessible public static final String TEST_STATUS = 'TEST_STATUS'; - @namespaceAccessible + @NamespaceAccessible public static final String TEST_PSP_REFERENCE = 'TEST_PSP_REFERENCE'; - @namespaceAccessible + @NamespaceAccessible public static final String TEST_PAYMENT_PSP_REFERENCE = 'TEST_PAYMENT_PSP_REFERENCE'; - @namespaceAccessible + @NamespaceAccessible public static final CommercePayments.SalesforceResultCodeInfo SUCCESS_SALESFORCE_RESULT_CODE_INFO = new CommercePayments.SalesforceResultCodeInfo(CommercePayments.SalesforceResultCode.Success); - @namespaceAccessible + @NamespaceAccessible public static final CommercePayments.SalesforceResultCodeInfo DECLINE_SALESFORCE_RESULT_CODE_INFO = new CommercePayments.SalesforceResultCodeInfo(CommercePayments.SalesforceResultCode.Decline); - @namespaceAccessible + @NamespaceAccessible public static final CommercePayments.SalesforceResultCodeInfo SYSTEM_ERROR_SALESFORCE_RESULT_CODE_INFO = new CommercePayments.SalesforceResultCodeInfo(CommercePayments.SalesforceResultCode.SystemError); - @namespaceAccessible + @NamespaceAccessible public static final CommercePayments.SalesforceResultCodeInfo VALIDATION_ERROR_SALESFORCE_RESULT_CODE_INFO = new CommercePayments.SalesforceResultCodeInfo(CommercePayments.SalesforceResultCode.ValidationError); - @namespaceAccessible - public static final Integer HTTP_SUCCESS_CODE = 200; + @NamespaceAccessible + public static final Integer HTTP_SUCCESS_CODE = 200; - @namespaceAccessible - public static final Integer HTTP_ERROR_CODE = 400; + @NamespaceAccessible + public static final Integer HTTP_ERROR_CODE = 400; - @namespaceAccessible - public final static String HTTP_SERVER_ERROR_CODE = '500'; + @NamespaceAccessible + public final static String HTTP_SERVER_ERROR_CODE = '500'; } \ No newline at end of file diff --git a/force-app/main/default/classes/CheckoutCaptureRequest.cls b/force-app/main/default/classes/CheckoutCaptureRequest.cls index 7d8d431..3bb9736 100644 --- a/force-app/main/default/classes/CheckoutCaptureRequest.cls +++ b/force-app/main/default/classes/CheckoutCaptureRequest.cls @@ -68,6 +68,23 @@ public with sharing class CheckoutCaptureRequest implements CheckoutModification this.lineItems = lineItems; } + /** + * Application info + * @return applicationInfo + */ + @namespaceAccessible + public ApplicationInfo applicationInfo { get; set; } + + @namespaceAccessible + public ApplicationInfo getApplicationInfo() { + return applicationInfo; + } + + @namespaceAccessible + public void setApplicationInfo(ApplicationInfo applicationInfo) { + this.applicationInfo = applicationInfo; + } + @NamespaceAccessible public CheckoutCaptureRequest(){} } diff --git a/force-app/main/default/classes/CheckoutCaptureRequestTest.cls b/force-app/main/default/classes/CheckoutCaptureRequestTest.cls index 0e13b05..91ee2fa 100644 --- a/force-app/main/default/classes/CheckoutCaptureRequestTest.cls +++ b/force-app/main/default/classes/CheckoutCaptureRequestTest.cls @@ -23,5 +23,10 @@ public class CheckoutCaptureRequestTest { testCaptureRequest.setLineItems(new List{new LineItem()}); System.assertEquals(1, testCaptureRequest.getLineItems().size()); + + testCaptureRequest.setApplicationInfo(ApplicationInfo.getExample()); + System.assertEquals(testCaptureRequest.getApplicationInfo().adyenLibrary.name, ''); + + } } \ No newline at end of file diff --git a/force-app/main/default/classes/CheckoutModificationRequest.cls b/force-app/main/default/classes/CheckoutModificationRequest.cls index 72ae6c0..c182fcc 100644 --- a/force-app/main/default/classes/CheckoutModificationRequest.cls +++ b/force-app/main/default/classes/CheckoutModificationRequest.cls @@ -12,4 +12,8 @@ public interface CheckoutModificationRequest { List getLineItems(); void setLineItems(List lineItems); + + ApplicationInfo getApplicationInfo(); + void setApplicationInfo(ApplicationInfo applicationInfo); + } diff --git a/force-app/main/default/classes/CheckoutRefundRequest.cls b/force-app/main/default/classes/CheckoutRefundRequest.cls index 3014176..ec755b5 100644 --- a/force-app/main/default/classes/CheckoutRefundRequest.cls +++ b/force-app/main/default/classes/CheckoutRefundRequest.cls @@ -65,6 +65,23 @@ public with sharing class CheckoutRefundRequest implements CheckoutModificationR this.lineItems = lineItems; } + /** + * Application info + * @return applicationInfo + */ + @namespaceAccessible + public ApplicationInfo applicationInfo { get; set; } + + @namespaceAccessible + public ApplicationInfo getApplicationInfo() { + return applicationInfo; + } + + @namespaceAccessible + public void setApplicationInfo(ApplicationInfo applicationInfo) { + this.applicationInfo = applicationInfo; + } + @NamespaceAccessible public CheckoutRefundRequest(){} diff --git a/force-app/main/default/classes/CheckoutRefundRequestTest.cls b/force-app/main/default/classes/CheckoutRefundRequestTest.cls index aa6c51a..6184c7b 100644 --- a/force-app/main/default/classes/CheckoutRefundRequestTest.cls +++ b/force-app/main/default/classes/CheckoutRefundRequestTest.cls @@ -23,5 +23,9 @@ public class CheckoutRefundRequestTest { testRefundRequest.setLineItems(new List{new LineItem()}); System.assertEquals(1, testRefundRequest.getLineItems().size()); + + testRefundRequest.setApplicationInfo(ApplicationInfo.getExample()); + System.assertEquals(testRefundRequest.getApplicationInfo().adyenLibrary.name, ''); + } } \ No newline at end of file diff --git a/force-app/main/default/classes/NotificationRequestItem.cls b/force-app/main/default/classes/NotificationRequestItem.cls index 0c03832..783d814 100644 --- a/force-app/main/default/classes/NotificationRequestItem.cls +++ b/force-app/main/default/classes/NotificationRequestItem.cls @@ -1,37 +1,41 @@ /* * Represents an Adyen Webhook Notification Request Item */ -@namespaceAccessible + +@NamespaceAccessible public with sharing class NotificationRequestItem { - @namespaceAccessible + @NamespaceAccessible public Amount amount {get;set;} - @namespaceAccessible + @NamespaceAccessible public String eventCode {get;set;} - @namespaceAccessible + @NamespaceAccessible public String eventDate {get;set;} - @namespaceAccessible + @NamespaceAccessible public String merchantAccountCode {get;set;} - @namespaceAccessible + @NamespaceAccessible public String paymentMethod {get;set;} - @namespaceAccessible + @NamespaceAccessible public String originalReference {get;set;} - @namespaceAccessible + @NamespaceAccessible public String paymentPspReference {get;set;} - @namespaceAccessible + @NamespaceAccessible public String pspReference {get;set;} - @namespaceAccessible + @NamespaceAccessible public String reason {get;set;} - @namespaceAccessible + @NamespaceAccessible public String success {get;set;} + @NamespaceAccessible + public Map additionalData {get;set;} + } \ No newline at end of file diff --git a/force-app/main/default/classes/PaymentMethodsRequest.cls b/force-app/main/default/classes/PaymentMethodsRequest.cls index feb542b..455ee82 100644 --- a/force-app/main/default/classes/PaymentMethodsRequest.cls +++ b/force-app/main/default/classes/PaymentMethodsRequest.cls @@ -54,6 +54,13 @@ public with sharing class PaymentMethodsRequest { @namespaceAccessible public String shopperReference { get; set; } + /** + * List of payments methods to be not presented to the shopper. To refer to payment methods, use their `paymentMethod.type` from [Payment methods overview](https://docs.adyen.com/payment-methods).\n\nExample: `"blockedPaymentMethods":["ideal","giropay"]` + * @return blockedPaymentMethods + */ + @namespaceAccessible + public List blockedPaymentMethods {get;set;} + @namespaceAccessible public PaymentMethodsRequest() { allowedPaymentMethods = new List(); @@ -68,6 +75,7 @@ public with sharing class PaymentMethodsRequest { paymentMethodsRequest.merchantAccount = ''; paymentMethodsRequest.shopperLocale = ''; paymentMethodsRequest.shopperReference = ''; + paymentMethodsRequest.blockedPaymentMethods = new List{''}; return paymentMethodsRequest; } @@ -80,7 +88,8 @@ public with sharing class PaymentMethodsRequest { && this.countryCode == paymentMethodsRequest.countryCode && this.merchantAccount == paymentMethodsRequest.merchantAccount && this.shopperLocale == paymentMethodsRequest.shopperLocale - && this.shopperReference == paymentMethodsRequest.shopperReference; + && this.shopperReference == paymentMethodsRequest.shopperReference + && this.blockedPaymentMethods == paymentMethodsRequest.blockedPaymentMethods; } return false; } @@ -96,4 +105,4 @@ public with sharing class PaymentMethodsRequest { hashCode = (17 * hashCode) + (shopperReference == null ? 0 : System.hashCode(shopperReference)); return hashCode; } -} \ No newline at end of file +} diff --git a/sfdx-project.json b/sfdx-project.json index c2cfcfd..fae0ae0 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -1,23 +1,24 @@ -{ - "packageDirectories": [ - { - "path": "force-app", - "default": true, - "package": "API Library Apex Adyen", - "versionName": "ver 0.1", - "versionNumber": "0.1.0.NEXT", - "ancestorVersion": "HIGHEST" - } - ], - "name": "adyen-apex-api-lib-2GP", - "namespace": "adyen_payment", - "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "53.0", - "packageAliases": { - "API Library Apex Adyen": "0Ho4T0000000043SAA", - "API Library Apex Adyen@0.1.0-1": "04t4T000001VvbqQAC", - "API Library Apex Adyen@1.0.0-0": "04t4T000001VvfJQAS", - "API Library Apex Adyen@2.0.0-0": "04t4T000001HohPQAS", - "API Library Apex Adyen@3.0.0-0": "04t4T000001y7BWQAY" +{ + "packageDirectories": [ + { + "path": "force-app", + "default": true, + "package": "API Library Apex Adyen", + "versionName": "ver 3.0", + "versionNumber": "3.0.1.NEXT", + "ancestorVersion": "HIGHEST" } + ], + "name": "adyen-apex-api-lib-2GP", + "namespace": "adyen_payment", + "sfdcLoginUrl": "https://login.salesforce.com", + "sourceApiVersion": "59.0", + "packageAliases": { + "API Library Apex Adyen": "0Ho4T0000000043SAA", + "API Library Apex Adyen@0.1.0-1": "04t4T000001VvbqQAC", + "API Library Apex Adyen@1.0.0-0": "04t4T000001VvfJQAS", + "API Library Apex Adyen@2.0.0-0": "04t4T000001HohPQAS", + "API Library Apex Adyen@3.0.0-0": "04t4T000001y7BWQAY", + "API Library Apex Adyen@3.0.1-1": "04tRP0000000A5pYAE" + } } \ No newline at end of file