{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"params":[],"method":"get"},"next":{"description":"","pages":[]},"title":"Customizing Your WebSphere Commerce Integration","type":"basic","slug":"customizing-your-websphere-commerce-integration","excerpt":"","body":"# Getting the Plugin\nThe plugin is available in our GitHub repository: [https://github.com/apruve/apruve-websphere](https://github.com/apruve/apruve-websphere)\n\nThe project contains the following folders:\n- WC\n  - lib - contains required JAR files to communicate with Apruve\n  - xml - payment configuration related files\n- ZApruvePaymentPlugin.jar - EJB project JAR which has entity beans to persist Apruve data and payment plugin session bean\n- WebSphereCommerceServerExtensionsLogic - contains commands and utility classes\n- Stores - Struts config file and properties file\n- Dataload\n  - acp - contains access control policy files\n  - sql - SQL scripts that are required to create tables, make cmdreg entries and policy entries\n  \n# How to Integrate\n\n## Add the EJB project to your workspace\nIf your workspace already has ZApruvePaymentPlugin as a EJB project, and connected to SVN, please disconnect the project from SVN and make sure to check 'also delete the SVN meta information from the file system', then click Ok.\n\n![Deleting the Existing Project](https://s3.amazonaws.com/apruve-documentation-resources/websphere_deleting_project.png)\n\nTo import the EJB project into your workspace, right click on an empty space in navigation view, select `Import`, select the EJB folder, then select EJB JAR file.\n\n![Importing the EJB JAR](https://s3.amazonaws.com/apruve-documentation-resources/websphere_importing_jar.png)\n\nOnce the JAR file has been imported, update your project's build path. Right-click on the project, click `Properties`, then select `Build Path`. Add `WebSphereCommerceServerExtensionsData` to your build path.\n\n![Updating the Build Path](https://s3.amazonaws.com/apruve-documentation-resources/websphere_update_build_path.png)\n\nPrepare the project for deployment:\n\n![Prepare the Project for Deployment](https://s3.amazonaws.com/apruve-documentation-resources/websphere_prepare_for_deployment.png)\n\nRestart WC server, and republish it.\n\nAdd `ZApruvePaymentPlugin` to your WC project\n\nAdd `ZApruvePaymentPlugin` to `Stores/WebContent/META-INF/MANIFEST.MF`\n\n## Steps to republish/to fix issues with ZApruvePaymentPlugin.jar during publishing\n1. Right click on the server within the Servers tab view\n2. Choose Clean... (the option below Publish).\n3. The dialog that appears next should ask you: \"Clean will discard all publish state and republish from scratch. Are you sure you want to clean all published projects?\". The dialog will also present you with the two buttons: \"OK\" and \"Cancel\"\n4. The state of server should not matter, but these steps were tested with the server started already.\n\n## Coding Changes\n\n### Struts Configuration\nCopy `Stores/WebContent/WEB-INF/struts-config-apruve.xml` to your stores project\n\n### XML Changes\nThis is required to configure your plugin with the Apruve payment method.\n\nMerge the below mentioned files from the Zip folder:\n\n**File: \\WC\\xml\\config\\payments\\edp\\groups\\default\\PaymentMappings.xml**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<Mapping paymentActionRule=\\\"Early Deposit\\\" paymentConfiguration=\\\"ZApruveOnlineConfiguration\\\" paymentMethod=\\\"Apruve\\\"/>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n**File: \\WC\\xml\\config\\payments\\edp\\groups\\default\\PaymentMethodConfigurations.xml**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<PaymentMethodConfiguration dependentCreditRequired=\\\"true\\\" humanEditable=\\\"true\\\" maximumAmount=\\\"Unbounded\\\" \\n  minimumAmount=\\\"0\\\" name=\\\"ZApruveOnlineConfiguration\\\" partiallyConsumable=\\\"true\\\" paymentSystemName=\\\"ZApruveOnlineSystem\\\" \\n  priority=\\\"HIGH\\\" refundAllowed=\\\"true\\\" systemEditable=\\\"true\\\"/> \",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n**File: \\WC\\xml\\config\\payments\\ppc\\plugins\\PaymentSystemPluginMapping.xml**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<PaymentSystemName name=\\\"ZApruveOnlineSystem\\\"> \\n  <Mapping paymentConfigurationId=\\\"default\\\" pluginName=\\\"ZApruvePaymentPlugin\\\"/>\\n</PaymentSystemName>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\nCopy the folders:\n- WC\\xml\\config\\payments\\edp\\groups\\default\\ZApruveOnlineConfiguration\n- WC\\xml\\config\\payments\\ppc\\plugins\\ZApruvePaymentPlugin\n\n### View/JS Changes\n\n**File:** `/Stores/WebContent/ZCGAuroraB2C/ShoppingArea/CheckoutSection/OrderShippingBillingDetails.jsp`\n**Page:** Shipping Billing Method<br/>\n**Description:**\nCode Added to redirect to the Apruve account and toggle the payment options based on the presence of Apruve.\n\n**File:** `/Stores/WebContent/ZCGAuroraB2C/Snippets/EDP/PaymentMethods/PaymentAmount.jspf`\n**Page:** Shipping Billing Method\n**Description:**\nCode Added to populate the amount in the Amount text box during the existing Apruve payment method.\n\n**File:** `/Stores/WebContent/ZCGAuroraB2C/ShoppingArea/CheckoutSection/CheckoutPaymentsAndBillingAddress.jspf`\n**Page:** Shipping Billing Method\n**Description:**\nConditions added to display Apruve payment methods and to send the parameters which will be used in the piAdd/Update.\n\n**File:** `/Stores/WebContent/ZCGAuroraB2C/ShoppingArea/CheckoutSection/CheckoutPaymentAndBillingAddressSummary.jspf`\n**Page:** Shipping Billing Method\n**Description:**\nCondition added to stop display billing address if the payment method is Apruve and display 'Apruve' as billing address.\n\n**File:** `/Stores/WebContent/ZCGAuroraB2C/javascript/CheckoutArea/CheckoutPayments.js`\n**Page:** Shipping Billing Method\n**Description:**\nConditions added to handle Apruve Payments.\n\n**File:** `/Stores/WebContent/ZCGAuroraB2C/Snippets/EDP/PaymentMethods/StandardApruve.jsp`\n**Page:** Shipping Billing Method\n**Description:**\nPayment snippet for the Apruve payment method (PaymentAmount.jspf will be included in this jsp, to pass piAmount for piAdd/update. Make sure that Apruve payment method is not displayed with other payment methods in the drop down, for this code added in the CheckoutPaymentsAndBillingAddress.jspf)\n\n> **Note:** If you are not using ZCGAuroraB2C, like B2BDirect or Elite or any other store, this will be \n> OrderItemDisplay.jsp. Copy snippet from &lt;!-- Apruve requirement start --> till &lt;!-- Apruve requirement end–>. If you have any questions, please reach out to Zobrist Apruve support team at ApruveSupport:::at:::zobristinc.com.\n\n### Resource Bundle\nCopy the below mentioned new property files for communication with the Apruve environment\n- **Apruve.properties** (`stores/src/<StoreIdentifier>/com/zobristinc/commerce/payments/apruve/Apruve.properties`) \n- **apruveConfig.properties:** This file helps to extend the default implementation of the plugin\n> **Note:** A detailed explanation of how to configure the above two files is in the section [How to Configure the Plugin](#section-apruveconfig-properties) below.\n\n- **ApruveErrorMessages.properties:** This file consists of error messages that may occur during the payment process.\n- **ApruveLineDetails.properties**\n\nCopy Apruve-related (as designated by \"Apruve requirement\" comments) key values from `storetext_v2.properties` to your storetext property file.\n\n### Java file changes\nAdd ZApruvePaymentPlugin to the build path of your WebSphereExtensionLogic\n\n**File:** `com/zobristinc/commerce/integration/apruve/commands/OrderItemsDetail.java`\n**Description:**\nValue object for order items information, will be used while creating the json or hash to create Apruve order.\n\n**File:** `com/zobristinc/commerce/integration/apruve/commands/ZCOrderInformationCmd.java`\n**Description:**\nInterface for new controller command\n\n**File:** `com/zobristinc/commerce/integration/apruve/commands/ZCOrderInformationCmdImpl.java`\n**Description:**\nImplementation class forZCOrderInformationCmd, used to create secure hash and json object used for creating apruve order\n\n**File:** `com/zobristinc/commerce/integration/apruve/commands/ZCApruveProcessWebhookResponseCmd.java`\n**Description:**\nInterface for new controller command\n\n**File:** `com/zobristinc/commerce/integration/apruve/commands/ZCApruveProcessWebhookResponseCmdImpl.java`\n**Description:**\nImplementation class for ZCApruveProcessWebhookResponseCmd, this command will be used to receive the responses from webhooks and perform respective operations in commerce\n\n**File:** `com/zobristinc/commerce/integration/apruve/commands/ZCReturnFromApruveCmd.java`\n**Description:**\nInterface for new controller command\n\n**File:** `com/zobristinc/commerce/integration/apruve/commands/ZCReturnFromApruveCmdImpl.java`\n**Description:**\nImplementation class for ZCReturnFromApruveCmd, this command will be called to add payment in commerce after creating the order at Apruve.\n\n### Environment Changes\n\nAdd `ZApruvePaymentPlugin.jar` to the lib directory of the WC project.\n\nAdd `ZApruvePaymentPlugin.jar` to `Stores/WebContent/META-INF/MANIFEST.MF`\n\nCopy the following files into 'DataLoad'\n- `acp/common/ApruveACPPolicy.xml`\n- `sql/common/Apruve.sql`\n\nMake sure you include `ApruveACPPolicy.xml` in the ACP load script. Run `Apruve.sql` only once in each environment.\n\nImport the certificate for the host mentioned in the webhooks. For example: `aprvdev.zobristinc.com` (host name of webhook url given in merchant site)\n\n> Steps on importing certificate can be found in the [deploy and set up instructions](doc:integrating-with-websphere-commerce) \n\n# How to configure the Apruve plugin\nThere are two places you need to configure:\n\n## apruveConfig.properties\nThis file is for extending the default implementation. Every key class is configured in `apruveConfig.properties`. As we cannot predict every requirement, code is written to be flexible, and as such, we extend request building, processing and response handling.\n\nIf you only have a single store or brand, you can leave `_<storeidentifier>` off of the property names. For example:\n```\nApruveProcessor=com.zobristinc.commerce.payments.apruve.processor.ZCApruveDirectProcessor\n```\n\nThese are the properties you can configure\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"`ApruveProcessor_<storeidentifier>`\",\n    \"1-0\": \"`ApruveRequestBuilder_<storeidentifier>`\",\n    \"2-0\": \"`ApruveResponseProcessor_<storeidentifier>`\",\n    \"3-0\": \"`ApruveUtility_<storeidentifier>`\",\n    \"4-0\": \"`ApruveProcessorHelper_<storeidentifier>`\",\n    \"5-0\": \"`ApruveErrorMessage_<storeidentifier>`\",\n    \"6-0\": \"`apruveConstantTextSource_<storeidentifier>`\",\n    \"7-0\": \"`apruveParamsSource_<storeidentifier>`\",\n    \"0-1\": \"This is the processor object which calls apruve API\",\n    \"1-1\": \"This class will actually build the request object.\",\n    \"2-1\": \"Once request is processed, reply is wrapped into a response object. We need to process this response, which is done in ResponseProcessor Object.\",\n    \"5-1\": \"Location of properties file\",\n    \"7-1\": \"This can be MERCHCONFINFO or location of properties file. If configured as MERCHCONFINFO you need to make sure all data is in MERCHCONFINFO table\"\n  },\n  \"cols\": 2,\n  \"rows\": 8\n}\n[/block]\n## Apruve.properties.\nThis file can be found in `Stores/src/<storeName>/com/zobristinc/commerce/payments/apruve/`.\n\n```\n# Payment method id, default value is Apruve\nApruvePayMethodId = Apruve\n# You can choose to add payment on return from apruve. In case you want to delay it till checkout page\naddPaymentOnReturn = true\n# This is gift card payment method. When there are gift card payments we sent gift card amount as other payments\nGiftCardPayMethod = GiftCard\n#merchant details\n#Merchant authentication information\nMerchant_ID = <Your Apruve Merchant ID>\nMerchant_API_Key = <Your Apruve API Key>\n#flags used for creating finalize and invoice\n#if we set FINALIZE_ON_CREATE as true then the apruve order gets finalize immediately after creating order else we can set it as false and finalize the order later\nFINALIZE_ON_CREATE = false\n#if we set INVOICE_ON_CREATE as true then the apruve will generate invoice automatically when order gets created else we can set it as false and we can create invoice latter.\nINVOICE_ON_CREATE = false\n#Request header values used while creating requests \naccept = application/json\ncontentType = application/json\n\n#Request URLs\n#URL used for finalizing order\nAPRUVE_ORDER_FINALIZE_URL_START = https://app.apruve.com/api/v4/orders/\nAPRUVE_ORDER_FINALIZE_URL_END = /finalize\n#URL used for updating order\nAPRUVE_UPDATE_ORDER_URL = https://app.apruve.com/api/v4/orders/\n#URL used for creating order items\nAPRUVE_ORDER_CREATE_ORDER_ITEMS_URL_START = https://app.apruve.com/api/v4/orders/\nAPRUVE_ORDER_CREATE_ORDER_ITEMS_URL_END = /order_items\n#URL used for updating order items\nAPRUVE_UPDATE_ORDER_ITEMS_URL = https://app.apruve.com/api/v4/order_items/\n#URL used for deleting order items\nAPRUVE_DELETE_ORDER_ITEMS_URL = https://app.apruve.com/api/v4/order_items/\n#URL used for creating invoice\nAPRUVE_ORDER_CREATE_INVOICE_URL_START = https://app.apruve.com/api/v4/orders/\nAPRUVE_ORDER_CREATE_INVOICE_URL_END = /invoices\n#Public key file path used for verifying signature for webhook requests(file given by apruve).\n
APRUVE_PUBLIC_KEY_FILE_PATH = C:/IBM/WCDE80/workspace/ZApruvePaymentPlugin/ejbModule/com/apruve/payment/plugin/public_key.txt\n```\n\n# Customizing Code\nFirst step to customize plugin code is you need to update apruveConfig.properties file. Update the required class you \nwant to customize.\n\nEvery request is generated using simple value object. Example, if you want to send different value for 'createapruveorderrequest', extend `ZCApruveCreateOrderRequestObject` and overwrite `getJSONRequestObj`.\n\nExtend `ZCApruveRequestBuilder` and overwrite `getApruveCreateOrderTransactionObject` method to return `new <ext>ApruveCreateOrderRequestObject`.","updates":[],"order":11,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5983629979391c001e55929b","project":"58b9e955fba7da250056ff86","version":{"version":"4.0","version_clean":"4.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["58b9e955fba7da250056ff8a","58b9e9e168a4a5190011dcc2","58b9ea1de87271190074c623","58b9f9df4022e60f00ae20af","58bda4f77181082500275455","58bda69b8bcd092f00e52862","58bda751b4e9640f00e4bdaf","58e800fabc0deb0f002801f3","5925bfd9504e5239003807f4","5925c026aef9fd27008525c0","5925c0e7dd71b51b00ccc329","592d872451a3e80f00eb4a1a","592d9539b9b6b91900569ea0","592d990a51a3e80f00eb4c25","592d9bf480832f0f00ddfa46","592d9d5051a3e80f00eb4e02","592dbd5cd97832190073d76a","598360d76050430034ef4e07","598363237c926c0028d2e420","598363755de0a1002049efad","598363c27c926c0028d2e442","59c15f2ebc639a0032f770f0"],"_id":"58b9e955fba7da250056ff89","releaseDate":"2017-03-03T22:08:21.880Z","__v":22,"createdAt":"2017-03-03T22:08:21.880Z","project":"58b9e955fba7da250056ff86"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Integrations","slug":"ecommerce-integrations","order":4,"from_sync":false,"reference":false,"_id":"598363755de0a1002049efad","project":"58b9e955fba7da250056ff86","version":"58b9e955fba7da250056ff89","isAPI":false,"createdAt":"2017-08-03T17:55:01.947Z","__v":0},"user":"59232ee4e465c11900921e8a","createdAt":"2017-08-03T17:51:21.271Z","githubsync":"","__v":0,"parentDoc":null,"updatedAt":"2017-08-04T16:15:55.501Z"}

Customizing Your WebSphere Commerce Integration


# Getting the Plugin The plugin is available in our GitHub repository: [https://github.com/apruve/apruve-websphere](https://github.com/apruve/apruve-websphere) The project contains the following folders: - WC - lib - contains required JAR files to communicate with Apruve - xml - payment configuration related files - ZApruvePaymentPlugin.jar - EJB project JAR which has entity beans to persist Apruve data and payment plugin session bean - WebSphereCommerceServerExtensionsLogic - contains commands and utility classes - Stores - Struts config file and properties file - Dataload - acp - contains access control policy files - sql - SQL scripts that are required to create tables, make cmdreg entries and policy entries # How to Integrate ## Add the EJB project to your workspace If your workspace already has ZApruvePaymentPlugin as a EJB project, and connected to SVN, please disconnect the project from SVN and make sure to check 'also delete the SVN meta information from the file system', then click Ok. ![Deleting the Existing Project](https://s3.amazonaws.com/apruve-documentation-resources/websphere_deleting_project.png) To import the EJB project into your workspace, right click on an empty space in navigation view, select `Import`, select the EJB folder, then select EJB JAR file. ![Importing the EJB JAR](https://s3.amazonaws.com/apruve-documentation-resources/websphere_importing_jar.png) Once the JAR file has been imported, update your project's build path. Right-click on the project, click `Properties`, then select `Build Path`. Add `WebSphereCommerceServerExtensionsData` to your build path. ![Updating the Build Path](https://s3.amazonaws.com/apruve-documentation-resources/websphere_update_build_path.png) Prepare the project for deployment: ![Prepare the Project for Deployment](https://s3.amazonaws.com/apruve-documentation-resources/websphere_prepare_for_deployment.png) Restart WC server, and republish it. Add `ZApruvePaymentPlugin` to your WC project Add `ZApruvePaymentPlugin` to `Stores/WebContent/META-INF/MANIFEST.MF` ## Steps to republish/to fix issues with ZApruvePaymentPlugin.jar during publishing 1. Right click on the server within the Servers tab view 2. Choose Clean... (the option below Publish). 3. The dialog that appears next should ask you: "Clean will discard all publish state and republish from scratch. Are you sure you want to clean all published projects?". The dialog will also present you with the two buttons: "OK" and "Cancel" 4. The state of server should not matter, but these steps were tested with the server started already. ## Coding Changes ### Struts Configuration Copy `Stores/WebContent/WEB-INF/struts-config-apruve.xml` to your stores project ### XML Changes This is required to configure your plugin with the Apruve payment method. Merge the below mentioned files from the Zip folder: **File: \WC\xml\config\payments\edp\groups\default\PaymentMappings.xml** [block:code] { "codes": [ { "code": "<Mapping paymentActionRule=\"Early Deposit\" paymentConfiguration=\"ZApruveOnlineConfiguration\" paymentMethod=\"Apruve\"/>", "language": "xml" } ] } [/block] **File: \WC\xml\config\payments\edp\groups\default\PaymentMethodConfigurations.xml** [block:code] { "codes": [ { "code": "<PaymentMethodConfiguration dependentCreditRequired=\"true\" humanEditable=\"true\" maximumAmount=\"Unbounded\" \n minimumAmount=\"0\" name=\"ZApruveOnlineConfiguration\" partiallyConsumable=\"true\" paymentSystemName=\"ZApruveOnlineSystem\" \n priority=\"HIGH\" refundAllowed=\"true\" systemEditable=\"true\"/> ", "language": "xml" } ] } [/block] **File: \WC\xml\config\payments\ppc\plugins\PaymentSystemPluginMapping.xml** [block:code] { "codes": [ { "code": "<PaymentSystemName name=\"ZApruveOnlineSystem\"> \n <Mapping paymentConfigurationId=\"default\" pluginName=\"ZApruvePaymentPlugin\"/>\n</PaymentSystemName>", "language": "xml" } ] } [/block] Copy the folders: - WC\xml\config\payments\edp\groups\default\ZApruveOnlineConfiguration - WC\xml\config\payments\ppc\plugins\ZApruvePaymentPlugin ### View/JS Changes **File:** `/Stores/WebContent/ZCGAuroraB2C/ShoppingArea/CheckoutSection/OrderShippingBillingDetails.jsp` **Page:** Shipping Billing Method<br/> **Description:** Code Added to redirect to the Apruve account and toggle the payment options based on the presence of Apruve. **File:** `/Stores/WebContent/ZCGAuroraB2C/Snippets/EDP/PaymentMethods/PaymentAmount.jspf` **Page:** Shipping Billing Method **Description:** Code Added to populate the amount in the Amount text box during the existing Apruve payment method. **File:** `/Stores/WebContent/ZCGAuroraB2C/ShoppingArea/CheckoutSection/CheckoutPaymentsAndBillingAddress.jspf` **Page:** Shipping Billing Method **Description:** Conditions added to display Apruve payment methods and to send the parameters which will be used in the piAdd/Update. **File:** `/Stores/WebContent/ZCGAuroraB2C/ShoppingArea/CheckoutSection/CheckoutPaymentAndBillingAddressSummary.jspf` **Page:** Shipping Billing Method **Description:** Condition added to stop display billing address if the payment method is Apruve and display 'Apruve' as billing address. **File:** `/Stores/WebContent/ZCGAuroraB2C/javascript/CheckoutArea/CheckoutPayments.js` **Page:** Shipping Billing Method **Description:** Conditions added to handle Apruve Payments. **File:** `/Stores/WebContent/ZCGAuroraB2C/Snippets/EDP/PaymentMethods/StandardApruve.jsp` **Page:** Shipping Billing Method **Description:** Payment snippet for the Apruve payment method (PaymentAmount.jspf will be included in this jsp, to pass piAmount for piAdd/update. Make sure that Apruve payment method is not displayed with other payment methods in the drop down, for this code added in the CheckoutPaymentsAndBillingAddress.jspf) > **Note:** If you are not using ZCGAuroraB2C, like B2BDirect or Elite or any other store, this will be > OrderItemDisplay.jsp. Copy snippet from &lt;!-- Apruve requirement start --> till &lt;!-- Apruve requirement end–>. If you have any questions, please reach out to Zobrist Apruve support team at [email protected] ### Resource Bundle Copy the below mentioned new property files for communication with the Apruve environment - **Apruve.properties** (`stores/src/<StoreIdentifier>/com/zobristinc/commerce/payments/apruve/Apruve.properties`) - **apruveConfig.properties:** This file helps to extend the default implementation of the plugin > **Note:** A detailed explanation of how to configure the above two files is in the section [How to Configure the Plugin](#section-apruveconfig-properties) below. - **ApruveErrorMessages.properties:** This file consists of error messages that may occur during the payment process. - **ApruveLineDetails.properties** Copy Apruve-related (as designated by "Apruve requirement" comments) key values from `storetext_v2.properties` to your storetext property file. ### Java file changes Add ZApruvePaymentPlugin to the build path of your WebSphereExtensionLogic **File:** `com/zobristinc/commerce/integration/apruve/commands/OrderItemsDetail.java` **Description:** Value object for order items information, will be used while creating the json or hash to create Apruve order. **File:** `com/zobristinc/commerce/integration/apruve/commands/ZCOrderInformationCmd.java` **Description:** Interface for new controller command **File:** `com/zobristinc/commerce/integration/apruve/commands/ZCOrderInformationCmdImpl.java` **Description:** Implementation class forZCOrderInformationCmd, used to create secure hash and json object used for creating apruve order **File:** `com/zobristinc/commerce/integration/apruve/commands/ZCApruveProcessWebhookResponseCmd.java` **Description:** Interface for new controller command **File:** `com/zobristinc/commerce/integration/apruve/commands/ZCApruveProcessWebhookResponseCmdImpl.java` **Description:** Implementation class for ZCApruveProcessWebhookResponseCmd, this command will be used to receive the responses from webhooks and perform respective operations in commerce **File:** `com/zobristinc/commerce/integration/apruve/commands/ZCReturnFromApruveCmd.java` **Description:** Interface for new controller command **File:** `com/zobristinc/commerce/integration/apruve/commands/ZCReturnFromApruveCmdImpl.java` **Description:** Implementation class for ZCReturnFromApruveCmd, this command will be called to add payment in commerce after creating the order at Apruve. ### Environment Changes Add `ZApruvePaymentPlugin.jar` to the lib directory of the WC project. Add `ZApruvePaymentPlugin.jar` to `Stores/WebContent/META-INF/MANIFEST.MF` Copy the following files into 'DataLoad' - `acp/common/ApruveACPPolicy.xml` - `sql/common/Apruve.sql` Make sure you include `ApruveACPPolicy.xml` in the ACP load script. Run `Apruve.sql` only once in each environment. Import the certificate for the host mentioned in the webhooks. For example: `aprvdev.zobristinc.com` (host name of webhook url given in merchant site) > Steps on importing certificate can be found in the [deploy and set up instructions](doc:integrating-with-websphere-commerce) # How to configure the Apruve plugin There are two places you need to configure: ## apruveConfig.properties This file is for extending the default implementation. Every key class is configured in `apruveConfig.properties`. As we cannot predict every requirement, code is written to be flexible, and as such, we extend request building, processing and response handling. If you only have a single store or brand, you can leave `_<storeidentifier>` off of the property names. For example: ``` ApruveProcessor=com.zobristinc.commerce.payments.apruve.processor.ZCApruveDirectProcessor ``` These are the properties you can configure [block:parameters] { "data": { "h-0": "Property", "h-1": "Description", "0-0": "`ApruveProcessor_<storeidentifier>`", "1-0": "`ApruveRequestBuilder_<storeidentifier>`", "2-0": "`ApruveResponseProcessor_<storeidentifier>`", "3-0": "`ApruveUtility_<storeidentifier>`", "4-0": "`ApruveProcessorHelper_<storeidentifier>`", "5-0": "`ApruveErrorMessage_<storeidentifier>`", "6-0": "`apruveConstantTextSource_<storeidentifier>`", "7-0": "`apruveParamsSource_<storeidentifier>`", "0-1": "This is the processor object which calls apruve API", "1-1": "This class will actually build the request object.", "2-1": "Once request is processed, reply is wrapped into a response object. We need to process this response, which is done in ResponseProcessor Object.", "5-1": "Location of properties file", "7-1": "This can be MERCHCONFINFO or location of properties file. If configured as MERCHCONFINFO you need to make sure all data is in MERCHCONFINFO table" }, "cols": 2, "rows": 8 } [/block] ## Apruve.properties. This file can be found in `Stores/src/<storeName>/com/zobristinc/commerce/payments/apruve/`. ``` # Payment method id, default value is Apruve ApruvePayMethodId = Apruve # You can choose to add payment on return from apruve. In case you want to delay it till checkout page addPaymentOnReturn = true # This is gift card payment method. When there are gift card payments we sent gift card amount as other payments GiftCardPayMethod = GiftCard #merchant details #Merchant authentication information Merchant_ID = <Your Apruve Merchant ID> Merchant_API_Key = <Your Apruve API Key> #flags used for creating finalize and invoice #if we set FINALIZE_ON_CREATE as true then the apruve order gets finalize immediately after creating order else we can set it as false and finalize the order later FINALIZE_ON_CREATE = false #if we set INVOICE_ON_CREATE as true then the apruve will generate invoice automatically when order gets created else we can set it as false and we can create invoice latter. INVOICE_ON_CREATE = false #Request header values used while creating requests  accept = application/json contentType = application/json #Request URLs #URL used for finalizing order APRUVE_ORDER_FINALIZE_URL_START = https://app.apruve.com/api/v4/orders/ APRUVE_ORDER_FINALIZE_URL_END = /finalize #URL used for updating order APRUVE_UPDATE_ORDER_URL = https://app.apruve.com/api/v4/orders/ #URL used for creating order items APRUVE_ORDER_CREATE_ORDER_ITEMS_URL_START = https://app.apruve.com/api/v4/orders/ APRUVE_ORDER_CREATE_ORDER_ITEMS_URL_END = /order_items #URL used for updating order items APRUVE_UPDATE_ORDER_ITEMS_URL = https://app.apruve.com/api/v4/order_items/ #URL used for deleting order items APRUVE_DELETE_ORDER_ITEMS_URL = https://app.apruve.com/api/v4/order_items/ #URL used for creating invoice APRUVE_ORDER_CREATE_INVOICE_URL_START = https://app.apruve.com/api/v4/orders/ APRUVE_ORDER_CREATE_INVOICE_URL_END = /invoices #Public key file path used for verifying signature for webhook requests(file given by apruve). 
APRUVE_PUBLIC_KEY_FILE_PATH = C:/IBM/WCDE80/workspace/ZApruvePaymentPlugin/ejbModule/com/apruve/payment/plugin/public_key.txt ``` # Customizing Code First step to customize plugin code is you need to update apruveConfig.properties file. Update the required class you want to customize. Every request is generated using simple value object. Example, if you want to send different value for 'createapruveorderrequest', extend `ZCApruveCreateOrderRequestObject` and overwrite `getJSONRequestObj`. Extend `ZCApruveRequestBuilder` and overwrite `getApruveCreateOrderTransactionObject` method to return `new <ext>ApruveCreateOrderRequestObject`.