Skip to content

Commit 6dbd92b

Browse files
committed
fixed form return value
1 parent 2cc54ad commit 6dbd92b

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

src/Adapter/AdapterAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function setParameters(array $parameters = []): AdapterInterface
116116
continue;
117117
}
118118
$key = strtolower($key);
119-
$this->parameters[$key] = trim($value);
119+
$this->parameters[$key] = is_array($value) ? $value : trim($value);
120120
}
121121

122122
return $this;

src/Adapter/Mellat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function generateForm(): string
9696
'autoSubmit' => boolval($this->auto_submit),
9797
]);
9898

99-
return $form->toHtml();
99+
return $form->__toString();
100100
}
101101

102102
/**

src/Adapter/Parsian.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ protected function requestToken()
7575
];
7676

7777

78-
if (is_array($this->sharing) && !empty($this->sharing)) {
79-
return $this->requestTokenWithoutSharing($sendParams);
80-
} else {
78+
if (!empty($this->sharing) && is_array($this->sharing)) {
8179
return $this->requestTokenWithSharing($sendParams);
80+
} else {
81+
return $this->requestTokenWithoutSharing($sendParams);
8282
}
8383
}
8484

@@ -106,7 +106,7 @@ private function requestTokenWithoutSharing($sendParams)
106106

107107
return $response->SalePaymentRequestResult->Token;
108108
} else {
109-
throw new Exception($this->SalePaymentRequestResult->Status);
109+
throw new Exception($response->SalePaymentRequestResult->Status);
110110
}
111111
} else {
112112
throw new Exception('larapay::parsian.errors.invalid_response');
@@ -168,7 +168,7 @@ private function requestTokenWithSharing($sendParams)
168168

169169
return $response->$respo->Token;
170170
} else {
171-
throw new Exception($this->$respo->Status);
171+
throw new Exception($response->$respo->Status);
172172
}
173173
} else {
174174
throw new Exception('larapay::parsian.errors.invalid_response');
@@ -194,7 +194,7 @@ protected function generateForm(): string
194194
'autoSubmit' => boolval($this->auto_submit),
195195
]);
196196

197-
return $form->toHtml();
197+
return $form->__toString();
198198
}
199199

200200
/**

src/Adapter/Pasargad.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function generateForm(): string
6969
'sign'
7070
));
7171

72-
return $form->toHtml();
72+
return $form->__toString();
7373
}
7474

7575
/**

src/Adapter/Payir.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function generateForm(): string
8787
'submitLabel' => !empty($this->submit_label) ? $this->submit_label : trans("larapay::larapay.goto_gate"),
8888
'autoSubmit' => true,
8989
]);
90-
return $form->toHtml();
90+
return $form->__toString();
9191
}
9292

9393
/**

src/Adapter/Saderat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function generateForm(): string
136136
'autoSubmit' => boolval($this->auto_submit)
137137
]);
138138

139-
return $form->toHtml();
139+
return $form->__toString();
140140
}
141141

142142
/**

src/Adapter/Zarinpal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function generateForm(): string
9494
'autoSubmit' => boolval($this->auto_submit),
9595
]);
9696

97-
return $form->toHtml();
97+
return $form->__toString();
9898
}
9999

100100
/**

src/Payable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function createTransaction(
6767
$transactionData['submitted'] = true;
6868
$transactionData['bank_order_id'] = $this->generateBankOrderId($paymentGateway);
6969
$transactionData['payment_method'] = 'ONLINE';
70-
$transactionData['additional_data'] = json_encode($additionalData, JSON_UNESCAPED_UNICODE|JSON_FORCE_OBJECT);
71-
$transactionData['sharing'] = json_encode($sharing, JSON_UNESCAPED_UNICODE|JSON_FORCE_OBJECT);
70+
$transactionData['additional_data'] = empty($sharing) ? '{}' : json_encode($additionalData, JSON_UNESCAPED_UNICODE);
71+
$transactionData['sharing'] = empty($sharing) ? '{}' : json_encode($sharing, JSON_UNESCAPED_UNICODE);
7272

7373
return $this->transactions()->create($transactionData);
7474
}

0 commit comments

Comments
 (0)