PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.6
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.6
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
← All changes | app/Modules/PaymentMethods/StripeGateway/StripeHelper.php +38 -0 1.3.21 → 1.6.6 View file →
@@ -127,8 +127,46 @@
127 127 return $subscriptionUpdateData;
128 128 }
129 129
130 130
131 + /**
132 + * Convert a Stripe wire amount (invoice/charge/payment_intent) to FluentCart's
133 + * internal ×100 unit. Zero-decimal currencies (JPY, KRW, ...) come off the wire
134 + * unscaled, so they need the ×100 that non-zero-decimal currencies already have.
135 + *
136 + * @param int|float $amount
137 + * @param string $currency
138 + * @return int
139 + */
140 + public static function toInternalAmount($amount, $currency)
141 + {
142 + $amount = (int)$amount;
143 +
144 + if ($currency && CurrenciesHelper::isZeroDecimal($currency)) {
145 + $amount *= 100;
146 + }
147 +
148 + return $amount;
149 + }
150 +
151 + /**
152 + * Convert a Stripe object's `livemode` flag to a getStripeObject()/getApiKey()
153 + * `$mode` argument. The store's global mode toggle ('current') is not a reliable
154 + * proxy for which key an already-fetched object needs — use its own livemode
155 + * whenever one is available instead of guessing from the store setting.
156 + *
157 + * @param bool|null $livemode Null when no prior object/event is available yet.
158 + * @return string 'live', 'test', or 'current'
159 + */
160 + public static function modeFromLivemode($livemode)
161 + {
162 + if (is_null($livemode)) {
163 + return 'current';
164 + }
165 +
166 + return $livemode ? 'live' : 'test';
167 + }
168 +
131 169 public static function processRemoteRefund($transaction, $amount, $args)
132 170 {
133 171 $intentId = $transaction->vendor_charge_id;
134 172 if (!$intentId) {