Skip to content

Commit

Permalink
Stripetest - remove call to deprecated function (#1001)
Browse files Browse the repository at this point in the history
* deprecated function call

* don't need patch
  • Loading branch information
demeritcowboy authored Sep 16, 2024
1 parent 97ec425 commit 7cb6051
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ jobs:
git apply 456.diff
git apply 457.diff
git apply 458.diff
# temporary patch for stripe keys
cd ../com.drastikbydesign.stripe
curl -L -o stripekeys.diff https://lab.civicrm.org/extensions/stripe/-/commit/916668c5e192050997e4fe687e3c053bed6a7fdc.diff
git apply stripekeys.diff
- uses: nanasess/setup-chromedriver@master
with:
# temporary to match downgraded chrome
Expand Down
33 changes: 26 additions & 7 deletions tests/src/FunctionalJavascript/StripeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ protected function setUp(): void {

$this->setUpExtension('mjwshared,firewall,mjwpaymentapi,com.drastikbydesign.stripe');

$params = [];
$result = $this->utils->wf_civicrm_api('Stripe', 'setuptest', $params);
$this->paymentProcessorID = $result['id'];
$this->utils->wf_civicrm_api('PaymentProcessor', 'create', [
'id' => $this->paymentProcessorID,
'is_test' => 0,
]);
$this->paymentProcessorID = $this->createStripeProcessor();

$this->utils->wf_civicrm_api('Setting', 'create', [
'stripe_nobillingaddress' => 1,
Expand Down Expand Up @@ -218,4 +212,29 @@ protected function setUpSettings() {
$this->saveCiviCRMSettings();
}

private function createStripeProcessor(): int {
$params = [
'name' => 'Stripe',
'domain_id' => \CRM_Core_Config::domainID(),
'payment_processor_type_id' => 'Stripe',
'title' => 'Stripe',
'is_active' => 1,
'is_default' => 0,
'is_test' => 0,
'is_recur' => 1,
'user_name' => \CRM_Utils_Constant::value('STRIPE_PK_TEST', 'pk_test_PNlMrGPvqOxwLK6Y3A9B2EFn'),
'password' => \CRM_Utils_Constant::value('STRIPE_SK_TEST', 'sk_test_WHbZbmFH97YpY2y4OpVfry9W'),
'url_site' => 'https://api.stripe.com/v1',
'url_recur' => 'https://api.stripe.com/v1',
'class_name' => 'Payment_Stripe',
'billing_mode' => 1
];
// First see if it already exists.
$result = $this->utils->wf_civicrm_api('PaymentProcessor', 'get', $params);
if ($result['count'] != 1) {
$result = $this->utils->wf_civicrm_api('PaymentProcessor', 'create', $params);
}
return $result['id'];
}

}

0 comments on commit 7cb6051

Please sign in to comment.