@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up(): void |
| 15 | 15 | { |
| 16 | - Schema::create('user_gateway_profiles', function (Blueprint $table) { |
|
| 16 | + Schema::create('user_gateway_profiles', function(Blueprint $table) { |
|
| 17 | 17 | $table->id(); |
| 18 | 18 | $table->foreignId('user_id')->constrained()->onDelete('cascade'); |
| 19 | 19 | $table->string('profile_id'); |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up(): void |
| 15 | 15 | { |
| 16 | - Schema::create('user_payment_profiles', function (Blueprint $table) { |
|
| 16 | + Schema::create('user_payment_profiles', function(Blueprint $table) { |
|
| 17 | 17 | $table->id(); |
| 18 | 18 | $table->foreignId('user_id')->constrained()->onDelete('cascade'); |
| 19 | 19 | $table->string('payment_profile_id'); |
| 20 | 20 | $table->string('last_4', 4); |
| 21 | - $table->enum('type', ['bank', 'card']); |
|
| 21 | + $table->enum('type', [ 'bank', 'card' ]); |
|
| 22 | 22 | $table->string('brand'); |
| 23 | 23 | $table->timestamps(); |
| 24 | 24 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function register(): void |
| 15 | 15 | { |
| 16 | - $configPath = __DIR__.'/../../config/authorizenet.php'; |
|
| 16 | + $configPath = __DIR__ . '/../../config/authorizenet.php'; |
|
| 17 | 17 | |
| 18 | 18 | if (file_exists($configPath)) { |
| 19 | 19 | $this->mergeConfigFrom($configPath, 'authorizenet'); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | protected function loadMigrations(): void |
| 40 | 40 | { |
| 41 | 41 | if ($this->app->runningInConsole()) { |
| 42 | - $migrationsPath = __DIR__.'/../../database/migrations'; |
|
| 42 | + $migrationsPath = __DIR__ . '/../../database/migrations'; |
|
| 43 | 43 | |
| 44 | 44 | if (is_dir($migrationsPath)) { |
| 45 | 45 | $this->loadMigrationsFrom($migrationsPath); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | protected function publishConfig(): void |
| 56 | 56 | { |
| 57 | 57 | if ($this->app->runningInConsole()) { |
| 58 | - $configPath = __DIR__.'/../../config/authorizenet.php'; |
|
| 58 | + $configPath = __DIR__ . '/../../config/authorizenet.php'; |
|
| 59 | 59 | |
| 60 | 60 | if (file_exists($configPath)) { |
| 61 | 61 | $this->publishes([ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return false; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $responseText = $messages[0]->getDescription() ?? ''; |
|
| 70 | + $responseText = $messages[ 0 ]->getDescription() ?? ''; |
|
| 71 | 71 | |
| 72 | 72 | return $responseText === 'This transaction has been approved.'; |
| 73 | 73 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $messages = $response->getMessages(); |
| 129 | 129 | if ($messages !== null && $messages->getMessage() !== null && count($messages->getMessage()) > 0) { |
| 130 | - $msg = $messages->getMessage()[0]; |
|
| 130 | + $msg = $messages->getMessage()[ 0 ]; |
|
| 131 | 131 | throw new Exception('Code: ' . $msg->getCode() . '. Message: ' . $msg->getText()); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -14,40 +14,40 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | // Subscription Type Info |
| 16 | 16 | $subscription = new AnetAPI\ARBSubscriptionType(); |
| 17 | - $subscription->setName($data['name']); |
|
| 17 | + $subscription->setName($data[ 'name' ]); |
|
| 18 | 18 | |
| 19 | 19 | $interval = new AnetAPI\PaymentScheduleType\IntervalAType(); |
| 20 | - $interval->setLength($data['intervalLength']); |
|
| 21 | - $interval->setUnit($data['intervalLengthUnit'] ?? 'days'); |
|
| 20 | + $interval->setLength($data[ 'intervalLength' ]); |
|
| 21 | + $interval->setUnit($data[ 'intervalLengthUnit' ] ?? 'days'); |
|
| 22 | 22 | |
| 23 | 23 | $paymentSchedule = new AnetAPI\PaymentScheduleType(); |
| 24 | 24 | $paymentSchedule->setInterval($interval); |
| 25 | - $paymentSchedule->setStartDate(new DateTime($data['startDate'])); |
|
| 26 | - $paymentSchedule->setTotalOccurrences($data['totalOccurrences']); |
|
| 27 | - $paymentSchedule->setTrialOccurrences($data['trialOccurrences']); |
|
| 25 | + $paymentSchedule->setStartDate(new DateTime($data[ 'startDate' ])); |
|
| 26 | + $paymentSchedule->setTotalOccurrences($data[ 'totalOccurrences' ]); |
|
| 27 | + $paymentSchedule->setTrialOccurrences($data[ 'trialOccurrences' ]); |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | $creditCard = new AnetAPI\CreditCardType(); |
| 31 | - $creditCard->setCardNumber($data['cardNumber']); |
|
| 32 | - $creditCard->setExpirationDate($data['cardExpiry']); |
|
| 31 | + $creditCard->setCardNumber($data[ 'cardNumber' ]); |
|
| 32 | + $creditCard->setExpirationDate($data[ 'cardExpiry' ]); |
|
| 33 | 33 | |
| 34 | 34 | $payment = new AnetAPI\PaymentType(); |
| 35 | 35 | $payment->setCreditCard($creditCard); |
| 36 | 36 | |
| 37 | 37 | $subscription->setPaymentSchedule($paymentSchedule); |
| 38 | - $subscription->setAmount($data['amountInDollars']); |
|
| 39 | - $subscription->setTrialAmount($data['trialAmountInDollars']); |
|
| 38 | + $subscription->setAmount($data[ 'amountInDollars' ]); |
|
| 39 | + $subscription->setTrialAmount($data[ 'trialAmountInDollars' ]); |
|
| 40 | 40 | |
| 41 | 41 | $subscription->setPayment($payment); |
| 42 | 42 | |
| 43 | 43 | $order = new AnetAPI\OrderType(); |
| 44 | - $order->setInvoiceNumber($data['invoiceNumber']); |
|
| 45 | - $order->setDescription($data['subscriptionDescription']); |
|
| 44 | + $order->setInvoiceNumber($data[ 'invoiceNumber' ]); |
|
| 45 | + $order->setDescription($data[ 'subscriptionDescription' ]); |
|
| 46 | 46 | $subscription->setOrder($order); |
| 47 | 47 | |
| 48 | 48 | $billTo = new AnetAPI\NameAndAddressType(); |
| 49 | - $billTo->setFirstName($data['customerFirstName']); |
|
| 50 | - $billTo->setLastName($data['customerLastName']); |
|
| 49 | + $billTo->setFirstName($data[ 'customerFirstName' ]); |
|
| 50 | + $billTo->setLastName($data[ 'customerLastName' ]); |
|
| 51 | 51 | |
| 52 | 52 | $subscription->setBillTo($billTo); |
| 53 | 53 | |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | return $this->execute($controller); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function getList(array $options = []) |
|
| 62 | + public function getList(array $options = [ ]) |
|
| 63 | 63 | { |
| 64 | 64 | $sorting = new AnetAPI\ARBGetSubscriptionListSortingType(); |
| 65 | - $sorting->setOrderBy($options['orderBy'] ?? 'id'); |
|
| 66 | - $sorting->setOrderDescending($options['orderDescending'] ?? false); |
|
| 65 | + $sorting->setOrderBy($options[ 'orderBy' ] ?? 'id'); |
|
| 66 | + $sorting->setOrderDescending($options[ 'orderDescending' ] ?? false); |
|
| 67 | 67 | |
| 68 | 68 | $paging = new AnetAPI\PagingType(); |
| 69 | - $paging->setLimit($options['limit'] ?? 1000); |
|
| 70 | - $paging->setOffset($options['offset'] ?? 1); |
|
| 69 | + $paging->setLimit($options[ 'limit' ] ?? 1000); |
|
| 70 | + $paging->setOffset($options[ 'offset' ] ?? 1); |
|
| 71 | 71 | |
| 72 | 72 | $request = new AnetAPI\ARBGetSubscriptionListRequest(); |
| 73 | 73 | $request->setMerchantAuthentication($this->getMerchantAuthentication()); |
| 74 | 74 | $request->setRefId($this->getRefId()); |
| 75 | - $request->setSearchType($options['searchType'] ?? "subscriptionActive"); |
|
| 75 | + $request->setSearchType($options[ 'searchType' ] ?? "subscriptionActive"); |
|
| 76 | 76 | |
| 77 | 77 | $request->setSorting($sorting); |
| 78 | 78 | $request->setPaging($paging); |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | $subscription = new AnetAPI\ARBSubscriptionType(); |
| 115 | 115 | |
| 116 | 116 | $creditCard = new AnetAPI\CreditCardType(); |
| 117 | - $creditCard->setCardNumber($data['cardNumber']); |
|
| 118 | - $creditCard->setExpirationDate($data['cardExpiry']); |
|
| 117 | + $creditCard->setCardNumber($data[ 'cardNumber' ]); |
|
| 118 | + $creditCard->setExpirationDate($data[ 'cardExpiry' ]); |
|
| 119 | 119 | |
| 120 | 120 | $payment = new AnetAPI\PaymentType(); |
| 121 | 121 | $payment->setCreditCard($creditCard); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $paymentProfile->setPaymentProfileId($paymentProfileId); |
| 25 | 25 | |
| 26 | 26 | $transactionRequestType = new AnetAPI\TransactionRequestType(); |
| 27 | - $transactionRequestType->setTransactionType( "refundTransaction"); |
|
| 27 | + $transactionRequestType->setTransactionType("refundTransaction"); |
|
| 28 | 28 | |
| 29 | 29 | $transactionRequestType->setAmount($amount); |
| 30 | 30 | $transactionRequestType->setProfile($customerProfile); |
@@ -24,62 +24,62 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function setNumbers(int $cardNumbers): CardInterface |
| 26 | 26 | { |
| 27 | - $this->data['cardNumber'] = (string) $cardNumbers; |
|
| 27 | + $this->data[ 'cardNumber' ] = (string)$cardNumbers; |
|
| 28 | 28 | |
| 29 | 29 | return $this; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function setCVV(int $cvvNumbers): CardInterface |
| 33 | 33 | { |
| 34 | - $this->data['cvv'] = $cvvNumbers; |
|
| 34 | + $this->data[ 'cvv' ] = $cvvNumbers; |
|
| 35 | 35 | |
| 36 | 36 | return $this; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function setNameOnCard(string $name): CardInterface |
| 40 | 40 | { |
| 41 | - $this->data['nameOnCard'] = $name; |
|
| 41 | + $this->data[ 'nameOnCard' ] = $name; |
|
| 42 | 42 | |
| 43 | 43 | return $this; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function setAmountInCents(int $cents): CardInterface |
| 47 | 47 | { |
| 48 | - $this->data['amount'] = $cents; |
|
| 48 | + $this->data[ 'amount' ] = $cents; |
|
| 49 | 49 | |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function setAmountInDollars(float $amount): CardInterface |
| 54 | 54 | { |
| 55 | - $this->data['amount'] = (int) ($amount * 100); // normalize to cents |
|
| 55 | + $this->data[ 'amount' ] = (int)($amount * 100); // normalize to cents |
|
| 56 | 56 | |
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function getNumbers(): ?string |
| 61 | 61 | { |
| 62 | - return $this->data['cardNumber']; |
|
| 62 | + return $this->data[ 'cardNumber' ]; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function getCVV(): ?int |
| 66 | 66 | { |
| 67 | - return $this->data['cvv']; |
|
| 67 | + return $this->data[ 'cvv' ]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function getNameOnCard(): ?string |
| 71 | 71 | { |
| 72 | - return $this->data['nameOnCard']; |
|
| 72 | + return $this->data[ 'nameOnCard' ]; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function getAmountInCents(): ?int |
| 76 | 76 | { |
| 77 | - return $this->data['amount']; |
|
| 77 | + return $this->data[ 'amount' ]; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function getAmountInDollars(): ?float |
| 81 | 81 | { |
| 82 | - $amount = $this->data['amount']; |
|
| 82 | + $amount = $this->data[ 'amount' ]; |
|
| 83 | 83 | |
| 84 | 84 | return $amount !== null ? $amount / 100 : null; |
| 85 | 85 | } |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | $creditCard->setExpirationDate( |
| 92 | 92 | sprintf('%04d-%02d', $this->getExpYear(), $this->getExpMonth()) |
| 93 | 93 | ); |
| 94 | - $creditCard->setCardCode((string) $this->getCVV()); |
|
| 94 | + $creditCard->setCardCode((string)$this->getCVV()); |
|
| 95 | 95 | |
| 96 | 96 | $paymentOne = new AnetAPI\PaymentType(); |
| 97 | 97 | $paymentOne->setCreditCard($creditCard); |
| 98 | 98 | |
| 99 | 99 | $customerData = new AnetAPI\CustomerDataType(); |
| 100 | 100 | $customerData->setType('individual'); |
| 101 | - $customerData->setId((string) $this->user->id); |
|
| 101 | + $customerData->setId((string)$this->user->id); |
|
| 102 | 102 | $customerData->setEmail($this->user->email ?? ''); |
| 103 | 103 | |
| 104 | 104 | $transactionRequestType = new AnetAPI\TransactionRequestType(); |
@@ -120,57 +120,57 @@ discard block |
||
| 120 | 120 | public function setExpMonth(int|string $month): CardInterface |
| 121 | 121 | { |
| 122 | 122 | $intMonth = is_string($month) |
| 123 | - ? (int) Carbon::parse($month)->format('m') |
|
| 123 | + ? (int)Carbon::parse($month)->format('m') |
|
| 124 | 124 | : $month; |
| 125 | 125 | |
| 126 | - $this->data['expMonth'] = $intMonth; |
|
| 126 | + $this->data[ 'expMonth' ] = $intMonth; |
|
| 127 | 127 | |
| 128 | 128 | return $this; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | public function setExpYear(int|string $year): CardInterface |
| 132 | 132 | { |
| 133 | - $yearStr = (string) $year; |
|
| 133 | + $yearStr = (string)$year; |
|
| 134 | 134 | $intYear = strlen($yearStr) === 2 |
| 135 | - ? (int) ('20' . $yearStr) |
|
| 136 | - : (int) $year; |
|
| 135 | + ? (int)('20' . $yearStr) |
|
| 136 | + : (int)$year; |
|
| 137 | 137 | |
| 138 | - $this->data['expYear'] = $intYear; |
|
| 138 | + $this->data[ 'expYear' ] = $intYear; |
|
| 139 | 139 | |
| 140 | 140 | return $this; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function setType(string $type = 'Credit'): CardInterface |
| 144 | 144 | { |
| 145 | - $this->data['type'] = $type; |
|
| 145 | + $this->data[ 'type' ] = $type; |
|
| 146 | 146 | |
| 147 | 147 | return $this; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function setBrand(string $brandName): CardInterface |
| 151 | 151 | { |
| 152 | - $this->data['brand'] = $brandName; |
|
| 152 | + $this->data[ 'brand' ] = $brandName; |
|
| 153 | 153 | |
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function getBrand(): ?string |
| 158 | 158 | { |
| 159 | - return $this->data['brand']; |
|
| 159 | + return $this->data[ 'brand' ]; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | public function getType(): ?string |
| 163 | 163 | { |
| 164 | - return $this->data['type']; |
|
| 164 | + return $this->data[ 'type' ]; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public function getExpMonth(): ?int |
| 168 | 168 | { |
| 169 | - return $this->data['expMonth']; |
|
| 169 | + return $this->data[ 'expMonth' ]; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public function getExpYear(): ?int |
| 173 | 173 | { |
| 174 | - return $this->data['expYear']; |
|
| 174 | + return $this->data[ 'expYear' ]; |
|
| 175 | 175 | } |
| 176 | 176 | } |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | $merchantKeys = $this->getMerchantAuthentication(); |
| 22 | 22 | |
| 23 | 23 | $opaqueDataType = new AnetAPI\OpaqueDataType(); |
| 24 | - $opaqueDataType->setDataDescriptor($opaqueData['dataDescriptor']); |
|
| 25 | - $opaqueDataType->setDataValue($opaqueData['dataValue']); |
|
| 24 | + $opaqueDataType->setDataDescriptor($opaqueData[ 'dataDescriptor' ]); |
|
| 25 | + $opaqueDataType->setDataValue($opaqueData[ 'dataValue' ]); |
|
| 26 | 26 | |
| 27 | 27 | $paymentType = new AnetAPI\PaymentType(); |
| 28 | 28 | $paymentType->setOpaqueData($opaqueDataType); |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | return UserPaymentProfile::create([ |
| 58 | 58 | 'user_id' => $this->user->id, |
| 59 | 59 | 'payment_profile_id' => $response->getCustomerPaymentProfileId(), |
| 60 | - 'last_4' => $source['last_4'] ?? '', |
|
| 61 | - 'brand' => $source['brand'] ?? '', |
|
| 62 | - 'type' => $source['type'] ?? 'card', |
|
| 60 | + 'last_4' => $source[ 'last_4' ] ?? '', |
|
| 61 | + 'brand' => $source[ 'brand' ] ?? '', |
|
| 62 | + 'type' => $source[ 'type' ] ?? 'card', |
|
| 63 | 63 | ]); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | protected function handleCreateCustomerResponse(AnetAPI\CreateCustomerProfileResponse $response): AnetAPI\CreateCustomerProfileResponse |
| 43 | 43 | { |
| 44 | 44 | if ($response->getCustomerProfileId() === null) { |
| 45 | - $message = $response->getMessages()->getMessage()[0]->getText() ?? 'Unknown error'; |
|
| 45 | + $message = $response->getMessages()->getMessage()[ 0 ]->getText() ?? 'Unknown error'; |
|
| 46 | 46 | |
| 47 | 47 | if (app()->environment() === 'local') { |
| 48 | 48 | dd($message); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $customerProfile = new AnetAPI\CustomerProfileType(); |
| 80 | 80 | $customerProfile->setDescription('Customer Profile'); |
| 81 | - $customerProfile->setMerchantCustomerId((string) $this->user->id); |
|
| 81 | + $customerProfile->setMerchantCustomerId((string)$this->user->id); |
|
| 82 | 82 | $customerProfile->setEmail($this->user->email ?? ''); |
| 83 | 83 | |
| 84 | 84 | return $customerProfile; |