Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: Gift wrapping cost change in One Page Checkout mode & Decimals update #19

Merged
merged 29 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
52c678f
Updated zip installer
MichaelRotaru Mar 18, 2021
5e6d342
Updated Readme.md & minor changes
luciandex Mar 22, 2021
c32aba2
Sync
MichaelRotaru Mar 30, 2021
2d18449
Readme update
MichaelRotaru Mar 30, 2021
22333ff
no message
MichaelRotaru Mar 31, 2021
42e2e1e
Sync zip
MichaelRotaru Mar 31, 2021
cf660e8
Merge pull request #4 from MichaelRotaru/master
cosminbosutar Mar 31, 2021
aee814f
Merge remote-tracking branch 'remotes/upstream/master'
cosminbosutar Apr 1, 2021
6961919
Update zip
MichaelRotaru Apr 1, 2021
d8eb49c
Merge pull request #5 from MichaelRotaru/master
cosminbosutar Apr 1, 2021
b7829a7
Fix - Gift wrapping cost change in One Page Checkout mode
MichaelRotaru Apr 1, 2021
833d5ff
Update zip
MichaelRotaru Apr 1, 2021
0d443bf
Merge pull request #6 from MichaelRotaru/master
cosminbosutar Apr 1, 2021
444498f
Modified version number from 1.0.6 to 1.0.7
luciandex Apr 2, 2021
3b4980a
Unlocked payment for custom precision setups ( less than equal with t…
MichaelRotaru Apr 5, 2021
cfedaa6
Merge pull request #7 from MichaelRotaru/master
cosminbosutar Apr 6, 2021
95dc84f
!! Updated js SDK to 10.js
luciandex Aug 24, 2021
8432925
Update README.md
luciandex Aug 24, 2021
336c252
Update README.md
luciandex Mar 10, 2022
3750010
Create config.yml
luciandex Mar 10, 2022
1caf68c
Update .gitignore
luciandex Mar 10, 2022
8a6ce50
Added Cypress tests files
luciandex Mar 10, 2022
88205bf
[fix plugin version]
luciandex Mar 10, 2022
e26406b
[increment patch version]
luciandex Mar 10, 2022
dcedaaf
Update index.js
luciandex Mar 10, 2022
84633e3
Update quick_test.js
luciandex Mar 10, 2022
59ada40
Update test_methods.js
luciandex Mar 10, 2022
159993b
typo
luciandex Mar 10, 2022
3388194
Merge pull request #8 from genuineq/cypress_tests
luciandex Mar 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# to use orbs, must use version >= 2.1
version: 2.1
orbs:
# import Cypress orb by specifying an exact version x.y.z
# or the latest version 1.x.x using "@1" syntax
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
# "cypress" is the name of the imported orb
# "run" is the name of the job defined in Cypress orb
- cypress/run:
name: Run_QUICK_tests
context:
- paylike
spec: cypress/integration/quick_test.js
filters:
branches:
only:
- cypress_tests
- cypress/run:
name: Run_FULL_tests
requires:
- Run_QUICK_tests
context:
- paylike
spec: cypress/integration/full_test.js
filters:
branches:
only:
- cypress_tests
# the following must run after all test passed
# to show latest supported version in repository readme.md file
- cypress/run:
name: Run_LOG_VERSION_remotely
requires:
- Run_FULL_tests
context:
- paylike
spec: cypress/integration/log_version.js
filters:
branches:
only:
- cypress_tests
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea
.DS_Store
.DS_Store
node_modules
cypress.env.json
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ You can also find information about the plugin here: https://paylike.io/plugins/

## Supported Prestashop versions

* The plugin has been tested with most versions of Prestashop at every iteration. We recommend using the latest version of Prestashop, but if that is not possible for some reason, test the plugin with your Prestashop version and it would probably function properly.
* Prestashop version last tested on: *1.6.1.22*
[![Last succesfull test](https://log.derikon.ro/api/v1/log/read?tag=prestashop16&view=svg&label=PrestaShop&key=ecommerce&background=A31208)](https://log.derikon.ro/api/v1/log/read?tag=prestashop16&view=html)

* The plugin has been tested with most versions of Prestashop at every iteration. We recommend using the latest version of Prestashop, but if that is not possible for some reason, test the plugin with your Prestashop version and it would probably function properly.

## Installation

Expand All @@ -23,9 +24,9 @@ Once you have installed Prestashop, follow these simple steps:
1. Signup at [paylike.io](https://paylike.io) (it’s free)
1. Create a live account
1. Create an app key for your CS-Cart website
1. Zip the paylikepayment folder.
1. Zip the paylikepayment folder (or use the zip provided).
2. Log in as administrator and upload the zip you just created under modules/add a new module (plus icon in the top right corner).
3. You will be redirected to a list that contains the Paylike plugin. Click the green button that says install, and then in the confirmation popup, click proceed with the installation.
3. You will be redirected to a list that contains the Paylike plugin. Click the green button that says install, and then in the confirmation popup, click proceed with the installation.
4. You will be redirected to the settings screen where you need to add the Public and App key that you can find in your Paylike account.

## Updating settings
Expand All @@ -34,10 +35,42 @@ Under the extension settings, you can:
* Update the payment method text in the payment gateways list
* Update the payment method description in the payment gateways list
* Update the credit card logos that you want to show (you can change which one you accept under the paylike account).
* Update the title that shows up in the payment popup
* Update the title that shows up in the payment popup
* Update the popup description, choose whether you want to show the popup (the cart contents will show up instead)
* Add test/live keys
* Set payment mode (test/live)
* Change the capture type (Instant/Manual via Paylike Tool)



## Limitations

* In order to use the Paylike module you'll need to set "Number of decimals" option to match the paylike supported decimals. Since this is a global setting that affects all currencies you cannot use at the same time currencies with different decimals.
Change this option from: Admin -> Preferences -> General

* Paylike doesn't provide support for customizable decimals display. In order to display the correct values durring the payment process you'll need to set "Decimals" option to value "True" for the "Edit" panel of the currencies used in your store.
Change this option from: Admin -> Localization -> Currencies

## How to capture / manage transactions
* Managing orders payment is possible by accessing Admin panel -> Orders section.
1. Click on order and find "PROCESS PAYLIKE PAYMENT" section.
2. Select proper action from dropdown field.
3. Click on `Process Action`. Done!

1. Capture
* In Instant mode, the orders are captured automatically
* In Delayed mode you can do this in "PROCESS PAYLIKE PAYMENT" section by selecting `Capture` from dropdown field.
2. Refund
* To Refund an order you can do this in "PROCESS PAYLIKE PAYMENT" section by selecting `Refund` from dropdown field.
3. Void
* To Void an order you can do this in "PROCESS PAYLIKE PAYMENT" section by selecting `Void` from dropdown field. The order must be captured prior to void action.

## Available features

1. Capture
* Opencart admin panel: full capture
* Paylike admin panel: full/partial capture
2. Refund
* Opencart admin panel: full/partial refund
* Paylike admin panel: full/partial refund
3. Void
* Opencart admin panel: full void
* Paylike admin panel: full/partial void
51 changes: 51 additions & 0 deletions Testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#Testing with Cypress

As you can see the plugin is bundled with Cypress testing on this repository. You can use the tests, if you have some experience with testing.

***DO NOT USE IN PRODUCTION, THE TESTS MODIFY SETTINGS AND CREATE ORDERS***

## Requirements

* A framework/shop installation is required, in which you need to have the sample theme installed and products displayed on the homepage.
* You need to have Paylike module installed and configured (**test keys** required)
* You need to have some other currencies configured in store, then set them in `cypress.env.json` file (these will be used to make payments with every currency specified)
* You also need to have an account with previous purchases for which you set the credentials in the `cypress.env.json` file
* *For testing purpose, product stock management and sending order emails need to be disabled (if applicable).*

## Getting started

1. Run following commands into plugin folder (as in this repo)

```bash
npm install cypress --save-dev
```

2. Copy and rename `cypress.env.json.example` file in the root folder and fill the data as explained bellow:
```json
{
"ENV_HTTP_AUTH_ENABLED": false, // 'true' if you have HTTP auth when accessing website
"ENV_HTTP_USER": "", // if you have HTTP auth when accessing website
"ENV_HTTP_PASS": "",
"ENV_ADMIN_URL": "", // like http(s)://baseUrl/administrator
"ENV_CLIENT_USER": "", // frontend user
"ENV_CLIENT_PASS": "",
"ENV_ADMIN_USER": "", // admin user
"ENV_ADMIN_PASS": "",
"REMOTE_LOG_URL": "", // if you want to send log information about framework/shop & paylike module versions
"ENV_CURRENCY_TO_CHANGE_WITH": "USD",
"ENV_CURRENCIES_TO_TEST": ["USD", "EUR"], // currencies used to make payments with in Full test
"ENV_CARD_NUMBER": 4100000000000000,
"ENV_CARD_EXPIRY": 1226,
"ENV_CARD_CVV": 654
}
```

3. Start the Cypress testing server.
```bash
npx cypress open
```
4. In the interface, we can choose which test to run

## Getting Problems?

Since this is a frontend test, its not always consistent, due to delays or some glitches regarding overlapping elements. If you can't get over an issue please open an issue and we'll take a look.
16 changes: 16 additions & 0 deletions cypress.env.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ENV_HTTP_AUTH_ENABLED": false,
"ENV_HTTP_USER": "",
"ENV_HTTP_PASS": "",
"ENV_ADMIN_URL": "",
"ENV_CLIENT_USER": "",
"ENV_CLIENT_PASS": "",
"ENV_ADMIN_USER": "",
"ENV_ADMIN_PASS": "",
"REMOTE_LOG_URL": "",
"ENV_CURRENCY_TO_CHANGE_WITH": "USD",
"ENV_CURRENCIES_TO_TEST": ["USD", "EUR"],
"ENV_CARD_NUMBER": 4100000000000000,
"ENV_CARD_EXPIRY": 1226,
"ENV_CARD_CVV": 654
}
1 change: 1 addition & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
60 changes: 60 additions & 0 deletions cypress/integration/full_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/// <reference types="cypress" />

'use strict';

import { TestMethods } from '../support/test_methods.js';

describe('paylike plugin full test', () => {
/**
* Login into admin and frontend to store cookies.
*/
before(() => {
TestMethods.loginIntoClientAccount();
TestMethods.loginIntoAdminBackend();
});

/**
* Run this on every test case bellow
* - preserve cookies between tests
*/
beforeEach(() => {
Cypress.Cookies.defaults({
preserve: (cookie) => {
return true;
}
});
});

let captureModes = ['Instant', 'Delayed'];
let currenciesToTest = Cypress.env('ENV_CURRENCIES_TO_TEST');

context(`make payments in "${captureModes[0]}" mode`, () => {
/** Modify Paylike settings. */
it(`change Paylike capture mode to "${captureModes[0]}"`, () => {
TestMethods.changePaylikeCaptureMode(captureModes[0]);
});

/** Make Instant payments */
for (var currency of currenciesToTest) {
TestMethods.payWithSelectedCurrency(currency, 'refund');
}
});

context(`make payments in "${captureModes[1]}" mode`, () => {
/** Modify Paylike settings. */
it(`change Paylike capture mode to "${captureModes[1]}"`, () => {
TestMethods.changePaylikeCaptureMode(captureModes[1]);
});

for (var currency of currenciesToTest) {
/**
* HARDCODED currency
*/
if ('USD' == currency || 'RON' == currency) {
TestMethods.payWithSelectedCurrency(currency, 'capture');
/** In "delayed" mode we check "void" action too. */
TestMethods.payWithSelectedCurrency(currency, 'void');
}
}
});
}); // describe
19 changes: 19 additions & 0 deletions cypress/integration/log_version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/// <reference types="cypress" />

'use strict';

import { TestMethods } from '../support/test_methods.js';

describe('paylike plugin version log remotely', () => {
/**
* Go to backend site admin
*/
before(() => {
TestMethods.loginIntoAdminBackend();
});

/** Send log after full test finished. */
it('log shop & paylike versions remotely', () => {
TestMethods.logVersions();
});
}); // describe
58 changes: 58 additions & 0 deletions cypress/integration/quick_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/// <reference types="cypress" />

'use strict';

import { TestMethods } from '../support/test_methods.js';

describe('paylike plugin quick test', () => {
/**
* Login into admin and frontend to store cookies.
*/
before(() => {
TestMethods.loginIntoClientAccount();
TestMethods.loginIntoAdminBackend();
});

/**
* Run this on every test case bellow
* - preserve cookies between tests
*/
beforeEach(() => {
Cypress.Cookies.defaults({
preserve: (cookie) => {
return true;
}
});
});

let currency = Cypress.env('ENV_CURRENCY_TO_CHANGE_WITH');
let captureMode = 'Delayed';

/**
* Modify Paylike capture mode
*/
it('modify Paylike settings for capture mode', () => {
TestMethods.changePaylikeCaptureMode(captureMode);
});

/** Pay and process order. */
/** Capture */
TestMethods.payWithSelectedCurrency(currency, 'capture');

/** Refund last created order (previously captured). */
it('Process last order captured from admin panel to be refunded', () => {
TestMethods.processOrderFromAdmin('refund', currency);
});

/** Capture */
TestMethods.payWithSelectedCurrency(currency, 'capture');

/** Partial refund last created order (previously captured). */
it('Process last order captured from admin panel to be refunded', () => {
TestMethods.processOrderFromAdmin('refund', currency, /*partialAmount*/ true);
});

/** Void */
TestMethods.payWithSelectedCurrency(currency, 'void');

}); // describe
22 changes: 22 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
Loading