Skip to content

Commit

Permalink
Merge pull request #43 from Adyen/develop
Browse files Browse the repository at this point in the history
Release v1.1.3
  • Loading branch information
RokPopov authored Sep 7, 2023
2 parents 923b1c7 + 52037f8 commit 95c1102
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @Adyen/php
* @Adyen/plugin-developers
14 changes: 14 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changelog:
categories:
- title: Breaking Changes 🛠
labels:
- Breaking change
- title: New Features 💎
labels:
- Feature
- title: Fixes ⛑️
labels:
- Fix
- title: Other Changes 🖇️
labels:
- "*"
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CodeQL"

on:
push:
branches: [ "develop","main" ]
pull_request:
branches: [ "develop","main"]
schedule:
- cron: "6 1 * * 0"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ javascript ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "adyen/adyen-magento2-expresscheckout",
"description": "Official Adyen Magento2 plugin to add express payment method shortcuts.",
"type": "magento2-module",
"version": "1.1.2",
"version": "1.1.3",
"license": "MIT",
"repositories": [
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_ExpressCheckout" setup_version="1.1.2">
<module name="Adyen_ExpressCheckout" setup_version="1.1.3">
<sequence>
<module name="Adyen_Payment"/>
</sequence>
Expand Down
81 changes: 64 additions & 17 deletions view/frontend/web/js/applepay/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,28 +282,44 @@ define([
self.shippingMethod = result[i].method_code;
}
}

let address = {
'countryId': self.shippingAddress.country_id,
'region': self.shippingAddress.region,
'regionId': getRegionId(self.shippingAddress.country_id, self.shippingAddress.region),
'postcode': self.shippingAddress.postcode
};


// Create payload to get totals
let totalsPayload = {
'addressInformation': {
'address': {
'countryId': self.shippingAddress.country_id,
'region': self.shippingAddress.region,
'regionId': getRegionId(self.shippingAddress.country_id, self.shippingAddress.region),
'postcode': self.shippingAddress.postcode
},
'address': address,
'shipping_method_code': self.shippingMethods[shippingMethods[0].identifier].method_code,
'shipping_carrier_code': self.shippingMethods[shippingMethods[0].identifier].carrier_code
}
};

// Create payload to update quote
let shippingInformationPayload = {
'addressInformation': {
...totalsPayload.addressInformation,
'shipping_address': address,
'billing_address': address
}
};

delete shippingInformationPayload.addressInformation.address;
setShippingInformation(shippingInformationPayload, this.isProductView);

setTotalsInfo(totalsPayload, this.isProductView)
.done((response) => {
let applePayShippingContactUpdate = {};

applePayShippingContactUpdate.newShippingMethods = shippingMethods;
applePayShippingContactUpdate.newTotal = {
label: $t('Grand Total'),
amount: response.grand_total.toString()
amount: (response.grand_total + response.tax_amount).toString()
};
applePayShippingContactUpdate.newLineItems = [
{
Expand All @@ -317,6 +333,15 @@ define([
amount: shippingMethods[0].amount.toString()
}
];

if (response.tax_amount > 0) {
applePayShippingContactUpdate.newLineItems.push({
type: 'final',
label: $t('Tax'),
amount: response.tax_amount.toString()
})
}

resolve(applePayShippingContactUpdate);
// Pass shipping methods back
}).fail((e) => {
Expand All @@ -328,29 +353,42 @@ define([

onShippingMethodSelect: function (resolve, reject, event) {
let self = this;

let shippingMethod = event.shippingMethod;
let payload = {

let address = {
'countryId': self.shippingAddress.country_id,
'region': self.shippingAddress.region,
'regionId': getRegionId(self.shippingAddress.country_id, self.shippingAddress.region),
'postcode': self.shippingAddress.postcode
};

let totalsPayload = {
'addressInformation': {
'address': {
'countryId': self.shippingAddress.country_id,
'region': self.shippingAddress.region,
'regionId': getRegionId(self.shippingAddress.country_id, self.shippingAddress.region),
'postcode': self.shippingAddress.postcode
},
'address': address,
'shipping_method_code': self.shippingMethods[shippingMethod.identifier].method_code,
'shipping_carrier_code': self.shippingMethods[shippingMethod.identifier].carrier_code
}
};

setTotalsInfo(payload, this.isProductView)
let shippingInformationPayload = {
'addressInformation': {
...totalsPayload.addressInformation,
'shipping_address': address,
'billing_address': address
}
};

delete shippingInformationPayload.addressInformation.address;
setShippingInformation(shippingInformationPayload, this.isProductView);

setTotalsInfo(totalsPayload, this.isProductView)
.done((response) => {
let applePayShippingMethodUpdate = {};

applePayShippingMethodUpdate.newTotal = {
type: 'final',
label: $t('Grand Total'),
amount: response.grand_total.toString()
amount: (response.grand_total + response.tax_amount).toString()
};
applePayShippingMethodUpdate.newLineItems = [
{
Expand All @@ -364,6 +402,15 @@ define([
amount: shippingMethod.amount.toString()
}
];

if (response.tax_amount > 0) {
applePayShippingMethodUpdate.newLineItems.push({
type: 'final',
label: $t('Tax'),
amount: response.tax_amount.toString()
})
}

self.shippingMethod = shippingMethod.identifier;
resolve(applePayShippingMethodUpdate);
}).fail((e) => {
Expand Down

0 comments on commit 95c1102

Please sign in to comment.