paynl-pos-sdk-react-native 0.0.63 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,mm,swift}"
18
18
  s.private_header_files = "ios/**/*.h"
19
19
 
20
- s.dependency 'PayNlPOSSdkSwift', '~> 0.0.29'
20
+ s.dependency 'PayNlPOSSdkSwift', '~> 0.0.31'
21
21
 
22
22
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23
23
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
package/ios/PaynlSdk.mm CHANGED
@@ -12,93 +12,93 @@ RCT_EXPORT_MODULE(PaynlSdk)
12
12
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
13
13
  (const facebook::react::ObjCTurboModule::InitParams &)params
14
14
  {
15
- return std::make_shared<facebook::react::NativePayNlSdkSpecJSI>(params);
15
+ return std::make_shared<facebook::react::NativePayNlSdkSpecJSI>(params);
16
16
  }
17
17
 
18
18
  - (void)initSdk:(JS::NativePayNlSdk::NativeInitModel &)params resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
19
- if (@available(iOS 17, *)) {
20
- [[PayNlPosService instance] initSdkWithIntegrationId:params.integrationId() core:params.payNlCore() resolve:resolve rejecter:reject];
21
- } else {
22
- reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
23
- }
19
+ if (@available(iOS 17, *)) {
20
+ [[PayNlPosService instance] initSdkWithIntegrationId:params.integrationId() core:params.payNlCore() resolve:resolve rejecter:reject];
21
+ } else {
22
+ reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
23
+ }
24
24
  }
25
25
 
26
26
  - (void)getActivationCode:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
27
- if (@available(iOS 17, *)) {
28
- [[PayNlPosService instance] getActivationCodeWithResolve:resolve rejecter:reject];
29
- } else {
30
- reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
31
- }
27
+ if (@available(iOS 17, *)) {
28
+ [[PayNlPosService instance] getActivationCodeWithResolve:resolve rejecter:reject];
29
+ } else {
30
+ reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
31
+ }
32
32
  }
33
33
 
34
34
  - (void)loginViaCode:(nonnull NSString *)code resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
35
- if (@available(iOS 17, *)) {
36
- [[PayNlPosService instance] loginViaCodeWithPin:code resolve:resolve rejecter:reject];
37
- } else {
38
- reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
39
- }
35
+ if (@available(iOS 17, *)) {
36
+ [[PayNlPosService instance] loginViaCodeWithPin:code resolve:resolve rejecter:reject];
37
+ } else {
38
+ reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
39
+ }
40
40
  }
41
41
 
42
42
  - (void)loginViaCredentials:(nonnull NSString *)aCode serviceCode:(nonnull NSString *)serviceCode serviceSecret:(nonnull NSString *)serviceSecret resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
43
- if (@available(iOS 17, *)) {
44
- [[PayNlPosService instance] loginViaCredentialsWithACode:aCode serviceCode:serviceCode serviceSecret:serviceSecret resolve:resolve rejecter:reject];
45
- } else {
46
- reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
47
- }
43
+ if (@available(iOS 17, *)) {
44
+ [[PayNlPosService instance] loginViaCredentialsWithACode:aCode serviceCode:serviceCode serviceSecret:serviceSecret resolve:resolve rejecter:reject];
45
+ } else {
46
+ reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
47
+ }
48
48
  }
49
49
 
50
50
  - (void)startTransaction:(JS::NativePayNlSdk::SpecStartTransactionParams &)params resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
51
- if (@available(iOS 17, *)) {
52
- NSDictionary *transactionModel = [self mapTransaction:params.transaction()];
53
- NSDictionary *serviceData = params.forService().has_value() ? @{
54
- @"serviceId": params.forService().value().serviceId(),
55
- @"secret": params.forService().value().secret()
56
- } : nil;
57
-
58
- [[PayNlPosService instance] startPaymentWithTransactionJson:transactionModel serviceJson:serviceData resolve:resolve rejecter:reject];
59
- } else {
60
- reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
61
- }
51
+ if (@available(iOS 17, *)) {
52
+ NSDictionary *transactionModel = [self mapTransaction:params.transaction()];
53
+ NSDictionary *serviceData = params.forService().has_value() ? @{
54
+ @"serviceId": params.forService().value().serviceId(),
55
+ @"secret": params.forService().value().secret()
56
+ } : nil;
57
+
58
+ [[PayNlPosService instance] startPaymentWithTransactionJson:transactionModel serviceJson:serviceData resolve:resolve rejecter:reject];
59
+ } else {
60
+ reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
61
+ }
62
62
  }
63
63
 
64
64
  - (NSArray<NSDictionary *> * _Nullable)getAllowedCurrencies {
65
- if (@available(iOS 17, *)) {
66
- return [[PayNlPosService instance] getAllowedCurrencies];
67
- } else {
68
- return nil;
69
- }
65
+ if (@available(iOS 17, *)) {
66
+ return [[PayNlPosService instance] getAllowedCurrencies];
67
+ } else {
68
+ return nil;
69
+ }
70
70
  }
71
71
 
72
72
 
73
73
  - (NSDictionary * _Nullable)getTerminalInfo {
74
- if (@available(iOS 17, *)) {
75
- return [[PayNlPosService instance] getTerminalInfo];
76
- } else {
77
- return nil;
78
- }
74
+ if (@available(iOS 17, *)) {
75
+ return [[PayNlPosService instance] getTerminalInfo];
76
+ } else {
77
+ return nil;
78
+ }
79
79
  }
80
80
 
81
81
  - (void) sendTicketViaEmail:(nonnull NSString *) email transactionId:(nonnull NSString *) transactionId ticket:(nonnull NSString *) ticket resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
82
- if (@available(iOS 17, *)) {
83
- [[PayNlPosService instance] sendTicketWithEmail:email transactionId:transactionId ticket:ticket resolve:resolve rejecter:reject];
84
- } else {
85
- return;
86
- }
82
+ if (@available(iOS 17, *)) {
83
+ [[PayNlPosService instance] sendTicketWithEmail:email transactionId:transactionId ticket:ticket resolve:resolve rejecter:reject];
84
+ } else {
85
+ return;
86
+ }
87
87
  }
88
88
 
89
89
 
90
90
  - (void)logout {
91
- if (@available(iOS 17, *)) {
92
- [[PayNlPosService instance] logout];
93
- }
91
+ if (@available(iOS 17, *)) {
92
+ [[PayNlPosService instance] logout];
93
+ }
94
94
  }
95
95
 
96
96
  - (void)sendLogs:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
97
- if (@available(iOS 17, *)) {
98
- [[PayNlPosService instance] sendLogsWithResolve:resolve rejecter:reject];
99
- } else {
100
- reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
101
- }
97
+ if (@available(iOS 17, *)) {
98
+ [[PayNlPosService instance] sendLogsWithResolve:resolve rejecter:reject];
99
+ } else {
100
+ reject(@"UNSUPPORTED", @"iOS 18 is required for the PayNL SDK", nil);
101
+ }
102
102
  }
103
103
 
104
104
  - (nonnull NSNumber *)clearOfflineItem:(nonnull NSString *)id {
@@ -138,164 +138,165 @@ RCT_EXPORT_MODULE(PaynlSdk)
138
138
 
139
139
  - (void)setConfiguration:(JS::NativePayNlSdk::NativeInitModel &)params {
140
140
  if (@available(iOS 17, *)) {
141
- [[PayNlPosService instance] setConfigurationWithIntegrationId:params.integrationId() core:params.payNlCore()];
141
+ [[PayNlPosService instance] setConfigurationWithIntegrationId:params.integrationId() core:params.payNlCore()];
142
142
  }
143
143
 
144
144
  }
145
145
 
146
146
  - (NSDictionary *)mapTransaction:(const JS::NativePayNlSdk::Transaction &)transaction {
147
- NSMutableDictionary *transactionModel = [@{
148
- @"amount": @{
149
- @"value": @(transaction.amount().value()),
150
- @"currency": transaction.amount().currency()
151
- },
152
- @"serviceId": transaction.serviceId() != nil ? transaction.serviceId() : [NSNull null],
153
- @"description": transaction.description() != nil ? transaction.description() : [NSNull null],
154
- @"reference": transaction.reference() != nil ? transaction.reference() : [NSNull null],
155
- @"exchangeUrl": transaction.exchangeUrl() != nil ? transaction.exchangeUrl() : [NSNull null],
156
- @"tguReference": transaction.tguReference() != nil ? transaction.tguReference() : [NSNull null],
157
- @"ecrInitiated": transaction.ecrInitiated().has_value() ? @(transaction.ecrInitiated().value()) : [NSNull null]
147
+ NSMutableDictionary *transactionModel = [@{
148
+ @"amount": @{
149
+ @"value": @(transaction.amount().value()),
150
+ @"currency": transaction.amount().currency()
151
+ },
152
+ @"serviceId": transaction.serviceId() != nil ? transaction.serviceId() : [NSNull null],
153
+ @"description": transaction.description() != nil ? transaction.description() : [NSNull null],
154
+ @"reference": transaction.reference() != nil ? transaction.reference() : [NSNull null],
155
+ @"exchangeUrl": transaction.exchangeUrl() != nil ? transaction.exchangeUrl() : [NSNull null],
156
+ @"tguReference": transaction.tguReference() != nil ? transaction.tguReference() : [NSNull null],
157
+ @"ecrInitiated": transaction.ecrInitiated().has_value() ? @(transaction.ecrInitiated().value()) : [NSNull null],
158
+ @"type": transaction.type() != nil ? transaction.type() : @"PAYMENT"
159
+ } mutableCopy];
160
+
161
+ if (transaction.paymentMethod().has_value()) {
162
+ JS::NativePayNlSdk::PaymentMethod paymentMethod = transaction.paymentMethod().value();
163
+
164
+ transactionModel[@"paymentMethod"] = @{
165
+ @"id": transaction.paymentMethod().value().id_() != nil ? transaction.paymentMethod().value().id_() : [NSNull null],
166
+ @"subId": transaction.paymentMethod().value().subId() != nil ? transaction.paymentMethod().value().subId() : [NSNull null],
167
+ };
168
+ }
169
+
170
+ if (transaction.customer().has_value()) {
171
+ JS::NativePayNlSdk::Customer customer = transaction.customer().value();
172
+
173
+ transactionModel[@"customer"] = [@{
174
+ @"firstName": customer.firstName() != nil ? customer.firstName() : [NSNull null],
175
+ @"lastName": customer.lastName() != nil ? customer.lastName() : [NSNull null],
176
+ @"phone": customer.phone() != nil ? customer.phone() : [NSNull null],
177
+ @"birthDate": customer.birthDate() != nil ? customer.birthDate() : [NSNull null],
178
+ @"gender": customer.gender() != nil ? customer.gender() : [NSNull null],
179
+ @"email": customer.email() != nil ? customer.email() : [NSNull null],
180
+ @"ipAddress": customer.ipAddress() != nil ? customer.ipAddress() : [NSNull null],
181
+ @"reference": customer.reference() != nil ? customer.reference() : [NSNull null],
182
+ @"trust": customer.trust().has_value() ? @(customer.trust().value()) : [NSNull null],
158
183
  } mutableCopy];
159
184
 
160
- if (transaction.paymentMethod().has_value()) {
161
- JS::NativePayNlSdk::PaymentMethod paymentMethod = transaction.paymentMethod().value();
185
+ if (customer.company().has_value()) {
186
+ JS::NativePayNlSdk::Company company = customer.company().value();
162
187
 
163
- transactionModel[@"paymentMethod"] = @{
164
- @"id": transaction.paymentMethod().value().id_() != nil ? transaction.paymentMethod().value().id_() : [NSNull null],
165
- @"subId": transaction.paymentMethod().value().subId() != nil ? transaction.paymentMethod().value().subId() : [NSNull null],
166
- };
188
+ transactionModel[@"customer"][@"company"] = @{
189
+ @"countryCode": company.countryCode() != nil ? company.countryCode() : [NSNull null],
190
+ @"coc": company.coc() != nil ? company.coc() : [NSNull null],
191
+ @"vat": company.vat() != nil ? company.vat() : [NSNull null],
192
+ @"name": company.name() != nil ? company.name() : [NSNull null],
193
+ };
167
194
  }
195
+ }
168
196
 
169
- if (transaction.customer().has_value()) {
170
- JS::NativePayNlSdk::Customer customer = transaction.customer().value();
171
-
172
- transactionModel[@"customer"] = [@{
173
- @"firstName": customer.firstName() != nil ? customer.firstName() : [NSNull null],
174
- @"lastName": customer.lastName() != nil ? customer.lastName() : [NSNull null],
175
- @"phone": customer.phone() != nil ? customer.phone() : [NSNull null],
176
- @"birthDate": customer.birthDate() != nil ? customer.birthDate() : [NSNull null],
177
- @"gender": customer.gender() != nil ? customer.gender() : [NSNull null],
178
- @"email": customer.email() != nil ? customer.email() : [NSNull null],
179
- @"ipAddress": customer.ipAddress() != nil ? customer.ipAddress() : [NSNull null],
180
- @"reference": customer.reference() != nil ? customer.reference() : [NSNull null],
181
- @"trust": customer.trust().has_value() ? @(customer.trust().value()) : [NSNull null],
182
- } mutableCopy];
197
+ if (transaction.order().has_value()) {
198
+ JS::NativePayNlSdk::Order order = transaction.order().value();
199
+ transactionModel[@"order"] = [@{
200
+ @"countryCode": order.countryCode() != nil ? order.countryCode() : [NSNull null],
201
+ @"deliveryDate": order.deliveryDate() != nil ? order.deliveryDate() : [NSNull null],
202
+ @"invoiceDate": order.invoiceDate() != nil ? order.invoiceDate() : [NSNull null]
203
+ } mutableCopy];
183
204
 
184
- if (customer.company().has_value()) {
185
- JS::NativePayNlSdk::Company company = customer.company().value();
205
+ if (order.deliveryAddress().has_value()) {
206
+ JS::NativePayNlSdk::DeliveryData deliveryAddress = order.deliveryAddress().value();
207
+ transactionModel[@"order"][@"deliveryAddress"] = @{
208
+ @"firstName": deliveryAddress.firstName() != nil ? deliveryAddress.firstName() : [NSNull null],
209
+ @"lastName": deliveryAddress.lastName() != nil ? deliveryAddress.lastName() : [NSNull null],
210
+ @"streetName": deliveryAddress.streetName() != nil ? deliveryAddress.streetName() : [NSNull null],
211
+ @"streetNumber": deliveryAddress.streetNumber() != nil ? deliveryAddress.streetNumber() : [NSNull null],
212
+ @"streetNumberExtension": deliveryAddress.streetNumberExtension() != nil ? deliveryAddress.streetNumberExtension() : [NSNull null],
213
+ @"zipCode": deliveryAddress.zipCode() != nil ? deliveryAddress.zipCode() : [NSNull null],
214
+ @"city": deliveryAddress.city() != nil ? deliveryAddress.city() : [NSNull null],
215
+ @"countryCode": deliveryAddress.countryCode() != nil ? deliveryAddress.countryCode() : [NSNull null],
216
+ };
217
+ }
186
218
 
187
- transactionModel[@"customer"][@"company"] = @{
188
- @"countryCode": company.countryCode() != nil ? company.countryCode() : [NSNull null],
189
- @"coc": company.coc() != nil ? company.coc() : [NSNull null],
190
- @"vat": company.vat() != nil ? company.vat() : [NSNull null],
191
- @"name": company.name() != nil ? company.name() : [NSNull null],
192
- };
193
- }
219
+ if (order.invoiceAddress().has_value()) {
220
+ JS::NativePayNlSdk::Address invoiceAddress = order.invoiceAddress().value();
221
+ transactionModel[@"order"][@"invoiceAddress"] = @{
222
+ @"firstName": invoiceAddress.firstName() != nil ? invoiceAddress.firstName() : [NSNull null],
223
+ @"lastName": invoiceAddress.lastName() != nil ? invoiceAddress.lastName() : [NSNull null],
224
+ @"streetName": invoiceAddress.streetName() != nil ? invoiceAddress.streetName() : [NSNull null],
225
+ @"streetNumber": invoiceAddress.streetNumber() != nil ? invoiceAddress.streetNumber() : [NSNull null],
226
+ @"streetNumberExtension": invoiceAddress.streetNumberExtension() != nil ? invoiceAddress.streetNumberExtension() : [NSNull null],
227
+ @"zipCode": invoiceAddress.zipCode() != nil ? invoiceAddress.zipCode() : [NSNull null],
228
+ @"city": invoiceAddress.city() != nil ? invoiceAddress.city() : [NSNull null],
229
+ @"countryCode": invoiceAddress.countryCode() != nil ? invoiceAddress.countryCode() : [NSNull null],
230
+ };
194
231
  }
195
232
 
196
- if (transaction.order().has_value()) {
197
- JS::NativePayNlSdk::Order order = transaction.order().value();
198
- transactionModel[@"order"] = [@{
199
- @"countryCode": order.countryCode() != nil ? order.countryCode() : [NSNull null],
200
- @"deliveryDate": order.deliveryDate() != nil ? order.deliveryDate() : [NSNull null],
201
- @"invoiceDate": order.invoiceDate() != nil ? order.invoiceDate() : [NSNull null]
202
- } mutableCopy];
233
+ if (order.products().has_value() && order.products().value().size() > 0) {
234
+ NSMutableArray *products = [@[] mutableCopy];
203
235
 
204
- if (order.deliveryAddress().has_value()) {
205
- JS::NativePayNlSdk::DeliveryData deliveryAddress = order.deliveryAddress().value();
206
- transactionModel[@"order"][@"deliveryAddress"] = @{
207
- @"firstName": deliveryAddress.firstName() != nil ? deliveryAddress.firstName() : [NSNull null],
208
- @"lastName": deliveryAddress.lastName() != nil ? deliveryAddress.lastName() : [NSNull null],
209
- @"streetName": deliveryAddress.streetName() != nil ? deliveryAddress.streetName() : [NSNull null],
210
- @"streetNumber": deliveryAddress.streetNumber() != nil ? deliveryAddress.streetNumber() : [NSNull null],
211
- @"streetNumberExtension": deliveryAddress.streetNumberExtension() != nil ? deliveryAddress.streetNumberExtension() : [NSNull null],
212
- @"zipCode": deliveryAddress.zipCode() != nil ? deliveryAddress.zipCode() : [NSNull null],
213
- @"city": deliveryAddress.city() != nil ? deliveryAddress.city() : [NSNull null],
214
- @"countryCode": deliveryAddress.countryCode() != nil ? deliveryAddress.countryCode() : [NSNull null],
215
- };
216
- }
236
+ facebook::react::LazyVector<JS::NativePayNlSdk::Product> productsList = order.products().value();
237
+ for (facebook::react::LazyVector<JS::NativePayNlSdk::Product>::iterator it = productsList.begin(); it != productsList.end(); ++it) {
238
+ JS::NativePayNlSdk::Product product = *it;
217
239
 
218
- if (order.invoiceAddress().has_value()) {
219
- JS::NativePayNlSdk::Address invoiceAddress = order.invoiceAddress().value();
220
- transactionModel[@"order"][@"invoiceAddress"] = @{
221
- @"firstName": invoiceAddress.firstName() != nil ? invoiceAddress.firstName() : [NSNull null],
222
- @"lastName": invoiceAddress.lastName() != nil ? invoiceAddress.lastName() : [NSNull null],
223
- @"streetName": invoiceAddress.streetName() != nil ? invoiceAddress.streetName() : [NSNull null],
224
- @"streetNumber": invoiceAddress.streetNumber() != nil ? invoiceAddress.streetNumber() : [NSNull null],
225
- @"streetNumberExtension": invoiceAddress.streetNumberExtension() != nil ? invoiceAddress.streetNumberExtension() : [NSNull null],
226
- @"zipCode": invoiceAddress.zipCode() != nil ? invoiceAddress.zipCode() : [NSNull null],
227
- @"city": invoiceAddress.city() != nil ? invoiceAddress.city() : [NSNull null],
228
- @"countryCode": invoiceAddress.countryCode() != nil ? invoiceAddress.countryCode() : [NSNull null],
229
- };
230
- }
240
+ NSMutableDictionary *dict = [@{
241
+ @"id": product.id_() != nil ? product.id_() : [NSNull null],
242
+ @"description": product.description()!= nil ? product.description() : [NSNull null],
243
+ @"type": product.type()!= nil ? product.type() : [NSNull null],
244
+ @"vatCode": product.vatCode() != nil ? product.vatCode() : [NSNull null],
245
+ @"quantity": product.quantity().has_value() ? @(product.quantity().value()) : [NSNull null],
246
+ } mutableCopy];
231
247
 
232
- if (order.products().has_value() && order.products().value().size() > 0) {
233
- NSMutableArray *products = [@[] mutableCopy];
234
-
235
- facebook::react::LazyVector<JS::NativePayNlSdk::Product> productsList = order.products().value();
236
- for (facebook::react::LazyVector<JS::NativePayNlSdk::Product>::iterator it = productsList.begin(); it != productsList.end(); ++it) {
237
- JS::NativePayNlSdk::Product product = *it;
238
-
239
- NSMutableDictionary *dict = [@{
240
- @"id": product.id_() != nil ? product.id_() : [NSNull null],
241
- @"description": product.description()!= nil ? product.description() : [NSNull null],
242
- @"type": product.type()!= nil ? product.type() : [NSNull null],
243
- @"vatCode": product.vatCode() != nil ? product.vatCode() : [NSNull null],
244
- @"quantity": product.quantity().has_value() ? @(product.quantity().value()) : [NSNull null],
245
- } mutableCopy];
246
-
247
- if (product.price().has_value()) {
248
- JS::NativePayNlSdk::ProductAmount price = product.price().value();
249
- dict[@"price"] = @{
250
- @"value": price.value().has_value() ? @(price.value().value()) : [NSNull null],
251
- @"currency": price.currency() != nil ? price.currency() : [NSNull null]
252
- };
253
- }
254
-
255
- [products addObject:dict];
256
- }
257
-
258
- transactionModel[@"order"][@"products"] = products;
248
+ if (product.price().has_value()) {
249
+ JS::NativePayNlSdk::ProductAmount price = product.price().value();
250
+ dict[@"price"] = @{
251
+ @"value": price.value().has_value() ? @(price.value().value()) : [NSNull null],
252
+ @"currency": price.currency() != nil ? price.currency() : [NSNull null]
253
+ };
259
254
  }
260
- }
261
255
 
262
- if (transaction.notification().has_value()) {
263
- JS::NativePayNlSdk::Notification notification = transaction.notification().value();
256
+ [products addObject:dict];
257
+ }
264
258
 
265
- transactionModel[@"notification"] = @{
266
- @"type": notification.type() != nil ? notification.type() : [NSNull null],
267
- @"recipient": notification.recipient() != nil ? notification.recipient() : [NSNull null],
268
- };
259
+ transactionModel[@"order"][@"products"] = products;
269
260
  }
261
+ }
270
262
 
271
- if (transaction.stats().has_value()) {
272
- JS::NativePayNlSdk::Stats stats = transaction.stats().value();
263
+ if (transaction.notification().has_value()) {
264
+ JS::NativePayNlSdk::Notification notification = transaction.notification().value();
273
265
 
274
- transactionModel[@"stats"] = @{
275
- @"info": stats.info() != nil ? stats.info() : [NSNull null],
276
- @"tool": stats.tool() != nil ? stats.tool() : [NSNull null],
277
- @"extra1": stats.extra1() != nil ? stats.extra1() : [NSNull null],
278
- @"extra2": stats.extra2() != nil ? stats.extra2() : [NSNull null],
279
- @"extra3": stats.extra3() != nil ? stats.extra3() : [NSNull null],
280
- };
281
- }
266
+ transactionModel[@"notification"] = @{
267
+ @"type": notification.type() != nil ? notification.type() : [NSNull null],
268
+ @"recipient": notification.recipient() != nil ? notification.recipient() : [NSNull null],
269
+ };
270
+ }
282
271
 
283
- if (transaction.transferData().has_value() && transaction.transferData().value().size() > 0) {
284
- NSMutableArray *transfers = [@[] mutableCopy];
272
+ if (transaction.stats().has_value()) {
273
+ JS::NativePayNlSdk::Stats stats = transaction.stats().value();
285
274
 
286
- facebook::react::LazyVector<JS::NativePayNlSdk::TransferData> transferList = transaction.transferData().value();
287
- for (facebook::react::LazyVector<JS::NativePayNlSdk::TransferData>::iterator it = transferList.begin(); it != transferList.end(); ++it) {
288
- JS::NativePayNlSdk::TransferData transfer = *it;
289
- [transfers addObject:@{
290
- @"name": transfer.name() != nil ? transfer.name() : [NSNull null],
291
- @"value": transfer.value() ? transfer.value() : [NSNull null],
292
- }];
293
- }
275
+ transactionModel[@"stats"] = @{
276
+ @"info": stats.info() != nil ? stats.info() : [NSNull null],
277
+ @"tool": stats.tool() != nil ? stats.tool() : [NSNull null],
278
+ @"extra1": stats.extra1() != nil ? stats.extra1() : [NSNull null],
279
+ @"extra2": stats.extra2() != nil ? stats.extra2() : [NSNull null],
280
+ @"extra3": stats.extra3() != nil ? stats.extra3() : [NSNull null],
281
+ };
282
+ }
294
283
 
295
- transactionModel[@"transferData"] = transfers;
284
+ if (transaction.transferData().has_value() && transaction.transferData().value().size() > 0) {
285
+ NSMutableArray *transfers = [@[] mutableCopy];
286
+
287
+ facebook::react::LazyVector<JS::NativePayNlSdk::TransferData> transferList = transaction.transferData().value();
288
+ for (facebook::react::LazyVector<JS::NativePayNlSdk::TransferData>::iterator it = transferList.begin(); it != transferList.end(); ++it) {
289
+ JS::NativePayNlSdk::TransferData transfer = *it;
290
+ [transfers addObject:@{
291
+ @"name": transfer.name() != nil ? transfer.name() : [NSNull null],
292
+ @"value": transfer.value() ? transfer.value() : [NSNull null],
293
+ }];
296
294
  }
297
295
 
298
- return transactionModel;
296
+ transactionModel[@"transferData"] = transfers;
297
+ }
298
+
299
+ return transactionModel;
299
300
  }
300
301
 
301
302
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paynl-pos-sdk-react-native",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "description": "A PayNL sdk to accept and process payments",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",