@jimrising/easymerchantsdk-react-native 2.7.5 → 2.7.7

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.
@@ -94,7 +94,7 @@ dependencies {
94
94
  implementation 'com.google.android.material:material:1.13.0'
95
95
 
96
96
  // Third-party libs
97
- implementation 'com.app:paysdk:1.9.7'
97
+ implementation 'com.app:paysdk:1.9.8'
98
98
  implementation 'com.hbb20:ccp:2.7.3'
99
99
  implementation 'com.github.bumptech.glide:glide:5.0.4'
100
100
  implementation 'com.github.androidmads:QRGenerator:1.0.5'
@@ -551,9 +551,20 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
551
551
  // let rawAmount = Double(self.request?.amount ?? 0)
552
552
  // let amountText = String(format: "$%.2f", rawAmount)
553
553
 
554
- // ✅ new way: use parsedAmount immediately
555
- let resolvedAmount = self.amount // already set above
556
- let amountText = String(format: "$%.2f", resolvedAmount ?? 00.00)
554
+ // ✅ Use decimal-safe amount from backend (avoids binary rounding drift)
555
+ let amountText: String = {
556
+ if let savedAmount = UserStoreSingleton.shared.amount,
557
+ let decimal = Decimal(string: savedAmount) {
558
+ var value = decimal
559
+ var rounded = Decimal()
560
+ NSDecimalRound(&rounded, &value, 2, .plain)
561
+ return "$" + NSDecimalNumber(decimal: rounded).stringValue
562
+ } else if let resolvedAmount = self.amount {
563
+ return String(format: "$%.2f", resolvedAmount)
564
+ } else {
565
+ return "$0.00"
566
+ }
567
+ }()
557
568
 
558
569
  var buttonText: String
559
570
  if !billingVisible && !additionalVisible {
@@ -573,8 +584,19 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
573
584
  self.btnPayNowSingleAccountView.setTitle(buttonText, for: .normal)
574
585
  } else {
575
586
  /// When no billingInfoData present
576
- let resolvedAmount = self.amount
577
- let amountText = String(format: "$%.2f", resolvedAmount ?? 00.00)
587
+ let amountText: String = {
588
+ if let savedAmount = UserStoreSingleton.shared.amount,
589
+ let decimal = Decimal(string: savedAmount) {
590
+ var value = decimal
591
+ var rounded = Decimal()
592
+ NSDecimalRound(&rounded, &value, 2, .plain)
593
+ return "$" + NSDecimalNumber(decimal: rounded).stringValue
594
+ } else if let resolvedAmount = self.amount {
595
+ return String(format: "$%.2f", resolvedAmount)
596
+ } else {
597
+ return "$0.00"
598
+ }
599
+ }()
578
600
 
579
601
  let submitText = self.request?.submitButtonText?.isEmpty == false ? self.request!.submitButtonText! : "Pay Now"
580
602
  let defaultTitle = "\(submitText) (\(amountText))"
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'easymerchantsdk'
3
- s.version = '2.7.5'
3
+ s.version = '2.7.7'
4
4
  s.summary = 'A React Native SDK for Easy Merchant.'
5
5
  s.description = <<-DESC
6
6
  A React Native SDK to enable Easy Merchant functionality in mobile applications.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimrising/easymerchantsdk-react-native",
3
- "version": "2.7.5",
3
+ "version": "2.7.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {