Skip to content

Commit 17cc718

Browse files
fix: alignments in optional properties in hooks (#70)
* fix(ios): Only applying optional properties in cordova hooks if they exist References: - https://outsystemsrd.atlassian.net/browse/RMET-4475 * fix: Optinal fields for capacitor hook Applying for both Android and iOS Not the original source of the issue in https://outsystemsrd.atlassian.net/browse/RMET-4475 should be addressed to be fixed. * chore(release): prepare version 1.2.12 * docs: correct changelog entry
1 parent 085462b commit 17cc718

File tree

5 files changed

+38
-12
lines changed

5 files changed

+38
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
The changes documented here do not include those from the original repository.
88

9+
## 1.2.12
10+
11+
### Fixes
12+
13+
- Align handling of optional payment config properties in Cordova / Capacitor hooks. Fixes build error for iOS when missing properties like `payment_supported_card_countries`.
14+
915
## 1.2.11
1016

1117
### Fixes

hooks/capacitorCopyPreferences.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,18 @@ function configureAndroid(paymentConfig) {
7070
merchant_country_code = validateAndAssignField(configItem, "merchant_country_code", error_list, "Merchant Country");
7171
payment_allowed_networks = validateAndAssignField(configItem, "payment_allowed_networks", error_list, "Payment Allowed Networks");
7272
payment_supported_capabilities = validateAndAssignField(configItem, "payment_supported_capabilities", error_list, "Payment Supported Capabilities");
73-
payment_supported_card_countries = configItem.payment_supported_card_countries;
74-
shipping_supported_contacts = configItem.shipping_supported_contacts;
75-
shipping_country_codes = configItem.shipping_country_codes;
76-
billing_supported_contacts = configItem.billing_supported_contacts;
73+
if(configItem.payment_supported_card_countries && configItem.payment_supported_card_countries.length > 0){
74+
payment_supported_card_countries = configItem.payment_supported_card_countries;
75+
}
76+
if(configItem.shipping_supported_contacts && configItem.shipping_supported_contacts.length > 0){
77+
shipping_supported_contacts = configItem.shipping_supported_contacts;
78+
}
79+
if(configItem.shipping_country_codes && configItem.shipping_country_codes.length > 0){
80+
shipping_country_codes = configItem.shipping_country_codes;
81+
}
82+
if(configItem.billing_supported_contacts && configItem.billing_supported_contacts.length > 0){
83+
billing_supported_contacts = configItem.billing_supported_contacts;
84+
}
7785

7886
if (configItem.tokenization) {
7987
gateway = configItem.tokenization.gateway;
@@ -180,9 +188,15 @@ function configureIOS(paymentConfig) {
180188
merchant_country_code = validateAndAssignField(configItem, "merchant_country_code", error_list, "Merchant Country");
181189
payment_allowed_networks = validateAndAssignField(configItem, "payment_allowed_networks", error_list, "Payment Allowed Networks");
182190
payment_supported_capabilities = validateAndAssignField(configItem, "payment_supported_capabilities", error_list, "Payment Supported Capabilities");
183-
shipping_supported_contacts = configItem.shipping_supported_contacts;
184-
billing_supported_contacts = configItem.billing_supported_contacts;
185-
payment_supported_card_countries = configItem.payment_supported_card_countries;
191+
if (configItem.shipping_supported_contacts != null && configItem.shipping_supported_contacts.length > 0) {
192+
shipping_supported_contacts = configItem.shipping_supported_contacts;
193+
}
194+
if (configItem.billing_supported_contacts != null && configItem.billing_supported_contacts.length > 0) {
195+
billing_supported_contacts = configItem.billing_supported_contacts;
196+
}
197+
if (configItem.payment_supported_card_countries != null && configItem.payment_supported_card_countries.length > 0) {
198+
payment_supported_card_countries = configItem.payment_supported_card_countries;
199+
}
186200

187201
if (configItem.tokenization) {
188202
payment_gateway = validateAndAssignField(configItem.tokenization, "gateway", error_list, "Payment Gateway Name");

hooks/ios/iOSCopyPreferences.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,15 @@ module.exports = function (context) {
8888
error_list.push('Payment Supported Capabilities');
8989
}
9090

91-
shipping_supported_contacts = configItem.shipping_supported_contacts;
92-
billing_supported_contacts = configItem.billing_supported_contacts;
93-
payment_supported_card_countries = configItem.payment_supported_card_countries;
91+
if (configItem.shipping_supported_contacts != null && configItem.shipping_supported_contacts.length > 0) {
92+
shipping_supported_contacts = configItem.shipping_supported_contacts;
93+
}
94+
if (configItem.billing_supported_contacts != null && configItem.billing_supported_contacts.length > 0) {
95+
billing_supported_contacts = configItem.billing_supported_contacts;
96+
}
97+
if (configItem.payment_supported_card_countries != null && configItem.payment_supported_card_countries.length > 0) {
98+
payment_supported_card_countries = configItem.payment_supported_card_countries;
99+
}
94100

95101
if (configItem.tokenization != null) {
96102
if (configItem.tokenization.gateway != null && configItem.tokenization.gateway !== "") {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.outsystems.payments",
3-
"version": "1.2.11",
3+
"version": "1.2.12",
44
"description": "OutSystems-owned plugin for mobile payments",
55
"keywords": [
66
"ecosystem:cordova",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<plugin id="com.outsystems.payments" version="1.2.11" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2+
<plugin id="com.outsystems.payments" version="1.2.12" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
33
<name>OSPayments</name>
44
<description>OutSystems-owned plugin for mobile payments</description>
55
<author>OutSystems Inc</author>

0 commit comments

Comments
 (0)