Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes suggested in review #50

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $api = Instamojo\Instamojo::init($authType,[
"username" => 'FOO', /** In case of user based authentication**/
"password" => 'XXXXXXXX' /** In case of user based authentication**/

],true); /** true for sandbox enviorment**/
],true); /** true for sandbox environment**/

```

Expand Down Expand Up @@ -62,10 +62,10 @@ catch (Exception $e) {
}
```

This will give you JSON object containing details of the Payment Request that was just created with `longurl` key provide you instamojo-payment-url.
This will give you JSON object containing details of the Payment Request and a `longurl` on which you can perform a checkout process.

### Recommended seamless checkout Option
You can render your Instamojo checkout form and collect payments on your webpage with just the instamojo-payment-url obtained in `createPaymentRequest()` using JS based seamless checkout library. To know more how its work [Click here](https://docs.instamojo.com/page/seamless-checkout).
You can render the Instamojo checkout form and collect payments on your webpage using the instamojo-payment-url obtained from `createPaymentRequest()` using our JS based seamless checkout library. To know more about how it works [Click here](https://docs.instamojo.com/page/seamless-checkout).

## Payment Request Creation Parameters

Expand All @@ -82,8 +82,8 @@ This will give you JSON object containing details of the Payment Request that wa
* `redirect_url`: set this to a thank-you page on your site. Buyers will be redirected here after successful payment.
* `webhook`: set this to a URL that can accept POST requests made by Instamojo server after successful payment.
* `allow_repeated_payments`: To disallow multiple successful payments on a Payment Request pass `false` for this field. If this is set to `false` then the link is not accessible publicly after first successful payment, though you can still access it using API(default value: `true`).
* `partner_fee_type` : Allows you to receive a cut from from payments you facilitate. For fixed fee set this to `fixed`, or for percentage fee set it to `percent`.
* `partner_fee` : This describes the fee that you would collect. It can be either a fixed amount, or a percentage of the original amount, depending on the value of `partner_fee_type`.
* `partner_fee_type` : Allows you to receive a cut from the payments you facilitate. For fixed fee set this to `fixed`, or for percentage fee set it to `percent`.
* `partner_fee` : This is a double data type key which describes the fee that you would collect. It can be either a fixed amount, or a percentage of the original amount, depending on the value of `partner_fee_type`.
* `mark_fulfilled` : Flag to determine if you want to put the payment on hold until you explicitly fulfil it. If `mark_fulfilled` is `True` the payment will be paid out to the merchant. If `mark_fulfilled` is `False`, then the payment will be put on hold until you explicitly fulfil the payment. See Fulfil a Payment below on how to fulfil a payment.
* `expires_at` : Time after which the payment request will be expired in UTC timestamp. Max value is 600 seconds. Default is Null.

Expand Down Expand Up @@ -219,7 +219,7 @@ catch (Exception $e) {
```
`$payment_request_id` id the `id` key obtained in `createPaymentRequest()` method.

This will give you JSON object containing with created `order_id` key.
This will give you JSON object that contains newly created order id in `order_id` key.


### Get the details of a Gateway Order
Expand Down Expand Up @@ -297,7 +297,7 @@ catch (Exception $e) {
}
```

This will give you JSON object containing details of the Refund.
This will give you JSON object containing details of the Refund.



Expand All @@ -314,7 +314,7 @@ catch (Exception $e) {
}
```

This will give you an array containing Refunds details so far.
This will give you an array containing Refunds details so far.

getRefunds() also accepts optional parameters for pagination.

Expand Down
4 changes: 3 additions & 1 deletion docs/v1.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ catch (Exception $e) {

This will give you JSON object containing details of the Payment Request that was just created.


### Recommended seamless checkout Option
You can render the Instamojo checkout form and collect payments on your webpage using the instamojo-payment-url obtained from `createPaymentRequest()` using our JS based seamless checkout library. To know more about how it works [Click here](https://docs.instamojo.com/page/seamless-checkout).

### Get the status or details of a Payment Request

```php
Expand Down
23 changes: 14 additions & 9 deletions docs/v2.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

Assists you to programmatically create, edit and delete Links on Instamojo in PHP.

**Note**: If you're using this wrapper with our sandbox environment `https://test.instamojo.com/` then you should pass `true` as third argument to the `Instamojo` class while initializing it. `client_id` and `client_secret` token for the same can be obtained from https://test.instamojo.com/developers/ (Details: [Test Or Sandbox Account](https://instamojo.zendesk.com/hc/en-us/articles/208485675-Test-or-Sandbox-Account)).
**Note**:
* If you are using other version of instamojo-php you can refer to their docs from appropriate link below
* [v1.1](docs/v1.1)

* If you're using this wrapper with our sandbox environment `https://test.instamojo.com/` then you should pass `true` as third argument to the `Instamojo` class while initializing it. `client_id` and `client_secret` token for the same can be obtained from https://test.instamojo.com/developers/ (Details: [Test Or Sandbox Account](https://instamojo.zendesk.com/hc/en-us/articles/208485675-Test-or-Sandbox-Account)).


```php
$authType = "app/user" /**Depend on app or user based authentication**/
Expand All @@ -13,7 +18,7 @@ $api = Instamojo\Instamojo::init($authType,[
"username" => 'FOO', /** In case of user based authentication**/
"password" => 'XXXXXXXX' /** In case of user based authentication**/

],true); /** true for sandbox enviorment**/
],true); /** true for sandbox environment**/

```

Expand Down Expand Up @@ -57,10 +62,10 @@ catch (Exception $e) {
}
```

This will give you JSON object containing details of the Payment Request that was just created with `longurl` key provide you instamojo-payment-url.
This will give you JSON object containing details of the Payment Request and a `longurl` on which you can perform a checkout process.

### Recommended seamless checkout Option
You can render your Instamojo checkout form and collect payments on your webpage with just the instamojo-payment-url obtained in `createPaymentRequest()` using JS based seamless checkout library. To know more how its work [Click here](https://docs.instamojo.com/page/seamless-checkout).
You can render the Instamojo checkout form and collect payments on your webpage using the instamojo-payment-url obtained from `createPaymentRequest()` using our JS based seamless checkout library. To know more about how it works [Click here](https://docs.instamojo.com/page/seamless-checkout).

## Payment Request Creation Parameters

Expand All @@ -77,8 +82,8 @@ This will give you JSON object containing details of the Payment Request that wa
* `redirect_url`: set this to a thank-you page on your site. Buyers will be redirected here after successful payment.
* `webhook`: set this to a URL that can accept POST requests made by Instamojo server after successful payment.
* `allow_repeated_payments`: To disallow multiple successful payments on a Payment Request pass `false` for this field. If this is set to `false` then the link is not accessible publicly after first successful payment, though you can still access it using API(default value: `true`).
* `partner_fee_type` : Allows you to receive a cut from from payments you facilitate. For fixed fee set this to `fixed`, or for percentage fee set it to `percent`.
* `partner_fee` : This describes the fee that you would collect. It can be either a fixed amount, or a percentage of the original amount, depending on the value of `partner_fee_type`.
* `partner_fee_type` : Allows you to receive a cut from the payments you facilitate. For fixed fee set this to `fixed`, or for percentage fee set it to `percent`.
* `partner_fee` : This is a double data type key which describes the fee that you would collect. It can be either a fixed amount, or a percentage of the original amount, depending on the value of `partner_fee_type`.
* `mark_fulfilled` : Flag to determine if you want to put the payment on hold until you explicitly fulfil it. If `mark_fulfilled` is `True` the payment will be paid out to the merchant. If `mark_fulfilled` is `False`, then the payment will be put on hold until you explicitly fulfil the payment. See Fulfil a Payment below on how to fulfil a payment.
* `expires_at` : Time after which the payment request will be expired in UTC timestamp. Max value is 600 seconds. Default is Null.

Expand Down Expand Up @@ -214,7 +219,7 @@ catch (Exception $e) {
```
`$payment_request_id` id the `id` key obtained in `createPaymentRequest()` method.

This will give you JSON object containing with created `order_id` key.
This will give you JSON object that contains newly created order id in `order_id` key.


### Get the details of a Gateway Order
Expand Down Expand Up @@ -292,7 +297,7 @@ catch (Exception $e) {
}
```

This will give you JSON object containing details of the Refund.
This will give you JSON object containing details of the Refund.



Expand All @@ -309,7 +314,7 @@ catch (Exception $e) {
}
```

This will give you an array containing Refunds details so far.
This will give you an array containing Refunds details so far.

getRefunds() also accepts optional parameters for pagination.

Expand Down
16 changes: 3 additions & 13 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
],true);


// $transaction_id = "TEST_".time();
// var_dump([
// "name" => "XYZ",
// "email" => "[email protected]",
// "phone" => "9999999988",
// "amount" => 200,
// "transaction_id" => $transaction_id,
// "currency" => "INR"
// ]);


$payment_request = $instaobj->createPaymentRequest([
'amount'=>10,
Expand All @@ -29,11 +21,9 @@
"292e38e570794fa592ccf74cc84c8fda",
[
"name" => "XYZ",
"email" => "xyz@squareboat.com",
"email" => "foo@Foo.com",
"phone" => "9999999988",
// "amount" => 200,
// "transaction_id" => $transaction_id,
// "currency" => "INR"

]);

var_dump(json_encode($gateway_order));
Expand Down
10 changes: 2 additions & 8 deletions src/Instamojo.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,7 @@ public function __toString()
*/
static function init($type='app', $params, $test=false)
{
// $scope = isset($params['scope']) ? $params['scope'] : NULL;

// if (self::$thisObj != null && (self::$scope == $scope || $scope == NULL ) ) {

// return self::$thisObj;

// } else {


self::validateTypeParams($type, $params);
self::$authType = $type;
Expand All @@ -206,7 +200,7 @@ static function init($type='app', $params, $test=false)
self::$scope = isset($auth_response['scope']) ? $auth_response['scope'] : '';

return self::$thisObj;
// }

}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/GatewayOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_create_a_gateway_order()

$gateway_order = $this->instaobj->createGatewayOrder([
"name" => "XYZ",
"email" => "xyz@squareboat.com",
"email" => "xyz@foo.com",
"phone" => "9999999988",
"amount" => "200",
"transaction_id" => $transaction_id,
Expand Down