diff --git a/CHANGELOG.md b/CHANGELOG.md index d1a295dd..c54718b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Removed `withCarbonOffset` parameter from `create`, `buy`, and `regenerateRates` functions of the Shipment service as EasyPost now offers Carbon Neutral shipments by default for free - Fixes a bug where the original filtering criteria of `all` calls wasn't passed along to `getNextPage` calls. Now, these are persisted via a `_params` key on response objects locally - Removes the undocumented `createAndBuy` function from the `Batch` service. The proper usage is to create a batch first and buy it separately +- Renames `primaryOrSecondary` to `priority` to match the API name for the parameter ## v6.9.1 (2023-11-20) diff --git a/lib/EasyPost/Service/BetaReferralCustomerService.php b/lib/EasyPost/Service/BetaReferralCustomerService.php index 65b4eba7..1b48277f 100644 --- a/lib/EasyPost/Service/BetaReferralCustomerService.php +++ b/lib/EasyPost/Service/BetaReferralCustomerService.php @@ -20,16 +20,16 @@ class BetaReferralCustomerService extends BaseService * * @param string $stripeCustomerId * @param string $paymentMethodReference - * @param string $primaryOrSecondary + * @param string $priority * @return mixed */ - public function addPaymentMethod($stripeCustomerId, $paymentMethodReference, $primaryOrSecondary = 'primary') + public function addPaymentMethod($stripeCustomerId, $paymentMethodReference, $priority = 'primary') { $params = [ 'payment_method' => [ 'stripe_customer_id' => $stripeCustomerId, 'payment_method_reference' => $paymentMethodReference, - 'priority' => $primaryOrSecondary + 'priority' => $priority ] ]; diff --git a/lib/EasyPost/Service/BillingService.php b/lib/EasyPost/Service/BillingService.php index 9adfeaac..7db2980e 100644 --- a/lib/EasyPost/Service/BillingService.php +++ b/lib/EasyPost/Service/BillingService.php @@ -37,12 +37,12 @@ public function retrievePaymentMethods($params = null) * Fund your EasyPost wallet by charging your primary or secondary payment method. * * @param string $amount - * @param string $primaryOrSecondary + * @param string $priority * @return void */ - public function fundWallet($amount, $primaryOrSecondary = 'primary') + public function fundWallet($amount, $priority = 'primary') { - [$paymentMethodEndpoint, $paymentMethodId] = self::getPaymentInfo(strtolower($primaryOrSecondary)); + [$paymentMethodEndpoint, $paymentMethodId] = self::getPaymentInfo(strtolower($priority)); $url = $paymentMethodEndpoint . "/$paymentMethodId/charges"; $wrappedParams = ['amount' => $amount]; @@ -53,12 +53,12 @@ public function fundWallet($amount, $primaryOrSecondary = 'primary') /** * Delete a payment method. * - * @param string $primaryOrSecondary + * @param string $priority * @return void */ - public function deletePaymentMethod($primaryOrSecondary) + public function deletePaymentMethod($priority) { - [$paymentMethodEndpoint, $paymentMethodId] = self::getPaymentInfo(strtolower($primaryOrSecondary)); + [$paymentMethodEndpoint, $paymentMethodId] = self::getPaymentInfo(strtolower($priority)); $url = $paymentMethodEndpoint . "/$paymentMethodId"; Requestor::request($this->client, 'delete', $url); @@ -67,18 +67,18 @@ public function deletePaymentMethod($primaryOrSecondary) /** * Get payment info (type of the payment method and ID of the payment method) * - * @param string $primaryOrSecondary + * @param string $priority * @return array * @throws PaymentException */ - private function getPaymentInfo($primaryOrSecondary = 'primary') + private function getPaymentInfo($priority = 'primary') { $paymentMethods = self::retrievePaymentMethods(); $paymentMethodMap = [ 'primary' => 'primary_payment_method', 'secondary' => 'secondary_payment_method' ]; - $paymentMethodToUse = $paymentMethodMap[$primaryOrSecondary] ?? null; + $paymentMethodToUse = $paymentMethodMap[$priority] ?? null; if ($paymentMethodToUse != null && $paymentMethods->$paymentMethodToUse->id != null) { $paymentMethodId = $paymentMethods->$paymentMethodToUse->id; diff --git a/lib/EasyPost/Service/ReferralCustomerService.php b/lib/EasyPost/Service/ReferralCustomerService.php index 37207d2b..17d4d62c 100644 --- a/lib/EasyPost/Service/ReferralCustomerService.php +++ b/lib/EasyPost/Service/ReferralCustomerService.php @@ -86,7 +86,7 @@ public function updateEmail($email, $userId) * @param int $expirationMonth * @param int $expirationYear * @param string $cvc - * @param string $primaryOrSecondary + * @param string $priority * @return mixed * @throws ExternalApiException */ @@ -96,7 +96,7 @@ public function addCreditCard( $expirationMonth, $expirationYear, $cvc, - $primaryOrSecondary = 'primary' + $priority = 'primary' ) { $easypostStripeApiKey = self::retrieveEasypostStripeApiKey(); @@ -114,7 +114,7 @@ public function addCreditCard( $stripeToken = $stripeToken['id'] ?? ''; - $response = self::createEasypostCreditCard($referralApiKey, $stripeToken, $primaryOrSecondary); + $response = self::createEasypostCreditCard($referralApiKey, $stripeToken, $priority); return InternalUtil::convertToEasyPostObject($this->client, $response); }