Skip to content

Commit

Permalink
Release Package Version 3Dot0Dot0 (#27)
Browse files Browse the repository at this point in the history
* PW-6485-OMSRefactoring

* Leveraging AdyenClient model instead of AdyenService model to make callout

* Addressing review comments

* ModelUpdatePW7289

* Convert recurringProcessingModel from string to enum

* Introducing Webhook Models

* Adding relevant comments

* Delete idea folder

* Changing model from AdditionalData to LineItem array for checkout api

* Adding LineItem class

* Increasing unit test coverage

* Release 3Dot0Dot0 (#25)

* feat: updating code owners for this repository

---------

Co-authored-by: vandana <[email protected]>
Co-authored-by: daniloc <[email protected]>
Co-authored-by: Danilo Cardoso <[email protected]>
Co-authored-by: Arinc Elhan <[email protected]>
  • Loading branch information
5 people authored Oct 16, 2023
1 parent e7f6fac commit 684a6b7
Show file tree
Hide file tree
Showing 19 changed files with 336 additions and 71 deletions.
2 changes: 1 addition & 1 deletion force-app/main/default/classes/AdyenClient.cls
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public with sharing class AdyenClient {
}

private HttpResponse sendRequest(HttpRequest request){
Http httpClient = new Http();
commercepayments.PaymentsHttp httpClient = new commercepayments.PaymentsHttp();
return httpClient.send(request);
}

Expand Down
3 changes: 3 additions & 0 deletions force-app/main/default/classes/AdyenConstants.cls
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ public with sharing class AdyenConstants {

@namespaceAccessible
public static final Integer HTTP_ERROR_CODE = 400;

@namespaceAccessible
public final static String HTTP_SERVER_ERROR_CODE = '500';
}
14 changes: 14 additions & 0 deletions force-app/main/default/classes/AdyenNotification.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Represents an incoming Adyen Webhook Notification
* https://docs.adyen.com/development-resources/webhooks/understand-notifications
*/
@namespaceAccessible
public with sharing class AdyenNotification {

@namespaceAccessible
public String live {get;set;}

@namespaceAccessible
public List<NotificationItems> notificationItems {get;set;}

}
5 changes: 5 additions & 0 deletions force-app/main/default/classes/AdyenNotification.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<status>Active</status>
</ApexClass>
17 changes: 17 additions & 0 deletions force-app/main/default/classes/AuthorisationRequest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ public without sharing class AuthorisationRequest {
@namespaceAccessible
public String shopperReference { get; set; }

/**
* Specifies the recurringProcessingModel
*/
@namespaceAccessible
public enum RecurringProcessingModelEnum {
Subscription,
CardOnFile,
UnscheduledCardOnFile
}

/**
* Defines a recurring payment type.
* @return recurringProcessingModel
*/
@namespaceAccessible
public RecurringProcessingModelEnum recurringProcessingModel { get; set; }

@namespaceAccessible
public AuthorisationRequest() {
}
Expand Down
41 changes: 27 additions & 14 deletions force-app/main/default/classes/CheckoutCaptureRequest.cls
Original file line number Diff line number Diff line change
@@ -1,60 +1,73 @@
/*
* Represents an Adyen Capture Request
*/
@namespaceAccessible
@NamespaceAccessible
public with sharing class CheckoutCaptureRequest implements CheckoutModificationRequest {

/**
* Payment capture amount
* @return amount
*/
@namespaceAccessible
@NamespaceAccessible
public Amount amount { get; set; }

@namespaceAccessible
@NamespaceAccessible
public Amount getAmount() {
return amount;
}

@namespaceAccessible
@NamespaceAccessible
public void setAmount(Amount amount) {
this.amount = amount;
}

/**
* The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status. We recommend using a unique value per payment; however, it is not a requirement.\nIf you need to provide multiple references for a transaction, separate them with hyphens ("-").\nMaximum length: 80 characters.
* @return reference
*/
@namespaceAccessible
@NamespaceAccessible
public String reference { get; set; }

@namespaceAccessible
@NamespaceAccessible
public String getReference() {
return reference;
}

@namespaceAccessible
@NamespaceAccessible
public void setReference(String reference) {
this.reference = reference;
}

/**
* Merchant account name
* @return merchantAccount
*/
@namespaceAccessible
@NamespaceAccessible
public String merchantAccount { get; set; }

@namespaceAccessible
@NamespaceAccessible
public String getMerchantAccount() {
return merchantAccount;
}

@namespaceAccessible
@NamespaceAccessible
public void setMerchantAccount(String merchantAccount) {
this.merchantAccount = merchantAccount;
}

@namespaceAccessible
/**
* Line Items
*/
@NamespaceAccessible
public List<LineItem> lineItems { get; set; }

@NamespaceAccessible
public List<LineItem> getLineItems() {
return lineItems;
}

@NamespaceAccessible
public void setLineItems(List<LineItem> lineItems) {
this.lineItems = lineItems;
}

@NamespaceAccessible
public CheckoutCaptureRequest(){}
}
3 changes: 3 additions & 0 deletions force-app/main/default/classes/CheckoutCaptureRequestTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ public class CheckoutCaptureRequestTest {

testCaptureRequest.setMerchantAccount(AdyenConstants.TEST_MERCHANT_ACCOUNT);
System.assertEquals(testCaptureRequest.getMerchantAccount(), AdyenConstants.TEST_MERCHANT_ACCOUNT );

testCaptureRequest.setLineItems(new List<LineItem>{new LineItem()});
System.assertEquals(1, testCaptureRequest.getLineItems().size());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@namespaceAccessible
@NamespaceAccessible
public interface CheckoutModificationRequest {
//interface to declare common methods from CheckoutCaptureRequest and CheckoutRefundRequest
Amount getAmount();
Expand All @@ -9,4 +9,7 @@ public interface CheckoutModificationRequest {

String getMerchantAccount();
void setMerchantAccount(String merchantAccount);

List<LineItem> getLineItems();
void setLineItems(List<LineItem> lineItems);
}
118 changes: 64 additions & 54 deletions force-app/main/default/classes/CheckoutRefundRequest.cls
Original file line number Diff line number Diff line change
@@ -1,61 +1,71 @@
/*
* Represents an Adyen Checkout Refund Request
*/
@namespaceAccessible
@NamespaceAccessible
public with sharing class CheckoutRefundRequest implements CheckoutModificationRequest {

/**
* Payment refund amount
* @return amount
*/
@namespaceAccessible
public Amount amount { get; set; }

@namespaceAccessible
public Amount getAmount() {
return amount;
}

@namespaceAccessible
public void setAmount(Amount amount) {
this.amount = amount;
}

/**
* The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status. We recommend using a unique value per payment; however, it is not a requirement.\nIf you need to provide multiple references for a transaction, separate them with hyphens ("-").\nMaximum length: 80 characters.
* @return reference
*/
@namespaceAccessible
public String reference { get; set; }

@namespaceAccessible
public String getReference() {
return reference;
}

@namespaceAccessible
public void setReference(String reference) {
this.reference = reference;
}

/**
* Merchant account name
* @return merchantAccount
*/
@namespaceAccessible
public String merchantAccount { get; set; }

@namespaceAccessible
public String getMerchantAccount() {
return merchantAccount;
}

@namespaceAccessible
public void setMerchantAccount(String merchantAccount) {
this.merchantAccount = merchantAccount;
}

@namespaceAccessible
public CheckoutRefundRequest(){}
/**
* Payment refund amount
*/
@NamespaceAccessible
public Amount amount { get; set; }

@NamespaceAccessible
public Amount getAmount() {
return amount;
}

@NamespaceAccessible
public void setAmount(Amount amount) {
this.amount = amount;
}

/**
* The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status. We recommend using a unique value per payment; however, it is not a requirement.\nIf you need to provide multiple references for a transaction, separate them with hyphens ("-").\nMaximum length: 80 characters.
*/
@NamespaceAccessible
public String reference { get; set; }

@NamespaceAccessible
public String getReference() {
return reference;
}

@NamespaceAccessible
public void setReference(String reference) {
this.reference = reference;
}

/**
* Merchant account name
*/
@NamespaceAccessible
public String merchantAccount { get; set; }

@NamespaceAccessible
public String getMerchantAccount() {
return merchantAccount;
}

@NamespaceAccessible
public void setMerchantAccount(String merchantAccount) {
this.merchantAccount = merchantAccount;
}

@NamespaceAccessible
public List<LineItem> lineItems { get; set; }

@NamespaceAccessible
public List<LineItem> getLineItems() {
return lineItems;
}

@NamespaceAccessible
public void setLineItems(List<LineItem> lineItems) {
this.lineItems = lineItems;
}

@NamespaceAccessible
public CheckoutRefundRequest(){}

}
3 changes: 3 additions & 0 deletions force-app/main/default/classes/CheckoutRefundRequestTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ public class CheckoutRefundRequestTest {

testRefundRequest.setMerchantAccount(AdyenConstants.TEST_MERCHANT_ACCOUNT);
System.assertEquals(testRefundRequest.getMerchantAccount(), AdyenConstants.TEST_MERCHANT_ACCOUNT);

testRefundRequest.setLineItems(new List<LineItem>{new LineItem()});
System.assertEquals(1, testRefundRequest.getLineItems().size());
}
}
Loading

0 comments on commit 684a6b7

Please sign in to comment.